Esempio n. 1
0
 public override void ToBuffer(ref FMp4MessagePackWriter writer)
 {
     Start(ref writer);
     WriterVisualSampleEntryToBuffer(ref writer);
     AVCConfigurationBox.ToBuffer(ref writer);
     if (MPEG4BitRateBox != null)
     {
         MPEG4BitRateBox.ToBuffer(ref writer);
     }
     End(ref writer);
 }
Esempio n. 2
0
        public void moov_trak_mdia_hdlr_minf_stbl_test()
        {
            //000000e17374626c000000957374736400000000000000010000008561766331000000000000000100000000000000000000000000000000022003c0004800000048000000000000000100000000000000000000000000000000000000000000000000000000000000000018ffff0000002f617663430164001fffe100176764001facd940881e684000f4240037b40883c60c658001000568efbcb0000000001073747473000000000000000000000010737473630000000000000000000000147374737a000000000000000000000000000000107374636f0000000000000000
            //stbl
            SampleTableBox sampleTableBox = new SampleTableBox();
            //stbl->stsd
            SampleDescriptionBox sampleDescriptionBox = new SampleDescriptionBox(HandlerType.none);
            //stbl->stsd->avc1
            AVC1SampleEntry aVC1SampleEntry = new AVC1SampleEntry();

            aVC1SampleEntry.Width  = 0x0220;
            aVC1SampleEntry.Height = 0x03c0;
            //stbl->stsd->avc1->avcc
            AVCConfigurationBox aVCConfigurationBox = new AVCConfigurationBox();

            aVCConfigurationBox.AVCProfileIndication = 0x64;
            aVCConfigurationBox.ProfileCompatibility = 0;
            aVCConfigurationBox.AVCLevelIndication   = 0x1f;
            aVCConfigurationBox.LengthSizeMinusOne   = 0xff;
            aVCConfigurationBox.SPSs = new List <byte[]>()
            {
                "6764001facd940881e684000f4240037b40883c60c6580".ToHexBytes()
            };
            aVCConfigurationBox.PPSs = new List <byte[]>()
            {
                "68efbcb000".ToHexBytes()
            };
            aVC1SampleEntry.AVCConfigurationBox = aVCConfigurationBox;
            sampleDescriptionBox.SampleEntries  = new List <SampleEntry>()
            {
                aVC1SampleEntry
            };
            sampleTableBox.SampleDescriptionBox = sampleDescriptionBox;
            //stbl->stts
            sampleTableBox.TimeToSampleBox = new TimeToSampleBox();
            //stbl->stsc
            sampleTableBox.SampleToChunkBox = new SampleToChunkBox();
            //stbl->stsz
            sampleTableBox.SampleSizeBox = new SampleSizeBox();
            //stbl->stco
            sampleTableBox.ChunkOffsetBox = new ChunkOffsetBox();
            FMp4MessagePackWriter writer = new MessagePack.FMp4MessagePackWriter(new byte[0x000000e1]);

            sampleTableBox.ToBuffer(ref writer);
            var hex = writer.FlushAndGetArray().ToHexString();

            Assert.Equal("000000e17374626c000000957374736400000000000000010000008561766331000000000000000100000000000000000000000000000000022003c0004800000048000000000000000100000000000000000000000000000000000000000000000000000000000000000018ffff0000002f617663430164001fffe100176764001facd940881e684000f4240037b40883c60c658001000568efbcb0000000001073747473000000000000000000000010737473630000000000000000000000147374737a000000000000000000000000000000107374636f0000000000000000".ToUpper(), hex);
        }
