mirror of https://bitbucket.org/ausocean/av.git
codec/mjpeg/jpeg.go: added putMarker function to write JPEG marker codes to an io.Writer
This commit is contained in:
parent
c6252195af
commit
db877fd934
|
@ -24,6 +24,8 @@ LICENSE
|
||||||
|
|
||||||
package mjpeg
|
package mjpeg
|
||||||
|
|
||||||
|
import "io"
|
||||||
|
|
||||||
// JPEG marker codes.
|
// JPEG marker codes.
|
||||||
const (
|
const (
|
||||||
soi = 0xd8 // Start of image.
|
soi = 0xd8 // Start of image.
|
||||||
|
@ -34,3 +36,12 @@ const (
|
||||||
app0 = 0xe0 // TODO: find out what this is.
|
app0 = 0xe0 // TODO: find out what this is.
|
||||||
sof0 = 0xc0 // Baseline
|
sof0 = 0xc0 // Baseline
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// putMarker writes an JPEG marker with code to w.
|
||||||
|
func putMarker(w io.Writer, code byte) error {
|
||||||
|
_, err := w.Write([]byte{0xff, code})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue