mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
mjpeg: fix decoding and encoding JPEG types 1-63 (#605)
Type 0 corresponds to YUV 4:2:2. Since this header is passed directly to the JPEG header, no additional changes are necessary for support. See the type field here: https://datatracker.ietf.org/doc/html/rfc2435#section-4.1 Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
@@ -187,7 +187,7 @@ outer:
|
|||||||
return nil, fmt.Errorf("SOF not found")
|
return nil, fmt.Errorf("SOF not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
if sof.Type != 1 {
|
if sof.Type > 63 {
|
||||||
return nil, fmt.Errorf("JPEG type %d is not supported", sof.Type)
|
return nil, fmt.Errorf("JPEG type %d is not supported", sof.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ func (h *headerJPEG) unmarshal(byts []byte) (int, error) {
|
|||||||
h.FragmentOffset = uint32(byts[1])<<16 | uint32(byts[2])<<8 | uint32(byts[3])
|
h.FragmentOffset = uint32(byts[1])<<16 | uint32(byts[2])<<8 | uint32(byts[3])
|
||||||
|
|
||||||
h.Type = byts[4]
|
h.Type = byts[4]
|
||||||
if h.Type != 1 {
|
if h.Type > 63 {
|
||||||
return 0, fmt.Errorf("type %d is not supported", h.Type)
|
return 0, fmt.Errorf("type %d is not supported", h.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user