2019-11-15 07:41:53 +03:00
|
|
|
/*
|
|
|
|
DESCRIPTION
|
|
|
|
jpeg.go contains constants, structure and functions specific to the JPEG.
|
|
|
|
|
|
|
|
AUTHOR
|
|
|
|
Saxon Nelson-Milton <saxon@ausocean.org>
|
|
|
|
|
|
|
|
LICENSE
|
|
|
|
Copyright (C) 2017 the Australian Ocean Lab (AusOcean)
|
|
|
|
|
|
|
|
It is free software: you can redistribute it and/or modify them
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with revid in gpl.txt. If not, see http://www.gnu.org/licenses.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package mjpeg
|
|
|
|
|
2019-11-15 08:11:02 +03:00
|
|
|
import "io"
|
|
|
|
|
2019-11-15 07:41:53 +03:00
|
|
|
// JPEG marker codes.
|
|
|
|
const (
|
|
|
|
soi = 0xd8 // Start of image.
|
|
|
|
dri = 0xdd // Define restart interval.
|
|
|
|
dqt = 0xdb // Define quantization tables.
|
|
|
|
dht = 0xde // Define hierarchical progression.
|
|
|
|
sos = 0xda // Start of scan.
|
|
|
|
app0 = 0xe0 // TODO: find out what this is.
|
|
|
|
sof0 = 0xc0 // Baseline
|
|
|
|
)
|
2019-11-15 08:11:02 +03:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|