Exemplo n.º 1
0
        public Player(MainWindow mainwindow, string filename, long timebase)
        {
            try
            {
                this.timebase = timebase;
                this.renderer = mainwindow.Renderer;
                this.audioout = mainwindow.Audio;
                this.mixer    = mainwindow.Mixer;
                this.player   = BaseLib.Media.MoviePlayer.Open(() => { }, filename);

                try
                {
                    if (player.VideoStreams.Length > 0)
                    {
                        this.video = player.open_video(0, frameready);
                    }
                    if (player.AudioStreams.Length > 0)
                    {
                        this.audio       = player.open_audio(0, mainwindow.Mixer, audioready);
                        this.audiobuffer = new FifoStream(mainwindow.Audio.SampleSize * mainwindow.Audio.SampleRate * 3);
                        this.mixer.Register(this.audiobuffer, this.audioout.Channels, false);
                    }
                    this.player.start(0, timebase);
                }
                catch
                {
                    Dispose(true);
                    GC.SuppressFinalize(this);
                    throw;
                }
            }
            catch
            {
                GC.SuppressFinalize(this);
                throw;
            }
        }