diff --git a/Versions.md b/Versions.md index 37c2e026..2804a89d 100644 --- a/Versions.md +++ b/Versions.md @@ -2,6 +2,7 @@ | Version | Highlight | | ------ | --------- | +| 0.21.1 | fix: allow MPEG-2 ADTS | | 0.21.0 | feat: version number in apps and mp4 package | | 0.20.0 | feat: mp4ff-pslister better for hex SPS input | | 0.19.0 | fix: trun optimization, feat: mfra-related boxes | diff --git a/aac/adts.go b/aac/adts.go index 73a46331..01cfabd1 100644 --- a/aac/adts.go +++ b/aac/adts.go @@ -12,6 +12,7 @@ import ( // Not used in mp4 files, but in MPEG-2 TS. // Defined in ISO/IEC 13818-7 type ADTSHeader struct { + ID byte // 0 is MPEG-4, 1 is MPEG-2 ObjectType byte SamplingFrequencyIndex byte ChannelConfig byte @@ -59,10 +60,7 @@ func DecodedAdtsHeader(r io.Reader) (*ADTSHeader, error) { if sync != 0xfff { return nil, fmt.Errorf("Bad sync") } - mpegID := br.Read(1) - if mpegID != 0 { - return nil, fmt.Errorf("ID not 0 (MPEG-4)") - } + mpegID := byte(br.Read(1)) layer := br.Read(2) if layer != 0 { return nil, fmt.Errorf("Non-permitted layer value %d", layer) @@ -71,7 +69,7 @@ func DecodedAdtsHeader(r io.Reader) (*ADTSHeader, error) { if protectionAbsent != 1 { return nil, fmt.Errorf("protection_absent not set. Not supported") } - ah := &ADTSHeader{} + ah := &ADTSHeader{ID: mpegID} profile := br.Read(2) ah.ObjectType = byte(profile + 1) ah.SamplingFrequencyIndex = byte(br.Read(4)) diff --git a/mp4/version.go b/mp4/version.go index 5e09cbbb..f762eb53 100644 --- a/mp4/version.go +++ b/mp4/version.go @@ -7,7 +7,7 @@ import ( ) var ( - commitVersion string = "v0.21.0" // Updated when building using Makefile + commitVersion string = "v0.21.1" // Updated when building using Makefile commitDate string // commitDate in Epoch seconds (inserted from Makefile) )