示例#1
0
    private void ParseSTSC(BinaryReader br)
    {
        int Count;

        byte [] tmp;
        STSC    stsc = new STSC();

        stsc.Dummy = br.ReadBytes(4);

        tmp                         = br.ReadBytes(4); Utility.LeReverse(tmp);
        Count                       = BitConverter.ToInt32(tmp, 0);
        stsc.FirstChunk             = new int[Count];
        stsc.SamplesPerChunk        = new int[Count];
        stsc.SampleDescriptionIndex = new int[Count];

        for (int i = 0; i < Count; i++)
        {
            tmp = br.ReadBytes(4); Utility.LeReverse(tmp);
            stsc.FirstChunk[i] = BitConverter.ToInt32(tmp, 0);
            tmp = br.ReadBytes(4); Utility.LeReverse(tmp);
            stsc.SamplesPerChunk[i] = BitConverter.ToInt32(tmp, 0);
            tmp = br.ReadBytes(4); Utility.LeReverse(tmp);
            stsc.SampleDescriptionIndex[i] = BitConverter.ToInt32(tmp, 0);
        }

        this.data = stsc;
    }
示例#2
0
    private void WriteBytesSTSC(MemoryStream ms)
    {
        byte [] tmp;
        STSC    stsc = (STSC)this.data;

        ms.Write(stsc.Dummy, 0, stsc.Dummy.Length);

        tmp = BitConverter.GetBytes(stsc.FirstChunk.Length);
        Utility.LeReverse(tmp);
        ms.Write(tmp, 0, tmp.Length);

        for (int i = 0; i < stsc.FirstChunk.Length; i++)
        {
            tmp = BitConverter.GetBytes(stsc.FirstChunk[i]);
            Utility.LeReverse(tmp);
            ms.Write(tmp, 0, tmp.Length);
            tmp = BitConverter.GetBytes(stsc.SamplesPerChunk[i]);
            Utility.LeReverse(tmp);
            ms.Write(tmp, 0, tmp.Length);
            tmp = BitConverter.GetBytes(stsc.SampleDescriptionIndex[i]);
            Utility.LeReverse(tmp);
            ms.Write(tmp, 0, tmp.Length);
        }
    }
    private void ParseSTSC( BinaryReader br )
    {
        int Count;
        byte [] tmp;
        STSC stsc = new STSC();

        stsc.Dummy = br.ReadBytes( 4 );

        tmp = br.ReadBytes( 4 ); Utility.LeReverse( tmp );
        Count = BitConverter.ToInt32( tmp, 0 );
        stsc.FirstChunk = new int[ Count ];
        stsc.SamplesPerChunk = new int[ Count ];
        stsc.SampleDescriptionIndex = new int[ Count ];

        for( int i = 0; i < Count; i++ )
        {
            tmp = br.ReadBytes( 4 ); Utility.LeReverse( tmp );
            stsc.FirstChunk[ i ] = BitConverter.ToInt32( tmp, 0 );
            tmp = br.ReadBytes( 4 ); Utility.LeReverse( tmp );
            stsc.SamplesPerChunk[ i ] = BitConverter.ToInt32( tmp, 0 );
            tmp = br.ReadBytes( 4 ); Utility.LeReverse( tmp );
            stsc.SampleDescriptionIndex[ i ] = BitConverter.ToInt32( tmp, 0 );
        }

        this.data = stsc;
    }