Skip to content

Commit

Permalink
fix: minor fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbee committed Sep 6, 2023
1 parent 51a33ba commit 3b2c76a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mp4/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,10 @@ func (f *File) findAndReadMfra(r io.Reader) error {
if !ok {
return fmt.Errorf("expecting readseeker when decoding file ISM file")
}
pos, err := rs.Seek(-16, io.SeekEnd)
mfroSize := int64(16) // This is the fixed size of the mfro box
pos, err := rs.Seek(-mfroSize, io.SeekEnd)
if err != nil {
return fmt.Errorf("could not seek 32 bytes from end: %w", err)
return fmt.Errorf("could not seek %d bytes from end: %w", mfroSize, err)
}
b, err := DecodeBox(uint64(pos), rs) // mfro
if err != nil {
Expand All @@ -350,11 +351,11 @@ func (f *File) findAndReadMfra(r io.Reader) error {
}
b, err = DecodeBox(uint64(pos), rs) // mfra
if err != nil {
return fmt.Errorf("could not decode mfro box: %w", err)
return fmt.Errorf("could not decode mfra box: %w", err)
}
mfra, ok := b.(*MfraBox)
if !ok {
return fmt.Errorf("expecting mfro box, but got %T", b)
return fmt.Errorf("expecting mfra box, but got %T", b)
}
if len(mfra.Tfras) != 1 {
return fmt.Errorf("only supports exactly one tfra in mfra")
Expand Down

0 comments on commit 3b2c76a

Please sign in to comment.