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
f5b6af559f
commit
7577cfa0c4
|
@ -24,6 +24,8 @@ LICENSE
|
|||
|
||||
package mjpeg
|
||||
|
||||
import "io"
|
||||
|
||||
// JPEG marker codes.
|
||||
const (
|
||||
soi = 0xd8 // Start of image.
|
||||
|
@ -34,3 +36,12 @@ const (
|
|||
app0 = 0xe0 // TODO: find out what this is.
|
||||
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