mirror of https://bitbucket.org/ausocean/av.git
codec/mjpeg/jpeg.go: defining consts for JFIF header
This commit is contained in:
parent
d146b65c57
commit
3f4561da5b
|
@ -52,6 +52,25 @@ const (
|
|||
codeEOI = 0xd9 // End of image.
|
||||
)
|
||||
|
||||
// Density units.
|
||||
const (
|
||||
unitNone = iota
|
||||
unitPxIN
|
||||
unitPxCM
|
||||
)
|
||||
|
||||
// JFIF header fields.
|
||||
const (
|
||||
jfifLabel = "JFIF\000"
|
||||
jfifVer = 0x0201
|
||||
jfifDensityUnit = unitNone // Units for pixel density fields.
|
||||
jfifXDensity = 1 // Horizontal pixel desnity.
|
||||
jfifYDensity = 1 // Vertical pixel density.
|
||||
jfifXThumbCnt = 0 // Horizontal pixel count of embedded thumbnail.
|
||||
jfifYThumbCnt = 0 // Vertical pixel count of embedded thumbnail.
|
||||
jfifHeadLen = 16 // Length of JFIF header segment excluding APP0 marker.
|
||||
)
|
||||
|
||||
var (
|
||||
errNoQTable = errors.New("no quantization table")
|
||||
errReservedQ = errors.New("q value is reserved")
|
||||
|
@ -262,15 +281,14 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
|||
|
||||
// Write JFIF header.
|
||||
mark(p, codeAPP0)
|
||||
p.put16(16)
|
||||
const jfifLabel = "JFIF\000"
|
||||
p.put16(jfifHeadLen)
|
||||
p.putBytes([]byte(jfifLabel))
|
||||
p.put16(0x0201)
|
||||
p.put8(0)
|
||||
p.put16(1)
|
||||
p.put16(1)
|
||||
p.put8(0)
|
||||
p.put8(0)
|
||||
p.put16(jfifVer)
|
||||
p.put8(jfifDensityUnit)
|
||||
p.put16(jfifXDensity)
|
||||
p.put16(jfifYDensity)
|
||||
p.put8(jfifXThumbCnt)
|
||||
p.put8(jfifYThumbCnt)
|
||||
|
||||
// If we want to define restart interval then write that.
|
||||
if dri != 0 {
|
||||
|
|
Loading…
Reference in New Issue