Skip to content

Commit

Permalink
Merge pull request #70 from edgeware/adts-plus
Browse files Browse the repository at this point in the history
improvement: allow and store ADTS ID=1 (MPEG-2)
  • Loading branch information
tobbee authored Mar 24, 2021
2 parents c734943 + 624c68f commit 2253ec9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions Versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
8 changes: 3 additions & 5 deletions aac/adts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion mp4/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)

Expand Down

0 comments on commit 2253ec9

Please sign in to comment.