Esempio n. 3
0
        public void Test1()
        {
            //0000002f617663430164001fffe100176764001facd940881e684000f4240037b40883c60c658001000568efbcb000
            //00 00 00 2f
            //61 76 63 43
            //01
            //64
            //00
            //1f
            //ff
            //e1 numOfSequenceParameterSets 1
            //00 17
            //67 64 00 1f
            //ac d9 40 88
            //1e 68 40 00
            //f4 24 00 37
            //b4 08 83 c6
            //0c 65 80
            //01 NumOfPictureParameterSets 1
            //00 05
            //68 ef bc b0 00
            AVCConfigurationBox aVCConfigurationBox = new AVCConfigurationBox();

            aVCConfigurationBox.AVCProfileIndication = 0x64;
            aVCConfigurationBox.ProfileCompatibility = 0;
            aVCConfigurationBox.AVCLevelIndication   = 0x1f;
            aVCConfigurationBox.LengthSizeMinusOne   = 0xff;
            aVCConfigurationBox.SPSs = new List <byte[]>()
            {
                "6764001facd940881e684000f4240037b40883c60c6580".ToHexBytes()
            };
            aVCConfigurationBox.PPSs = new List <byte[]>()
            {
                "68efbcb000".ToHexBytes()
            };
            FMp4MessagePackWriter writer = new FMp4MessagePackWriter(new byte[0x0000002f]);

            aVCConfigurationBox.ToBuffer(ref writer);
            var hex = writer.FlushAndGetArray().ToHexString();

            Assert.Equal("0000002f617663430164001fffe100176764001facd940881e684000f4240037b40883c60c658001000568efbcb000".ToUpper(), hex);
        }
Esempio n. 4
0
        public void Test1()
        {
            //0000008561766331000000000000000100000000000000000000000000000000022003C0004800000048000000000000000100000000000000000000000000000000000000000000000000000000000000000018FFFF0000002F617663430164001FFFE100176764001FACD940881E684000F4240037B40883C60C658001000568EFBCB000
            //1.avc1
            //0000008561766331000000000000000100000000000000000000000000000000022003C0004800000048000000000000000100000000000000000000000000000000000000000000000000000000000000000018FFFF
            //2.avc1->avcc
            //0000002F617663430164001FFFE100176764001FACD940881E684000F4240037B40883C60C658001000568EFBCB000
            //0000008561766331000000000000000100000000000000000000000000000000022003c0004800000048000000000000000100000000000000000000000000000000000000000000000000000000000000000018ffff

            //-------------avc1
            //00 00 00 85
            //61 76 63 31
            //00 00 00
            //00 00 00
            //00 01
            //00 00
            //00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00
            //02 20
            //03 c0
            //00 48 00 00
            //00 48 00 00
            //00 00 00 00
            //00 01
            //00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00
            //00 18
            //ff ff
            AVC1SampleEntry aVC1SampleEntry = new AVC1SampleEntry();

            aVC1SampleEntry.Width  = 0x0220;
            aVC1SampleEntry.Height = 0x03c0;
            AVCConfigurationBox aVCConfigurationBox = new AVCConfigurationBox();

            aVCConfigurationBox.AVCProfileIndication = 0x64;
            aVCConfigurationBox.ProfileCompatibility = 0;
            aVCConfigurationBox.AVCLevelIndication   = 0x1f;
            aVCConfigurationBox.LengthSizeMinusOne   = 0xff;
            aVCConfigurationBox.SPSs = new List <byte[]>()
            {
                "6764001facd940881e684000f4240037b40883c60c6580".ToHexBytes()
            };
            aVCConfigurationBox.PPSs = new List <byte[]>()
            {
                "68efbcb000".ToHexBytes()
            };
            aVC1SampleEntry.AVCConfigurationBox = aVCConfigurationBox;
            FMp4MessagePackWriter writer = new FMp4MessagePackWriter(new byte[0x00000085]);

            aVC1SampleEntry.ToBuffer(ref writer);
            var hex = writer.FlushAndGetArray().ToHexString();

            Assert.Equal("0000008561766331000000000000000100000000000000000000000000000000022003C0004800000048000000000000000100000000000000000000000000000000000000000000000000000000000000000018FFFF0000002F617663430164001FFFE100176764001FACD940881E684000F4240037B40883C60C658001000568EFBCB000".ToUpper(), hex);
        }