Skip to content

Commit

Permalink
fix: allow other sbgp and sgpd types than seig with senc
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbee committed Jul 29, 2024
1 parent dbeb860 commit b07e543
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- mvhd, tkhd, and mdhd timestamps were off by one day
- allow other sbgp and sgpd types than seig with senc

### Added

Expand Down
14 changes: 2 additions & 12 deletions mp4/traf.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,8 @@ func (t *TrafBox) ParseReadSenc(defaultIVSize byte, moofStartPos uint64) error {
}
}
perSampleIVSize := defaultIVSize
if t.Sbgp != nil && t.Sgpd != nil {
sbgp, sgpd := t.Sbgp, t.Sgpd
if sbgp.GroupingType != "seig" {
return fmt.Errorf("sbgp grouping type %s not supported", sbgp.GroupingType)
}
sbgp, sgpd := t.Sbgp, t.Sgpd
if sbgp != nil && sbgp.GroupingType == "seig" && sgpd != nil && sgpd.GroupingType == "seig" {
nrSbgpEntries := len(sbgp.SampleCounts)
if nrSbgpEntries != 1 {
return fmt.Errorf("sbgp entries = %d, only 1 supported for now", nrSbgpEntries)
Expand All @@ -108,14 +105,7 @@ func (t *TrafBox) ParseReadSenc(defaultIVSize byte, moofStartPos uint64) error {
if sgpdEntryNr != sbgpInsideOffset+1 {
return fmt.Errorf("sgpd entry number must be first inside = 65536 + 1")
}
if sgpd.GroupingType != "seig" {
return fmt.Errorf("sgpd grouping type %s not supported", sgpd.GroupingType)
}

sgpdEntry := sgpd.SampleGroupEntries[sgpdEntryNr-sbgpInsideOffset-1]
if sgpdEntry.Type() != "seig" {
return fmt.Errorf("expected sgpd entry type seig but found %q", sgpdEntry.Type())
}
seigEntry := sgpdEntry.(*SeigSampleGroupEntry)
perSampleIVSize = seigEntry.PerSampleIVSize
}
Expand Down

0 comments on commit b07e543

Please sign in to comment.