codec/mjpeg/jpeg.go: added putMarker function to write JPEG marker codes to an io.Writer

This commit is contained in:
Saxon 2019-11-15 15:41:02 +10:30
parent f5b6af559f
commit 7577cfa0c4
1 changed files with 11 additions and 0 deletions

View File

@ -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
}