From 87cfbe61d6824195f3fb379ba37871fb6fdd6b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbjo=CC=88rn=20Einarsson?= Date: Fri, 19 Mar 2021 22:19:41 +0100 Subject: [PATCH 1/2] improvement: allow and store ADTS ID=1 (MPEG-2) --- aac/adts.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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)) From 624c68f1639dfde20b440b69043efa0583fa3c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbjo=CC=88rn=20Einarsson?= Date: Wed, 24 Mar 2021 08:42:51 +0100 Subject: [PATCH 2/2] doc: Version 0.21.1 --- Versions.md | 1 + mp4/version.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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/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) )