示例#1
0
        int PackBooks(NVorbis.Ogg.BBuffer Buffer)
        {
            Buffer.Write(0x05, 8);
            Buffer.Write(_vorbis);

            // books
            Buffer.Write(Books - 1, 8);
            for (int i = 0; i < Books; i++)
            {
                if (BookParam[i].pack(Buffer) != 0)
                {
                    //goto err_out;
                    return(-1);
                }
            }

            // times
            Buffer.Write(Times - 1, 6);
            for (int i = 0; i < Times; i++)
            {
                Buffer.Write(TimeType[i], 16);
                FuncTime.time_P[TimeType[i]].pack(this.TimeParam[i], Buffer);
            }

            // floors
            Buffer.Write(floors - 1, 6);
            for (int i = 0; i < floors; i++)
            {
                Buffer.Write(FloorType[i], 16);
                FuncFloor.floor_P[FloorType[i]].pack(FloorParam[i], Buffer);
            }

            // residues
            Buffer.Write(residues - 1, 6);
            for (int i = 0; i < residues; i++)
            {
                Buffer.Write(residue_type[i], 16);
                FuncResidue.residue_P[residue_type[i]].pack(ResidueParam[i], Buffer);
            }

            // maps
            Buffer.Write(maps - 1, 6);
            for (int i = 0; i < maps; i++)
            {
                Buffer.Write(map_type[i], 16);
                FuncMapping.mapping_P[map_type[i]].pack(this, MapParam[i], Buffer);
            }

            // modes
            Buffer.Write(Modes - 1, 6);
            for (int i = 0; i < Modes; i++)
            {
                Buffer.Write(ModeParam[i].blockflag, 1);
                Buffer.Write(ModeParam[i].windowtype, 16);
                Buffer.Write(ModeParam[i].transformtype, 16);
                Buffer.Write(ModeParam[i].mapping, 8);
            }
            Buffer.Write(1, 1);
            return(0);
        }
示例#2
0
        // pack side
        int PackInfo(NVorbis.Ogg.BBuffer Buffer)
        {
            // preamble
            Buffer.Write(0x01, 8);
            Buffer.Write(_vorbis);

            // basic information about the stream
            Buffer.Write(0x00, 32);
            Buffer.Write(Channels, 8);
            Buffer.Write(Rate, 32);

            Buffer.Write(bitrate_upper, 32);
            Buffer.Write(bitrate_nominal, 32);
            Buffer.Write(bitrate_lower, 32);

            Buffer.Write(Util.ilog2(blocksizes[0]), 4);
            Buffer.Write(Util.ilog2(blocksizes[1]), 4);
            Buffer.Write(1, 1);
            return(0);
        }