Ejemplo n.º 1
0
 public cameraDevice(String device, Gst.Fraction framerate, int width, int height)
 {
     this.device    = device;
     this.framerate = framerate;
     this.width     = width;
     this.height    = height;
 }
Ejemplo n.º 2
0
    private static int GreatestCommonDivisor (Fraction fraction) {
      int a = fraction.numerator;
      int b = fraction.denominator;

      while (b != 0) {
        int temp = a;

        a = b;
        b = temp % b;
      }
      return Math.Abs (a);
    }
Ejemplo n.º 3
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);	


					}
				}
			}
		}
	}
Ejemplo n.º 4
0
	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);	


		}
	}
Ejemplo n.º 5
0
        public FractionRange(GLib.Value val)
            : this()
        {
            IntPtr min_ptr, max_ptr;
            GLib.Value min, max;

            min_ptr = gst_value_get_fraction_range_min (ref val);
            max_ptr = gst_value_get_fraction_range_max (ref val);

            min = (GLib.Value)Marshal.PtrToStructure (min_ptr, typeof(GLib.Value));
            max = (GLib.Value)Marshal.PtrToStructure (max_ptr, typeof(GLib.Value));
            this.Min = (Fraction)min.Val;
            this.Max = (Fraction)max.Val;
        }
Ejemplo n.º 6
0
        public FractionRange(Fraction min, Fraction max)
        {
            double a = (double)min, b = (double)max;

            if (a > b)
                throw new ArgumentException ();

            this.Min = min;
            this.Max = max;
        }
Ejemplo n.º 7
0
public bool FixateFieldNearestFraction (string field_name, Fraction target) {
  return FixateFieldNearestFraction (field_name, target.Numerator, target.Denominator);
}
Ejemplo n.º 8
0
        private void OnCapsSet (object o, Gst.GLib.NotifyArgs args)
        {
            Structure s = null;
            int width, height, fps_n, fps_d, par_n, par_d;
            Caps caps = ((Pad)o).NegotiatedCaps;

            width = height = fps_n = fps_d = 0;
            if (caps == null) {
                return;
            }

            /* Get video decoder caps */
            s = caps [0];
            if (s != null) {
                /* We need at least width/height and framerate */
                if (!(s.HasField ("framerate") && s.HasField ("width") && s.HasField ("height"))) {
                    return;
                }
                Fraction f = new Fraction (s.GetValue ("framerate"));
                fps_n = f.Numerator;
                fps_d = f.Denominator;
                Gst.GLib.Value val;
                width = (int)s.GetValue ("width");
                height = (int)s.GetValue ("height");
                /* Get the PAR if available */
                val = s.GetValue ("pixel-aspect-ratio");
                if (!val.Equals (Gst.GLib.Value.Empty)) {
                    Fraction par = new Fraction (val);
                    par_n = par.Numerator;
                    par_d = par.Denominator;
                }
                else { /* Square pixels */
                    par_n = 1;
                    par_d = 1;
                }

                /* Notify PlayerEngine if a callback was set */
                RaiseVideoGeometry (width, height, fps_n, fps_d, par_n, par_d);
            }
        }