Пример #1
0
 internal bool DecodePrimaryHeader(ogg.Packet p, ogg.StreamState s)
 {
     if (theoraInfo.decode_header(theoraComment, p) >= 0)
     {
         //This is the Theora stream, so store it
         theoraStreamState = s;
         headerCount       = 1;
         return(true);
     }
     return(false);
 }
Пример #2
0
 internal bool DecodePrimaryHeader(ogg.Packet p, ogg.StreamState s)
 {
     if (vorbisInfo.synthesis_headerin(vorbisComment, p) >= 0)
     {
         //This is vorbis stream, so store it
         vorbisStreamState = s;
         headerCount       = 1;
         return(true);
     }
     return(false);
 }
Пример #3
0
        public virtual void Dispose()
        {
            if (oggPacket != null)
            {
                oggPacket.Dispose();
                oggPacket = null;
            }

            if (yuvBuffer != null)
            {
                yuvBuffer.Dispose();
                yuvBuffer = null;
            }

            if (theoraState != null)
            {
                theoraState.Dispose();
                theoraState = null;
            }

            if (theoraInfo != null)
            {
                theoraInfo.Dispose();
                theoraInfo = null;
            }

            if (theoraComment != null)
            {
                theoraComment.Dispose();
                theoraComment = null;
            }

            if (theoraStreamState != null)
            {
                theoraStreamState.Dispose();
                theoraStreamState = null;
            }

            GC.SuppressFinalize(this);
        }
Пример #4
0
        public virtual void Dispose()
        {
            if (oggPacket != null)
            {
                oggPacket.Dispose();
                oggPacket = null;
            }

            if (vorbisDSPState != null)
            {
                vorbisDSPState.Dispose();
                vorbisDSPState = null;
            }

            if (vorbisBlock != null)
            {
                vorbisBlock.Dispose();
                vorbisBlock = null;
            }

            if (vorbisInfo != null)
            {
                vorbisInfo.Dispose();
                vorbisInfo = null;
            }

            if (vorbisComment != null)
            {
                vorbisComment.Dispose();
                vorbisComment = null;
            }

            if (vorbisStreamState != null)
            {
                vorbisStreamState.Dispose();
                vorbisStreamState = null;
            }
        }
Пример #5
0
        /// <summary>
        /// internal method for parsing the main stream headers
        /// </summary>
        void ParsePrimaryHeaders()
        {
            ogg.Packet tempOggPacket  = new ogg.Packet();
            bool       notDone        = true;
            int        vorbis_streams = 0;
            int        theora_streams = 0;

            while (notDone)
            {
                if (BufferData() == 0)
                {
                    tempOggPacket.Dispose();
                    throw new Exception("Invalid ogg file");
                }

                //Check for page data
                while (oggSyncState.pageout(oggPage) > 0)
                {
                    //is this an initial header? If not, stop
                    if (oggPage.bos() == 0)
                    {
                        //This is done blindly, because stream only accept them selfs
                        if (videoDriver != null && theora_streams > 0)
                        {
                            videoDriver.PageIn(oggPage);
                        }
                        if (audioDriver != null && vorbis_streams > 0)
                        {
                            audioDriver.PageIn(oggPage);
                        }
                        notDone = false;
                        break;
                    }

                    ogg.StreamState oggStateTest = new ogg.StreamState(oggPage.serialno());
                    //oggStateTest.init( oggPage.serialno() );
                    oggStateTest.pagein(oggPage);
                    oggStateTest.packetout(tempOggPacket);

                    //identify the codec
                    if (videoDriver != null && videoDriver.DecodePrimaryHeader(tempOggPacket, oggStateTest))
                    {
                        theora_streams = 1;
                    }
                    else if (audioDriver != null && audioDriver.DecodePrimaryHeader(tempOggPacket, oggStateTest))
                    {
                        vorbis_streams = 1;
                    }
                    else
                    {
                        oggStateTest.Dispose();
                    }
                }         //end while ogg_sync_pageout
            }             //end while notdone

            //if pri headers not found, then remove driver
            if (theora_streams == 0 && videoDriver != null)
            {
                videoDriver.Dispose();
                videoDriver = null;
            }
            if (vorbis_streams == 0 && audioDriver != null)
            {
                audioDriver.Dispose();
                audioDriver = null;
            }

            tempOggPacket.Dispose();
        }