Esempio n. 1
0
        static public int ogg_stream_packetin(ref ogg_stream_state os, ref ogg_packet op)
        {
            ogg_iovec_t[] iov = new ogg_iovec_t[1];

            iov[0].iov_base = op.packet;
            iov[0].iov_len  = op.bytes;

            return(ogg_stream_iovecin(ref os, ref iov, 1, op.e_o_s, op.granulepos));
        }
Esempio n. 2
0
        static public void ogg_packet_clear(ref ogg_packet op)
        {
            if (op.packet != null)
            {
                _ogg_free(op.packet);
            }

            op = new ogg_packet();
        }
Esempio n. 3
0
 static public int ogg_stream_packetpeek(ref ogg_stream_state os, ref ogg_packet op)
 {
     if (ogg_stream_check(ref os) != 0)
     {
         return(0);
     }
     else
     {
         return(_packetout(ref os, ref op, 0));
     }
 }
Esempio n. 4
0
        public void WriteHeaders(OggStreamState oggStreamState, VorbisComment comment)
        {
            ogg_packet header      = new ogg_packet();
            ogg_packet header_comm = new ogg_packet();
            ogg_packet header_code = new ogg_packet();
            OggPage    page        = new OggPage();

            Errors.CheckVorbisError(NativeMethods.vorbis_analysis_headerout(ref InternalStruct, ref comment.InternalStruct, ref header, ref header_comm, ref header_code));
            Errors.CheckOggError(NativeMethods.ogg_stream_packetin(ref oggStreamState.InternalStruct, ref header));             // automatically placed in its own page
            Errors.CheckOggError(NativeMethods.ogg_stream_packetin(ref oggStreamState.InternalStruct, ref header_comm));
            Errors.CheckOggError(NativeMethods.ogg_stream_packetin(ref oggStreamState.InternalStruct, ref header_code));
        }
Esempio n. 5
0
 //extern static public int th_decode_packetin(th_dec_ctx* _dec, ogg_packet* _op, ogg_int64_t* _granpos);
 extern static public int th_decode_packetin(IntPtr _dec, ref ogg_packet _op, ref ogg_int64_t _granpos);
Esempio n. 6
0
 extern static public int th_decode_headerin(ref th_info _info, ref th_comment _tc, ref IntPtr _setup, ref ogg_packet _op);
Esempio n. 7
0
 public static extern long vorbis_packet_blocksize(ref vorbis_info vi, ref ogg_packet op);
Esempio n. 8
0
 public static extern int vorbis_synthesis(ref vorbis_block vb, ref ogg_packet op);
Esempio n. 9
0
 public static extern int vorbis_synthesis_headerin(ref vorbis_info vi, ref vorbis_comment vc, ref ogg_packet op);
Esempio n. 10
0
 public static extern bool vorbis_synthesis_idheader(ref ogg_packet op);
Esempio n. 11
0
 public static extern void ogg_packet_clear(ref ogg_packet op);
Esempio n. 12
0
 public static extern int ogg_stream_packetin(ref ogg_stream_state os, ref ogg_packet op);
Esempio n. 13
0
        static public int ogg_stream_packetpeek(ref ogg_stream_state os)
        {
            ogg_packet op_null = null;

            return(ogg_stream_packetpeek(ref os, ref op_null));
        }
Esempio n. 14
0
        static public int _packetout(ref ogg_stream_state os, ref ogg_packet op, int adv)
        {
            /* The last part of decode. We have the stream broken into packet segments. Now we need to group them into packets (or return the out of sync markers) */
            int ptr = os.lacing_returned;

            if (os.lacing_packet <= ptr)
            {
                return(0);
            }

            /* we need to tell the codec there's a gap; it might need to handle previous packet dependencies. */
            if ((os.lacing_vals[ptr] & 0x400) != 0)
            {
                os.lacing_returned++;
                os.packetno++;
                return(-1);
            }

            /* just using peek as an inexpensive way to ask if there's a whole packet waiting */
            if (op == null && adv == 0)
            {
                return(1);
            }

            /* Gather the whole packet. We'll have no holes or a partial packet */
            {
                int size  = os.lacing_vals[ptr] & 0xff;
                int bytes = size;
                int eos   = os.lacing_vals[ptr] & 0x200;
                int bos   = os.lacing_vals[ptr] & 0x100;

                while (size == 255)
                {
                    int val = os.lacing_vals[++ptr];

                    size = val & 0xff;

                    if ((val & 0x200) != 0)
                    {
                        eos = 0x200;
                    }

                    bytes += size;
                }

                if (op != null)
                {
                    op.e_o_s      = eos;
                    op.b_o_s      = bos;
                    op.packet     = os.body_data + os.body_returned;
                    op.packetno   = os.packetno;
                    op.granulepos = os.granule_vals[ptr];
                    op.bytes      = bytes;
                }

                if (adv != 0)
                {
                    os.body_returned  += bytes;
                    os.lacing_returned = ptr + 1;
                    os.packetno++;
                }
            }

            return(1);
        }