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 c6252195af
commit db877fd934
1 changed files with 11 additions and 0 deletions

View File

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