Exemplo n.º 1
0
        public PlayerEngine()
        {
            Log.InformationFormat("GStreamer# {0} Initializing; {1}.{2}",
                                  typeof(Gst.Version).Assembly.GetName().Version, Gst.Version.Description, Gst.Version.Nano);

            // Setup the gst plugins/registry paths if running Windows
            if (PlatformDetection.IsWindows)
            {
                var gst_paths = new string [] { Hyena.Paths.Combine(Hyena.Paths.InstalledApplicationPrefix, "gst-plugins") };
                Environment.SetEnvironmentVariable("GST_PLUGIN_PATH", String.Join(";", gst_paths));
                Environment.SetEnvironmentVariable("GST_PLUGIN_SYSTEM_PATH", "");
                Environment.SetEnvironmentVariable("GST_DEBUG", "1");

                string registry = Hyena.Paths.Combine(Hyena.Paths.ApplicationData, "registry.bin");
                if (!System.IO.File.Exists(registry))
                {
                    System.IO.File.Create(registry).Close();
                }

                Environment.SetEnvironmentVariable("GST_REGISTRY", registry);

                //System.Environment.SetEnvironmentVariable ("GST_REGISTRY_FORK", "no");
                Log.DebugFormat("GST_PLUGIN_PATH = {0}", Environment.GetEnvironmentVariable("GST_PLUGIN_PATH"));
            }

            Gst.Application.Init();
            playbin = new PlayBin2();

            next_track_set = new ManualResetEvent(false);

            audio_sink = new AudioSinkBin("audiobin");

            playbin["audio-sink"] = audio_sink;

            if (audio_sink.VolumeNeedsSaving)
            {
                // Remember the volume from last time
                Volume = (ushort)PlayerEngineService.VolumeSchema.Get();
            }

            Pad teepad = audio_sink.RequestTeePad();

            visualization = new Visualization(audio_sink, teepad);

            playbin.AddNotification("volume", OnVolumeChanged);
            playbin.Bus.AddWatch(OnBusMessage);
            playbin.AboutToFinish += OnAboutToFinish;

            cdda_manager = new CddaManager(playbin);
            dvd_manager  = new DvdManager(playbin);
            // FIXME: Disable video stuff until GLib# 3 is used instead of the sopy bundled in GStreamerSharp
            //video_manager = new VideoManager (playbin);
            //video_manager.PrepareWindow += OnVideoPrepareWindow;
            //video_manager.Initialize ();

            dvd_manager.FindNavigation(playbin);
            OnStateChanged(PlayerState.Ready);
        }
Exemplo n.º 2
0
        private bool ConstructPipeline(string encoder_pipeline)
        {
            Element source_elem;
            Element decoder_elem;

            pipeline = new Gst.Pipeline("pipeline");

            source_elem = ElementFactory.MakeFromUri(URIType.Src, current_track.Uri.AbsoluteUri, "source");
            if (source_elem == null)
            {
                RaiseError(current_track, Catalog.GetString("Could not create source element"));
                return(false);
            }

            decoder_elem = ElementFactory.Make("decodebin2", "decodebin2");
            if (decoder_elem == null)
            {
                RaiseError(current_track, Catalog.GetString("Could not create decodebin2 plugin"));
                return(false);
            }

            try {
                sink_bin = new AudioSinkBin("sinkbin", encoder_pipeline, output_uri.AbsoluteUri);
            } catch (Exception e) {
                RaiseError(current_track, e.Message);
            }

            if (sink_bin == null)
            {
                RaiseError(current_track, Catalog.GetString("Could not create sinkbin plugin"));
                return(false);
            }

            pipeline.Add(source_elem, decoder_elem, sink_bin);

            source_elem.Link(decoder_elem);

            decoder_elem.PadAdded += OnPadAdded;

            pipeline.Bus.AddWatch(OnBusMessage);

            return(true);
        }
Exemplo n.º 3
0
        protected override void Initialize()
        {
            playbin = ElementFactory.Make("playbin", "the playbin");

            next_track_set = new ManualResetEvent(false);

            audio_sink = new AudioSinkBin("audiobin");

            playbin["audio-sink"] = audio_sink;

            if (audio_sink.VolumeNeedsSaving)
            {
                // Remember the volume from last time
                Volume = (ushort)PlayerEngineService.VolumeSchema.Get();
            }

            visualization = new Visualization(audio_sink);

            playbin.AddNotification("volume", OnVolumeChanged);
            playbin.Bus.AddWatch(OnBusMessage);

            cdda_manager = new CddaManager(playbin);
            dvd_manager  = new DvdManager(playbin);

            video_manager = new VideoManager(playbin);
            video_manager.PrepareWindow += OnVideoPrepareWindow;
            video_manager.Initialize();

            dvd_manager.FindNavigation(playbin);

            OnStateChanged(PlayerState.Ready);

            InstallPreferences();
            audio_sink.ReplayGainEnabled = ReplayGainEnabledSchema.Get();
            GaplessEnabled = GaplessEnabledSchema.Get();
        }
