예제 #1
0
        bool ConstructPipeline ()
        {
            Element queue;

            pipeline = new Gst.Pipeline ("pipeline");
            if (pipeline == null) {
                RaiseError (current_track, Catalog.GetString ("Could not create pipeline"));
                return false;
            }

            cddasrc = ElementFactory.MakeFromUri (URIType.Src, "cdda://1", "cddasrc");
            if (cddasrc == null) {
                RaiseError (current_track, Catalog.GetString ("Could not initialize element from cdda URI"));
                return false;
            }

            cddasrc ["device"] = device;

            if (cddasrc.HasProperty ("paranoia-mode")) {
                cddasrc ["paranoia-mode"] = paranoia_mode;
            }

            try {
            encoder = (Bin)Parse.BinFromDescription (encoder_pipeline, true);
            } catch (Exception e) {
                string err = Catalog.GetString ("Could not create encoder pipeline : {0}");
                RaiseError (current_track, String.Format (err, e.Message));
                return false;
            }

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

            queue ["max-size-time"] = 120 * Gst.Clock.Second;

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

            pipeline.Add (cddasrc, queue, encoder, filesink);

            if (!Element.Link (cddasrc, queue, encoder, filesink)) {
                RaiseError (current_track, Catalog.GetString ("Could not link pipeline elements"));
            }

            pipeline.Bus.AddWatch (OnBusMessage);

            return true;
        }
예제 #2
0
            static Element FindVolumeProvider (Element sink)
            {
                Element volumeProvider = null;
                // Sinks which automatically select between a number of possibilities
                // (such as autoaudiosink and gconfaudiosink) need to be at least in
                // the Ready state before they'll contain an actual sink.
                sink.SetState (State.Ready);

                if (sink.HasProperty ("volume")) {
                    volumeProvider = sink;
                    Log.DebugFormat ("Sink {0} has native volume.", volumeProvider.Name);
                } else {
                    var sinkBin = sink as Bin;
                    if (sinkBin != null) {
                        foreach (Element e in sinkBin.ElementsRecurse) {
                            if (e.HasProperty ("volume")) {
                                volumeProvider = e;
                                Log.DebugFormat ("Found volume provider {0} in {1}.",
                                    volumeProvider.Name, sink.Name);
                            }
                        }
                    }
                }
                return volumeProvider;
            }
예제 #3
0
        private void ReInitPipeline()
        {
            if (pipeline != null) {
                pipeline.SetState (Gst.State.Null);
                pipeline = null;
            }

            pipeline = new Gst.Pipeline ();
            drawSink = Gst.ElementFactory.Make ("xvimagesink");
            camerabin = Gst.ElementFactory.Make ("camerabin");
            camerabin.Connect ("image-done", new Gst.SignalHandler (OnImageDone));
            pipeline.SetState (Gst.State.Null);

            overlayAdapter = new Gst.Interfaces.XOverlayAdapter (drawSink.Handle);
            overlayAdapter.XwindowId = gdk_x11_drawable_get_xid (drawingArea.GdkWindow.Handle);
            pipeline.Add (camerabin);

            if (camerabin.HasProperty ("viewfinder-sink")) {
                camerabin ["viewfinder-sink"] = drawSink;
            }

            if (camerabin.HasProperty ("filename")) {
                camerabin ["filename"] = "snapshot.png";
            }

            pipeline.SetState (Gst.State.Playing);
            needReInit = false;
        }