Exemple #1
0
        public void Init(VirtualFileStream stream, VideoDriver videoDriver, AudioDriver audioDriver,
                         bool sound3D)
        {
            this.stream      = stream;
            this.audioDriver = audioDriver;
            this.videoDriver = videoDriver;
            this.sound3D     = sound3D;

            if (videoDriver != null)
            {
                videoDriver.oggFile = this;
            }
            if (audioDriver != null)
            {
                audioDriver.oggFile = this;
            }

            oggSyncState = new ogg.SyncState();
            oggPage      = new ogg.Page();

            ParsePrimaryHeaders();
            ParseSecondaryHeaders();

            if (this.audioDriver != null)
            {
                this.audioDriver.InitDSP();
            }
            if (this.videoDriver != null)
            {
                this.videoDriver.InitTheora();
            }

            //Update first frame
            Update(0);
        }
Exemple #2
0
        public void Dispose()
        {
            try
            {
                if (criticalSection != null)
                {
                    criticalSection.Enter();
                }

                Pause = true;

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

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

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

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

                if (stream != null)
                {
                    stream.Dispose();
                    stream = null;
                }
            }
            catch (Exception ex)
            {
                Log.Error("OggFile: Exception: " + ex.ToString());
            }
            finally
            {
                if (criticalSection != null)
                {
                    criticalSection.Leave();
                }
            }

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

            GC.SuppressFinalize(this);
        }