@@ -2,6 +2,7 @@ package mp4_test
22
33import (
44 "encoding/hex"
5+ "os"
56 "testing"
67
78 "github.com/Eyevinn/mp4ff/bits"
@@ -61,28 +62,21 @@ func TestVisualSampleEntryBoxVP9(t *testing.T) {
6162}
6263
6364func TestAvc1WithTrailingBytes (t * testing.T ) {
64- avc1Hex := "0000008b6176633100000000000000010000000000000000000000000000000002800168004800000048000000000000000100" +
65- "000000000000000000000000000000000000000000000000000000000000000018ffff00000031617663430164001effe100196764001ea" +
66- "cd940a02ff9610000030001000003003c8f162d9601000568ebecb22c00000000"
67- avc1Raw , err := hex .DecodeString (avc1Hex )
65+ minfWithTrailingAvc1Bytes , err := os .ReadFile ("testdata/minf_with_trailing_avc1_bytes.bin" )
6866 if err != nil {
69- t .Error (err )
67+ t .Fatal (err )
7068 }
71- sr := bits .NewFixedSliceReader (avc1Raw )
69+ sr := bits .NewFixedSliceReader (minfWithTrailingAvc1Bytes )
7270 // Decode the box
7371 box , err := mp4 .DecodeBoxSR (0 , sr )
7472 if err != nil {
7573 t .Error (err )
7674 }
7775 // Check the box type
78- if box .Type () != "avc1" {
79- t .Errorf ("expected box type avc1, got %s" , box .Type ())
80- }
81- // Check the box size
82- if box .Size () != uint64 (len (avc1Raw )) {
83- t .Errorf ("expected box size %d, got %d" , len (avc1Raw ), box .Size ())
76+ if box .Type () != "minf" {
77+ t .Errorf ("expected box type minf, got %s" , box .Type ())
8478 }
85- avc1 := box .(* mp4.VisualSampleEntryBox )
79+ avc1 := box .(* mp4.MinfBox ). Stbl . Stsd . Children [ 0 ].( * mp4. VisualSampleEntryBox )
8680 if len (avc1 .TrailingBytes ) != 4 {
8781 t .Errorf ("expected 4 trailing bytes, got %d" , len (avc1 .TrailingBytes ))
8882 }
0 commit comments