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); } } } } }
private void MicScan(string source, string devprop ) { Gst.Element e = Gst.ElementFactory.Make(source); Gst.Interfaces.PropertyProbeAdapter ppa = new Gst.Interfaces.PropertyProbeAdapter(e.Handle); object[] devices = ppa.ProbeAndGetValues(devprop); foreach (object dev in devices) { FillCombo (cbxMic); cbxMic.AppendText (String.Format ("{0}", dev.ToString ())); } }
private void CameraScanUnix () { Gst.Element e = Gst.ElementFactory.Make ("v4l2src"); Gst.Interfaces.PropertyProbeAdapter ppa = new Gst.Interfaces.PropertyProbeAdapter (e.Handle); object[] devices = ppa.ProbeAndGetValues ("device"); FillCombo (cbxCamera); foreach (String dev in devices) { Gst.Fraction f = new Gst.Fraction(30,1); cameras [dev] = new GstCapture.cameraDevice (dev, f , 320 , 240); cbxCamera.AppendText (dev); } }