Exemplo n.º 4
0
        public PlayerEngine ()
        {
            Log.InformationFormat ("GStreamer# {0} Initializing; {1}.{2}",
                typeof (Gst.Version).Assembly.GetName ().Version, Gst.Version.Description, Gst.Version.Nano);

            // Setup the gst plugins/registry paths if running Windows
            if (PlatformDetection.IsWindows) {
                var gst_paths = new string [] { Hyena.Paths.Combine (Hyena.Paths.InstalledApplicationPrefix, "gst-plugins") };
                Environment.SetEnvironmentVariable ("GST_PLUGIN_PATH", String.Join (";", gst_paths));
                Environment.SetEnvironmentVariable ("GST_PLUGIN_SYSTEM_PATH", "");
                Environment.SetEnvironmentVariable ("GST_DEBUG", "1");

                string registry = Hyena.Paths.Combine (Hyena.Paths.ApplicationData, "registry.bin");
                if (!System.IO.File.Exists (registry)) {
                    System.IO.File.Create (registry).Close ();
                }

                Environment.SetEnvironmentVariable ("GST_REGISTRY", registry);

                //System.Environment.SetEnvironmentVariable ("GST_REGISTRY_FORK", "no");
                Log.DebugFormat ("GST_PLUGIN_PATH = {0}", Environment.GetEnvironmentVariable ("GST_PLUGIN_PATH"));
            }

            Gst.Application.Init ();
            playbin = new PlayBin2 ();

            next_track_set = new ManualResetEvent (false);

            audio_sink = new AudioSinkBin ("audiobin");

            playbin["audio-sink"] = audio_sink;

            if (audio_sink.VolumeNeedsSaving) {
                // Remember the volume from last time
                Volume = (ushort)PlayerEngineService.VolumeSchema.Get ();
            }

            Pad teepad = audio_sink.RequestTeePad ();
            visualization = new Visualization (audio_sink, teepad);

            playbin.AddNotification ("volume", OnVolumeChanged);
            playbin.Bus.AddWatch (OnBusMessage);
            playbin.AboutToFinish += OnAboutToFinish;

            cdda_manager = new CddaManager (playbin);
            dvd_manager = new DvdManager (playbin);
            // FIXME: Disable video stuff until GLib# 3 is used instead of the sopy bundled in GStreamerSharp
            //video_manager = new VideoManager (playbin);
            //video_manager.PrepareWindow += OnVideoPrepareWindow;
            //video_manager.Initialize ();

            dvd_manager.FindNavigation (playbin);
            OnStateChanged (PlayerState.Ready);
        }
Exemplo n.º 5
0
        protected override void Initialize()
        {
            playbin = ElementFactory.Make ("playbin", "the playbin");

            next_track_set = new ManualResetEvent (false);

            audio_sink = new AudioSinkBin ("audiobin");

            playbin["audio-sink"] = audio_sink;

            if (audio_sink.VolumeNeedsSaving) {
                // Remember the volume from last time
                Volume = (ushort)PlayerEngineService.VolumeSchema.Get ();
            }

            visualization = new Visualization (audio_sink);

            playbin.AddNotification ("volume", OnVolumeChanged);
            playbin.Bus.AddWatch (OnBusMessage);

            cdda_manager = new CddaManager (playbin);
            dvd_manager = new DvdManager (playbin);

            video_manager = new VideoManager (playbin);
            video_manager.PrepareWindow += OnVideoPrepareWindow;
            video_manager.Initialize ();

            dvd_manager.FindNavigation (playbin);

            OnStateChanged (PlayerState.Ready);

            InstallPreferences ();
            audio_sink.ReplayGainEnabled = ReplayGainEnabledSchema.Get ();
            GaplessEnabled = GaplessEnabledSchema.Get ();
        }
Exemplo n.º 6
0
        private bool ConstructPipeline (string encoder_pipeline)
        {
            Element source_elem;
            Element decoder_elem;

            pipeline = new Gst.Pipeline ("pipeline");

            source_elem = ElementFactory.MakeFromUri (URIType.Src, current_track.Uri.AbsoluteUri, "source");
            if (source_elem == null) {
                RaiseError (current_track, Catalog.GetString ("Could not create source element"));
                return false;
            }

            decoder_elem = ElementFactory.Make ("decodebin2", "decodebin2");
            if (decoder_elem == null) {
                RaiseError (current_track, Catalog.GetString ("Could not create decodebin2 plugin"));
                return false;
            }

            try {
                sink_bin = new AudioSinkBin ("sinkbin", encoder_pipeline, output_uri.AbsoluteUri);
            } catch (Exception e) {
                RaiseError (current_track, e.Message);
            }

            if (sink_bin == null) {
                RaiseError (current_track, Catalog.GetString ("Could not create sinkbin plugin"));
                return false;
            }

            pipeline.Add (source_elem, decoder_elem, sink_bin);

            source_elem.Link (decoder_elem);

            decoder_elem.PadAdded += OnPadAdded;

            pipeline.Bus.AddWatch (OnBusMessage);

            return true;
        }