예제 #1
1
 void InsertReplayGain (Pad pad, bool blocked)
 {
     lock (pipeline_lock) {
         if (rgvolume == null) {
             rgvolume = ElementFactory.Make ("rgvolume", "rgvolume");
             Add (rgvolume);
             rgvolume.SyncStateWithParent ();
             visible_sink.SetTarget (rgvolume.GetStaticPad ("sink"));
             rgvolume.Link (first);
             first = rgvolume;
         }
     }
     visible_sink.SetBlocked (false, (_, __) => { });
 }
예제 #2
0
	private void CameraScanWin()
	{

		Gst.Element e = Gst.ElementFactory.Make ("dshowvideosrc");
		Gst.Interfaces.PropertyProbeAdapter ppa = new Gst.Interfaces.PropertyProbeAdapter (e.Handle);

		object[] devices = ppa.ProbeAndGetValues ("device-name");

		FillCombo (cbxCamera);

		foreach (String dev in devices) {
			Gst.Caps caps = e.GetStaticPad ("src").Caps;

			foreach (Gst.Structure cap in caps) {
				if (cap.HasField ("width") && cap.HasField ("height")) {
					Gst.GLib.Value s;
					int height = 0, width = 0;

					s = cap.GetValue ("width");
					if (s.Val is int) {
						width = (int)s.Val;
					}
					s = cap.GetValue ("height");
					if (s.Val is int) {
						height = (int)s.Val;
					}

					if (width == 320 && height == 240) {
						s = cap.GetValue ("framerate");

						Gst.Fraction f;
						if (s.Val is Gst.FractionRange) {
							f = new Gst.FractionRange (s).Max;  // ? Min
						} else if (s.Val is Gst.Fraction) {
							f = new Gst.Fraction (s);
						} else if (s.Val is int) {
							f = new Gst.Fraction ((int)s.Val, 1);
						} else
							continue;

						cameras [dev] = new GstCapture.cameraDevice (dev, f, width, height);

						cbxCamera.AppendText (dev);	


					}
				}
			}
		}
	}
예제 #3
0
            public AudioSinkBin (string elementName) : base(elementName)
            {
                hw_audio_sink = SelectAudioSink ();
                Add (hw_audio_sink);
                first = hw_audio_sink;

                // Our audio sink is a tee, so plugins can attach their own pipelines
                audiotee = ElementFactory.Make ("tee", "audiotee") as Tee;
                if (audiotee == null) {
                    Log.Error ("Can not create audio tee!");
                } else {
                    Add (audiotee);
                }

                volume = FindVolumeProvider (hw_audio_sink);
                if (volume != null) {
                    // If the sink provides its own volume property we assume that it will
                    // also save that value across program runs.  Pulsesink has this behaviour.
                    VolumeNeedsSaving = false;
                } else {
                    volume = ElementFactory.Make ("volume", "volume");
                    VolumeNeedsSaving = true;
                    Add (volume);
                    volume.Link (hw_audio_sink);
                    first = volume;
                }

                equalizer = ElementFactory.Make ("equalizer-10bands", "equalizer-10bands");
                if (equalizer != null) {
                    Element eq_audioconvert = ElementFactory.Make ("audioconvert", "audioconvert");
                    Element eq_audioconvert2 = ElementFactory.Make ("audioconvert", "audioconvert2");
                    preamp = ElementFactory.Make ("volume", "preamp");

                    Add (eq_audioconvert, preamp, equalizer, eq_audioconvert2);
                    Element.Link (eq_audioconvert, preamp, equalizer, eq_audioconvert2, first);

                    first = eq_audioconvert;
                    Log.Debug ("Built and linked Equalizer");
                }

                // Link the first tee pad to the primary audio sink queue
                Pad sinkpad = first.GetStaticPad ("sink");
                Pad pad = audiotee.GetRequestPad ("src%d");
                audiotee.AllocPad = pad;
                pad.Link (sinkpad);
                first = audiotee;

                visible_sink = new GhostPad ("sink", first.GetStaticPad ("sink"));
                AddPad (visible_sink);
            }
예제 #4
0
 void RemoveReplayGain (Pad pad, bool blocked)
 {
     lock (pipeline_lock) {
         if (rgvolume != null) {
             first = rgvolume.GetStaticPad ("src").Peer.Parent as Element;
             rgvolume.Unlink (first);
             rgvolume.SetState (State.Null);
             Remove (rgvolume);
             rgvolume = null;
             visible_sink.SetTarget (first.GetStaticPad ("sink"));
         }
     }
     visible_sink.SetBlocked (false, (_, __) => { });
 }
예제 #5
0
 PadProbeReturn RemoveReplayGain(Pad pad, PadProbeInfo info)
 {
     lock (pipeline_lock) {
         if (rgvolume != null) {
             first = rgvolume.GetStaticPad ("src").Peer.Parent as Element;
             rgvolume.Unlink (first);
             rgvolume.SetState (State.Null);
             Remove (rgvolume);
             rgvolume = null;
             visible_sink.SetTarget (first.GetStaticPad ("sink"));
         }
     }
     return PadProbeReturn.Remove;
 }
예제 #6
0
 PadProbeReturn InsertReplayGain(Pad pad, PadProbeInfo info)
 {
     lock (pipeline_lock) {
         if (rgvolume == null) {
             rgvolume = ElementFactory.Make ("rgvolume", "rgvolume");
             Add (rgvolume);
             rgvolume.SyncStateWithParent ();
             visible_sink.SetTarget (rgvolume.GetStaticPad ("sink"));
             rgvolume.Link (first);
             first = rgvolume;
         }
     }
     return PadProbeReturn.Remove;
 }
예제 #7
0
        // Shows the CURRENT capabilities of the requested pad in the given element */
        static void PrintPadCapabilities(Element element, string padName)
        {
            // Retrieve pad
            var pad = element.GetStaticPad (padName);
            if (pad == null) {
                Console.WriteLine ("Could not retrieve pad '{0}'", padName);
                return;
            }

            // Retrieve negotiated caps (or acceptable caps if negotiation is not finished yet)
            var caps = pad.CurrentCaps;
            if (caps == null)
                caps = pad.Caps;

            /* Print and free */
            Console.WriteLine ("Caps for the {0} pad:", padName);
            PrintCaps (caps, "      ");
        }