From b4ded561e30fe78929b1ba0d19799b35f8c36bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 6 Jun 2009 13:14:11 +0200 Subject: [PATCH] Fix and cleanup Gst.Video bindings --- gstreamer-sharp/Gstreamer.metadata | 10 ++++++++++ gstreamer-sharp/Makefile.am | 3 ++- gstreamer-sharp/VideoUtil.custom | 24 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 gstreamer-sharp/VideoUtil.custom diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index 88e30b5f94..c10cffba02 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -1224,7 +1224,14 @@ /api/namespace/class[@cname='GstVideoUtil'] /api/namespace/class[@cname='GstVideoUtil'] /api/namespace/class[@cname='GstVideoUtil'] + /api/namespace/class[@cname='GstVideoUtil'] + /api/namespace/class[@cname='GstVideoUtil'] + /api/namespace/class[@cname='GstVideoUtil'] + /api/namespace/class[@cname='GstVideoUtil'] + /api/namespace/class[@cname='GstVideoUtil'] FormatNewCaps + 1 + 1 YV12 YUY2 @@ -1244,4 +1251,7 @@ Y42B YVYU + + ref + diff --git a/gstreamer-sharp/Makefile.am b/gstreamer-sharp/Makefile.am index 78f111f295..4a4306fc42 100644 --- a/gstreamer-sharp/Makefile.am +++ b/gstreamer-sharp/Makefile.am @@ -114,7 +114,8 @@ customs = \ TunerChannel.custom \ Adapter.custom \ Controller.custom \ - ControlSource.custom + ControlSource.custom \ + VideoUtil.custom build_customs = $(addprefix $(srcdir)/, $(customs)) diff --git a/gstreamer-sharp/VideoUtil.custom b/gstreamer-sharp/VideoUtil.custom new file mode 100644 index 0000000000..fad758ba97 --- /dev/null +++ b/gstreamer-sharp/VideoUtil.custom @@ -0,0 +1,24 @@ +[DllImport ("libgstvideo-0.10.dll") ] +static extern IntPtr gst_video_frame_rate (IntPtr pad); + +public static Gst.Fraction GetFrameRate (Gst.Pad pad) { + IntPtr raw_ret = gst_video_frame_rate (pad == null ? IntPtr.Zero : pad.Handle); + if (raw_ret == IntPtr.Zero) + return new Gst.Fraction (); + + GLib.Value ret = (GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (GLib.Value)); + return (Gst.Fraction) ret.Val; +} + +[DllImport ("libgstvideo-0.10.dll") ] +static extern uint gst_video_format_to_fourcc (int format); + +public static Gst.Fourcc FormatToFourcc (Gst.Video.VideoFormat format) { + uint raw_ret = gst_video_format_to_fourcc ( (int) format); + uint ret = raw_ret; + return new Gst.Fourcc (ret); +} + +public static Gst.Video.VideoFormat FormatFromFourcc (Gst.Fourcc fourcc) { + return FormatFromFourcc (fourcc.Val); +}