diff --git a/doc/en/Gst/Pad.xml b/doc/en/Gst/Pad.xml index 62cbe8f75d..33d7bace20 100644 --- a/doc/en/Gst/Pad.xml +++ b/doc/en/Gst/Pad.xml @@ -126,14 +126,6 @@ To be added.To be added.To be added.To be added. - - - Constructor - - 0.9.5.99 - - - To be added.To be added.To be added.To be added. Constructor @@ -151,15 +143,7 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadAcceptCapsFunction - To be added.To be added.To be added. - + Property0.9.5.99Gst.PadAcceptCapsFunctionTo be added.To be added.To be added. Property @@ -176,15 +160,7 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadActivateModeFunction - To be added.To be added.To be added. - + Property0.9.5.99Gst.PadActivateModeFunctionTo be added.To be added.To be added. Method @@ -193,51 +169,7 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadActivateModeFunction - To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.UInt64 - - To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.UInt32 - - To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - Gst.FlowReturn - - To be added.To be added.To be added.To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - Gst.FlowReturn - - To be added.To be added.To be added.To be added.To be added.To be added.To be added. - + Property0.9.5.99Gst.PadActivateModeFunctionTo be added.To be added.To be added.Method0.9.5.99System.UInt64To be added.To be added.To be added.To be added.Method0.9.5.99System.UInt64To be added.To be added.To be added.To be added.Method0.9.5.99System.UInt64To be added.To be added.To be added.To be added.Method0.9.5.99Gst.FlowReturnTo be added.To be added.To be added.To be added.To be added.To be added.To be added.Method0.9.5.99Gst.FlowReturnTo be added.To be added.To be added.To be added.To be added.To be added.To be added. Property @@ -245,23 +177,7 @@ Gst.Caps To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - System.IntPtr - To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadBufferAllocFunction - To be added.To be added.To be added. - + Property0.9.5.99Gst.PadBufferAllocFunctionTo be added.To be added.To be added. Method @@ -296,15 +212,7 @@ Gst.PadChainFunction To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadCheckGetRangeFunction - To be added.To be added.To be added. - + Property0.9.5.99Gst.PadCheckGetRangeFunctionTo be added.To be added.To be added. Method @@ -331,30 +239,6 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - System.Int32 - To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - System.Int32 - To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - System.IntPtr - To be added.To be added.To be added. Method @@ -381,31 +265,7 @@ System.Void To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadFixateCapsFunction - To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.Caps - To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadGetCapsFunction - To be added.To be added.To be added. - + Property0.9.5.99Gst.PadFixateCapsFunctionTo be added.To be added.To be added.Property0.9.5.99Gst.PadGetCapsFunctionTo be added.To be added.To be added.Method0.9.5.99Gst.CapsTo be added.To be added.To be added.To be added. Method @@ -414,15 +274,7 @@ Gst.FlowReturn To be added.To be added.To be added.To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadGetRangeFunction - To be added.To be added.To be added. - + Property0.9.5.99Gst.PadGetRangeFunctionTo be added.To be added.To be added. Property @@ -439,30 +291,6 @@ GLib.Signal("have-data") Gst.HaveDataHandler To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadIntLinkFunction - To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - GLib.List - To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - GLib.List - To be added.To be added.To be added. Property @@ -577,14 +405,6 @@ System.Void To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadTemplate - To be added.To be added.To be added. Property @@ -653,34 +473,7 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - Gst.Caps - - To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Boolean - - To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - Gst.FlowReturn - - To be added.To be added.To be added.To be added.To be added.To be added. - + Method0.9.5.99Gst.CapsTo be added.To be added.To be added.To be added.Method0.9.5.99System.BooleanTo be added.To be added.To be added.To be added.To be added.Method0.9.5.99Gst.FlowReturnTo be added.To be added.To be added.To be added.To be added.To be added. Method @@ -708,13 +501,13 @@ To be added.To be added.To be added.To be added. - + Method 0.9.5.99 System.Boolean - + To be added.To be added.To be added.To be added.To be added.To be added.To be added. @@ -725,16 +518,7 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Boolean - - To be added.To be added.To be added.To be added.To be added. - + Method0.9.5.99System.BooleanTo be added.To be added.To be added.To be added.To be added. Property @@ -743,69 +527,33 @@ Gst.PadQueryFunction To be added.To be added.To be added. - + Method 0.9.5.99 System.Boolean - + To be added.To be added.To be added.To be added.To be added.To be added.To be added. - + Method 0.9.5.99 System.Boolean - + To be added.To be added.To be added.To be added.To be added. - + Method 0.9.5.99 System.Boolean - + To be added.To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Boolean - - To be added.To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Void - - To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Void - - To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Void - - To be added.To be added.To be added. - + Method0.9.5.99System.BooleanTo be added.To be added.To be added.To be added.To be added.Property0.9.5.99Gst.PadQueryTypeFunctionTo be added.To be added.To be added.Property0.9.5.99Gst.QueryType[]To be added.To be added.To be added.Method0.9.5.99System.VoidTo be added.To be added.To be added.Method0.9.5.99System.VoidTo be added.To be added.To be added.Method0.9.5.99System.VoidTo be added.To be added.To be added. Event @@ -814,14 +562,6 @@ GLib.Signal("request-link") System.EventHandler To be added.To be added. - - - Property - - 0.9.5.99 - - System.IntPtr - To be added.To be added.To be added. Method @@ -849,25 +589,7 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Boolean - - To be added.To be added.To be added.To be added.To be added. - - - Method - - 0.9.5.99 - - System.Boolean - - To be added.To be added.To be added.To be added.To be added. - + Method0.9.5.99System.BooleanTo be added.To be added.To be added.To be added.To be added. Method @@ -876,15 +598,7 @@ System.Boolean To be added.To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.PadSetCapsFunction - To be added.To be added.To be added. - + Property0.9.5.99Gst.PadSetCapsFunctionTo be added.To be added.To be added. Method @@ -902,15 +616,7 @@ System.Boolean To be added.To be added.To be added. - - - Property - - 0.9.5.99 - - Gst.Task - To be added.To be added.To be added. - + Method0.9.5.99System.VoidTo be added.To be added.Method0.9.5.99System.VoidTo be added.To be added.To be added.Method0.9.5.99System.BooleanTo be added.To be added.To be added.Method0.9.5.99System.VoidTo be added.To be added.Method0.9.5.99System.VoidTo be added.To be added.To be added. Property diff --git a/doc/en/Gst/PadBufferAllocFunction.xml b/doc/en/Gst/PadBufferAllocFunction.xml index 9ea846d2a7..fea50c4095 100644 --- a/doc/en/Gst/PadBufferAllocFunction.xml +++ b/doc/en/Gst/PadBufferAllocFunction.xml @@ -1,5 +1,5 @@ - + gstreamer-sharp 0.9.5.99 @@ -12,7 +12,7 @@ - + Gst.FlowReturn diff --git a/doc/en/Gst/Pad+BufferProbeDelegate.xml b/doc/en/Gst/PadBufferProbeCallback.xml similarity index 76% rename from doc/en/Gst/Pad+BufferProbeDelegate.xml rename to doc/en/Gst/PadBufferProbeCallback.xml index 88ad711126..73399fcd71 100644 --- a/doc/en/Gst/Pad+BufferProbeDelegate.xml +++ b/doc/en/Gst/PadBufferProbeCallback.xml @@ -1,5 +1,5 @@ - - + + gstreamer-sharp 0.9.5.99 diff --git a/doc/en/Gst/Pad+DataProbeDelegate.xml b/doc/en/Gst/PadDataProbeCallback.xml similarity index 64% rename from doc/en/Gst/Pad+DataProbeDelegate.xml rename to doc/en/Gst/PadDataProbeCallback.xml index f5b9217940..b97ff1d52b 100644 --- a/doc/en/Gst/Pad+DataProbeDelegate.xml +++ b/doc/en/Gst/PadDataProbeCallback.xml @@ -1,5 +1,5 @@ - - + + gstreamer-sharp 0.9.5.99 @@ -9,14 +9,14 @@ - + System.Boolean To be added. - To be added. + To be added. To be added. To be added. To be added. diff --git a/doc/en/Gst/PadEventProbeCallback.xml b/doc/en/Gst/PadEventProbeCallback.xml new file mode 100644 index 0000000000..8db1db3562 --- /dev/null +++ b/doc/en/Gst/PadEventProbeCallback.xml @@ -0,0 +1,24 @@ + + + + gstreamer-sharp + 0.9.5.99 + + + System.Delegate + + + + + + + System.Boolean + + + To be added. + To be added. + To be added. + To be added. + To be added. + + diff --git a/doc/en/Gst/PadIntLinkFunction.xml b/doc/en/Gst/PadQueryTypeFunction.xml similarity index 68% rename from doc/en/Gst/PadIntLinkFunction.xml rename to doc/en/Gst/PadQueryTypeFunction.xml index e11145df4a..0d002ebc57 100644 --- a/doc/en/Gst/PadIntLinkFunction.xml +++ b/doc/en/Gst/PadQueryTypeFunction.xml @@ -1,5 +1,5 @@ - - + + gstreamer-sharp 0.9.5.99 @@ -11,7 +11,7 @@ - GLib.List + Gst.QueryType[] To be added. diff --git a/doc/en/index.xml b/doc/en/index.xml index d5993c9fab..7db453023b 100644 --- a/doc/en/index.xml +++ b/doc/en/index.xml @@ -99,8 +99,6 @@ - - @@ -108,22 +106,25 @@ + + + - + diff --git a/gstreamer-sharp/GstSharp.PadQueryTypeFunctionNative.cs b/gstreamer-sharp/GstSharp.PadQueryTypeFunctionNative.cs new file mode 100644 index 0000000000..37fa733a84 --- /dev/null +++ b/gstreamer-sharp/GstSharp.PadQueryTypeFunctionNative.cs @@ -0,0 +1,115 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace GstSharp { + + using System; + using System.Runtime.InteropServices; + using System.Collections; + + #region Autogenerated code + [GLib.CDeclCallback] + internal delegate IntPtr PadQueryTypeFunctionNative (IntPtr pad); + + internal class PadQueryTypeFunctionInvoker { + + PadQueryTypeFunctionNative native_cb; + IntPtr __data; + GLib.DestroyNotify __notify; + + ~PadQueryTypeFunctionInvoker () { + if (__notify == null) + return; + __notify (__data); + } + + internal PadQueryTypeFunctionInvoker (PadQueryTypeFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {} + + internal PadQueryTypeFunctionInvoker (PadQueryTypeFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {} + + internal PadQueryTypeFunctionInvoker (PadQueryTypeFunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify) { + this.native_cb = native_cb; + __data = data; + __notify = notify; + } + + internal Gst.PadQueryTypeFunction Handler { + get { + return new Gst.PadQueryTypeFunction (InvokeNative); + } + } + + Gst.QueryType[] InvokeNative (Gst.Pad pad) { + IntPtr raw_ret = native_cb (pad == null ? IntPtr.Zero : pad.Handle); + if (raw_ret == IntPtr.Zero) + return new Gst.QueryType[] {}; + + ArrayList result = new ArrayList (); + bool term = false; + int ofs = 0; + while (!term) { + Gst.QueryType t = (Gst.QueryType) Marshal.ReadInt32 (raw_ret, ofs); + if (t == Gst.QueryType.None) { + term = true; + } else { + result.Add (t); + ofs += 4; + } + } + + return (Gst.QueryType[]) result.ToArray (typeof (Gst.QueryType)); + } + } + + internal class PadQueryTypeFunctionWrapper { + IntPtr raw_ret = IntPtr.Zero; + + public IntPtr NativeCallback (IntPtr pad) { + try { + if (raw_ret != IntPtr.Zero) + return raw_ret; + + Gst.QueryType[] __ret = managed (GLib.Object.GetObject (pad) as Gst.Pad); + if (release_on_call) + gch.Free (); + raw_ret = Marshal.AllocHGlobal (4 * __ret.Length + 4); + for (int i = 0; i < __ret.Length; i++) + Marshal.WriteInt32 (raw_ret, i * 4, (int) __ret[i]); + Marshal.WriteInt32 (raw_ret, __ret.Length * 4, 0); + + return raw_ret; + } catch (Exception e) { + GLib.ExceptionManager.RaiseUnhandledException (e, true); + // NOTREACHED: Above call does not return. + throw e; + } + } + + bool release_on_call = false; + GCHandle gch; + + public void PersistUntilCalled () { + release_on_call = true; + gch = GCHandle.Alloc (this); + } + + internal PadQueryTypeFunctionNative NativeDelegate; + Gst.PadQueryTypeFunction managed; + + public PadQueryTypeFunctionWrapper (Gst.PadQueryTypeFunction managed) { + this.managed = managed; + if (managed != null) + NativeDelegate = new PadQueryTypeFunctionNative (NativeCallback); + } + + public static Gst.PadQueryTypeFunction GetManagedDelegate (PadQueryTypeFunctionNative native) { + if (native == null) + return null; + PadQueryTypeFunctionWrapper wrapper = (PadQueryTypeFunctionWrapper) native.Target; + if (wrapper == null) + return null; + return wrapper.managed; + } + } + #endregion +} diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index 036284d48d..fc0d353832 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -442,33 +442,120 @@ true true - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + + AddDataProbe + GstPadDataProbeCallback + AddBufferProbe + GstPadBufferProbeCallback + AddEventProbe + GstPadEventProbeCallback + ref + out + ref + out + ref + ref + ref + ref + true + true + true + true + 1 + true + true + 1 + SetBlocked + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + out + true + out + true + out + true + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + 1 + 1 + 1 + 1 + + 1 + 1 + + 1 + 1 + 1 + + 1 + 1 + + + + 1 + 1 + 1 + 1 + 1 + + public + true + + + + + + + + + + + + + + + + + + + + + + + + + + + out + true Last ObjectFlags.Last << 0 @@ -486,6 +573,33 @@ ObjectFlags.Last << 0 ObjectFlags.Last << 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 BinFromDescription diff --git a/gstreamer-sharp/Makefile.am b/gstreamer-sharp/Makefile.am index 73b298c088..bb16e098e9 100644 --- a/gstreamer-sharp/Makefile.am +++ b/gstreamer-sharp/Makefile.am @@ -46,7 +46,9 @@ sources = \ Value.cs \ plugins-base/PlayBin.cs \ plugins-base/DecodeBin.cs \ - plugins-base/TypeFindElement.cs + plugins-base/TypeFindElement.cs \ + GstSharp.PadQueryTypeFunctionNative.cs \ + PadQueryTypeFunction.cs build_sources = $(addprefix $(srcdir)/, $(sources)) diff --git a/gstreamer-sharp/Pad.custom b/gstreamer-sharp/Pad.custom index edcd297307..cb82a5502a 100644 --- a/gstreamer-sharp/Pad.custom +++ b/gstreamer-sharp/Pad.custom @@ -1,101 +1,434 @@ - [DllImport ("gstreamer-0.10.dll") ] -private static extern bool gst_pad_query_position (IntPtr raw, ref Format format, out long cur); - -public bool QueryPosition (Gst.Format format, out long current) { - return gst_pad_query_position (Handle, ref format, out current); -} - +static extern IntPtr gst_pad_get_pad_template_caps (IntPtr raw); [DllImport ("gstreamer-0.10.dll") ] -private static extern bool gst_pad_query_duration (IntPtr raw, ref Format format, out long duration); +static extern IntPtr gst_caps_copy (IntPtr raw); -public bool QueryDuration (Gst.Format format, out long duration) { - return gst_pad_query_duration (Handle, ref format, out duration); -} - - -public delegate bool BufferProbeDelegate (Pad pad, Gst.Buffer buffer); -internal delegate bool BufferProbeNativeDelegate (IntPtr pad, IntPtr buf, IntPtr data); - -internal class BufferProbeWrapper { - internal BufferProbeNativeDelegate NativeFunc; - BufferProbeDelegate managedFunc; - - public BufferProbeWrapper (BufferProbeDelegate func) { - managedFunc = func; - if (func != null) - NativeFunc = new BufferProbeNativeDelegate (BufferProbeMarshaller); - } - - public bool BufferProbeMarshaller (IntPtr raw_pad, IntPtr buf, IntPtr data) { - Pad pad = GLib.Object.GetObject (raw_pad) as Pad; - Gst.Buffer buffer = GLib.Opaque.GetOpaque (buf, typeof (Gst.Buffer), false) as Gst.Buffer; - return (bool) (managedFunc (pad, buffer)); +public Gst.Caps PadTemplateCaps { + get { + IntPtr raw_ret = gst_pad_get_pad_template_caps (Handle); + Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (gst_caps_copy (raw_ret), typeof (Gst.Caps), false); + return ret; } } [DllImport ("gstreamer-0.10.dll") ] -private static extern ulong gst_pad_add_buffer_probe (IntPtr pad, BufferProbeNativeDelegate func, IntPtr data); +static extern void gst_pad_remove_data_probe (IntPtr raw, uint handler_id); -public ulong AddBufferProbe (BufferProbeDelegate func) { - BufferProbeWrapper func_wrapper; - if (PersistentData["AddBufferProbe"] != null) { - func_wrapper = PersistentData["AddBufferProbe"] as BufferProbeWrapper; - } else { - func_wrapper = new BufferProbeWrapper (func); - PersistentData["AddBufferProbe"] = func_wrapper; - } - - return gst_pad_add_buffer_probe (this.Handle, func_wrapper.NativeFunc, IntPtr.Zero); +public void RemoveDataProbe (ulong handler_id) { + gst_pad_remove_data_probe (Handle, (uint) handler_id); } [DllImport ("gstreamer-0.10.dll") ] -private static extern void gst_pad_remove_buffer_probe (IntPtr pad, uint handler_id); +static extern void gst_pad_remove_event_probe (IntPtr raw, uint handler_id); -public void RemoveBufferProbe (uint handler_id) { - gst_pad_remove_buffer_probe (this.Handle, handler_id); - PersistentData["AddBufferProbe"] = null; +public void RemoveEventProbe (ulong handler_id) { + gst_pad_remove_event_probe (Handle, (uint) handler_id); } -public delegate bool DataProbeDelegate (Pad pad, GLib.Opaque miniobject); -internal delegate bool DataProbeNativeDelegate (IntPtr pad, IntPtr miniobj, IntPtr data); +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_remove_buffer_probe (IntPtr raw, uint handler_id); -internal class DataProbeWrapper { - internal DataProbeNativeDelegate NativeFunc; - DataProbeDelegate ManagedFunc; +public void RemoveBufferProbe (ulong handler_id) { + gst_pad_remove_buffer_probe (Handle, (uint) handler_id); +} - public DataProbeWrapper (DataProbeDelegate func) { - ManagedFunc = func; - if (func != null) - NativeFunc = new DataProbeNativeDelegate (DataProbeMarshaller); - } +[DllImport ("gstreamer-0.10.dll") ] +static extern int gst_pad_alloc_buffer (IntPtr raw, ulong offset, int size, IntPtr caps, out IntPtr buf); - public bool DataProbeMarshaller (IntPtr raw_pad, IntPtr miniobj, IntPtr data) { - Pad pad = GLib.Object.GetObject (raw_pad) as Pad; - GLib.Opaque opaque = GLib.Opaque.GetOpaque (miniobj, typeof (GLib.Opaque), true); - return ManagedFunc (pad, opaque); +public Gst.FlowReturn AllocBuffer (ulong offset, int size, Gst.Caps caps, out Gst.Buffer buf) { + IntPtr native_buf; + int raw_ret = gst_pad_alloc_buffer (Handle, offset, size, caps == null ? IntPtr.Zero : caps.Handle, out native_buf); + Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret; + buf = native_buf == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (native_buf, typeof (Gst.Buffer), true); + return ret; +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern int gst_pad_alloc_buffer_and_set_caps (IntPtr raw, ulong offset, int size, IntPtr caps, out IntPtr buf); + +public Gst.FlowReturn AllocBufferAndSetCaps (ulong offset, int size, Gst.Caps caps, out Gst.Buffer buf) { + IntPtr native_buf; + int raw_ret = gst_pad_alloc_buffer_and_set_caps (Handle, offset, size, caps == null ? IntPtr.Zero : caps.Handle, out native_buf); + Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret; + buf = native_buf == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (native_buf, typeof (Gst.Buffer), true); + return ret; +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_bufferalloc_function (IntPtr raw, GstSharp.PadBufferAllocFunctionNative bufalloc); + +public Gst.PadBufferAllocFunction BufferAllocFunction { + set { + if (PersistentData["BufferAllocFunction"] != null) + PersistentData["BufferAllocFunction"] = null; + + GstSharp.PadBufferAllocFunctionWrapper value_wrapper = new GstSharp.PadBufferAllocFunctionWrapper (value); + PersistentData["BufferAllocFunction"] = value_wrapper; + gst_pad_set_bufferalloc_function (Handle, value_wrapper.NativeDelegate); } } [DllImport ("gstreamer-0.10.dll") ] -static extern uint gst_pad_add_data_probe (IntPtr pad, DataProbeNativeDelegate func, IntPtr data); +static extern void gst_pad_set_chain_function (IntPtr raw, GstSharp.PadChainFunctionNative chain); -public uint AddDataProbe (DataProbeDelegate func) { - DataProbeWrapper func_wrapper; - if (PersistentData["AddDataProbe"] != null) { - func_wrapper = PersistentData["AddDataProbe"] as DataProbeWrapper; - } else { - func_wrapper = new DataProbeWrapper (func); - PersistentData["AddDataProbe"] = func_wrapper; +public Gst.PadChainFunction ChainFunction { + set { + if (PersistentData["ChainFunction"] != null) + PersistentData["ChainFunction"] = null; + + GstSharp.PadChainFunctionWrapper value_wrapper = new GstSharp.PadChainFunctionWrapper (value); + PersistentData["ChainFunction"] = value_wrapper; + gst_pad_set_chain_function (Handle, value_wrapper.NativeDelegate); } - - return gst_pad_add_data_probe (this.Handle, func_wrapper.NativeFunc, IntPtr.Zero); } [DllImport ("gstreamer-0.10.dll") ] -static extern void gst_pad_remove_data_probe (IntPtr pad, uint handler_id); +static extern void gst_pad_set_checkgetrange_function (IntPtr raw, GstSharp.PadCheckGetRangeFunctionNative check); -public void RemoveDataProbe (uint handler_id) { - gst_pad_remove_data_probe (this.Handle, handler_id); - PersistentData["AddDataProbe"] = null; +public Gst.PadCheckGetRangeFunction CheckGetRangeFunction { + set { + if (PersistentData["CheckGetRangeFunction"] != null) + PersistentData["CheckGetRangeFunction"] = null; + + GstSharp.PadCheckGetRangeFunctionWrapper value_wrapper = new GstSharp.PadCheckGetRangeFunctionWrapper (value); + PersistentData["CheckGetRangeFunction"] = value_wrapper; + gst_pad_set_checkgetrange_function (Handle, value_wrapper.NativeDelegate); + } } + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_getrange_function (IntPtr raw, GstSharp.PadGetRangeFunctionNative get); + +public Gst.PadGetRangeFunction GetRangeFunction { + set { + if (PersistentData["GetRangeFunction"] != null) + PersistentData["GetRangeFunction"] = null; + + GstSharp.PadGetRangeFunctionWrapper value_wrapper = new GstSharp.PadGetRangeFunctionWrapper (value); + PersistentData["GetRangeFunction"] = value_wrapper; + gst_pad_set_getrange_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_event_function (IntPtr raw, GstSharp.PadEventFunctionNative evnt); + +public Gst.PadEventFunction EventFunction { + set { + if (PersistentData["EventFunction"] != null) + PersistentData["EventFunction"] = null; + + GstSharp.PadEventFunctionWrapper value_wrapper = new GstSharp.PadEventFunctionWrapper (value); + PersistentData["EventFunction"] = value_wrapper; + gst_pad_set_event_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_link_function (IntPtr raw, GstSharp.PadLinkFunctionNative link); + +public Gst.PadLinkFunction LinkFunction { + set { + if (PersistentData["LinkFunction"] != null) + PersistentData["LinkFunction"] = null; + + GstSharp.PadLinkFunctionWrapper value_wrapper = new GstSharp.PadLinkFunctionWrapper (value); + PersistentData["LinkFunction"] = value_wrapper; + gst_pad_set_link_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_unlink_function (IntPtr raw, GstSharp.PadUnlinkFunctionNative unlink); + +public Gst.PadUnlinkFunction UnlinkFunction { + set { + if (PersistentData["UnlinkFunction"] != null) + PersistentData["UnlinkFunction"] = null; + + GstSharp.PadUnlinkFunctionWrapper value_wrapper = new GstSharp.PadUnlinkFunctionWrapper (value); + PersistentData["UnlinkFunction"] = value_wrapper; + gst_pad_set_unlink_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_acceptcaps_function (IntPtr raw, GstSharp.PadAcceptCapsFunctionNative acceptcaps); + +public Gst.PadAcceptCapsFunction AcceptCapsFunction { + set { + if (PersistentData["AcceptCapsFunction"] != null) + PersistentData["AcceptCapsFunction"] = null; + + GstSharp.PadAcceptCapsFunctionWrapper value_wrapper = new GstSharp.PadAcceptCapsFunctionWrapper (value); + PersistentData["AcceptCapsFunction"] = value_wrapper; + gst_pad_set_acceptcaps_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_getcaps_function (IntPtr raw, GstSharp.PadGetCapsFunctionNative getcaps); + +public Gst.PadGetCapsFunction GetCapsFunction { + set { + if (PersistentData["GetCapsFunction"] != null) + PersistentData["GetCapsFunction"] = null; + + GstSharp.PadGetCapsFunctionWrapper value_wrapper = new GstSharp.PadGetCapsFunctionWrapper (value); + PersistentData["GetCapsFunction"] = value_wrapper; + gst_pad_set_getcaps_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_setcaps_function (IntPtr raw, GstSharp.PadSetCapsFunctionNative setcaps); + +public Gst.PadSetCapsFunction SetCapsFunction { + set { + if (PersistentData["SetCapsFunction"] != null) + PersistentData["SetCapsFunction"] = null; + + GstSharp.PadSetCapsFunctionWrapper value_wrapper = new GstSharp.PadSetCapsFunctionWrapper (value); + PersistentData["SetCapsFunction"] = value_wrapper; + gst_pad_set_setcaps_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_fixatecaps_function (IntPtr raw, GstSharp.PadFixateCapsFunctionNative fixatecaps); + +public Gst.PadFixateCapsFunction FixateCapsFunction { + set { + if (PersistentData["FixateCapsFunction"] != null) + PersistentData["FixateCapsFunction"] = null; + + GstSharp.PadFixateCapsFunctionWrapper value_wrapper = new GstSharp.PadFixateCapsFunctionWrapper (value); + PersistentData["FixateCapsFunction"] = value_wrapper; + gst_pad_set_fixatecaps_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_activate_function (IntPtr raw, GstSharp.PadActivateFunctionNative activate); + +public Gst.PadActivateFunction ActivateFunction { + set { + if (PersistentData["ActivateFunction"] != null) + PersistentData["ActivateFunction"] = null; + + GstSharp.PadActivateFunctionWrapper value_wrapper = new GstSharp.PadActivateFunctionWrapper (value); + PersistentData["ActivateFunction"] = value_wrapper; + gst_pad_set_activate_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_activatepull_function (IntPtr raw, GstSharp.PadActivateModeFunctionNative activatepull); + +public Gst.PadActivateModeFunction ActivatePullFunction { + set { + if (PersistentData["ActivatePullFunction"] != null) + PersistentData["ActivatePullFunction"] = null; + + GstSharp.PadActivateModeFunctionWrapper value_wrapper = new GstSharp.PadActivateModeFunctionWrapper (value); + PersistentData["ActivatePullFunction"] = value_wrapper; + gst_pad_set_activatepull_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_activatepush_function (IntPtr raw, GstSharp.PadActivateModeFunctionNative activatepush); + +public Gst.PadActivateModeFunction ActivatePushFunction { + set { + if (PersistentData["ActivatePushFunction"] != null) + PersistentData["ActivatePushFunction"] = null; + + GstSharp.PadActivateModeFunctionWrapper value_wrapper = new GstSharp.PadActivateModeFunctionWrapper (value); + PersistentData["ActivatePushFunction"] = value_wrapper; + gst_pad_set_activatepush_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern int gst_pad_push (IntPtr raw, IntPtr buffer); +[DllImport ("gstreamer-0.10.dll") ] +static extern IntPtr gst_mini_object_ref (IntPtr raw); + +public Gst.FlowReturn Push (Gst.Buffer buffer) { + int raw_ret = gst_pad_push (Handle, buffer == null ? IntPtr.Zero : gst_mini_object_ref (buffer.Handle)); + Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret; + return ret; +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern bool gst_pad_push_event (IntPtr raw, IntPtr evnt); + +public bool PushEvent (Gst.Event evnt) { + bool raw_ret = gst_pad_push_event (Handle, evnt == null ? IntPtr.Zero : gst_mini_object_ref (evnt.Handle)); + bool ret = raw_ret; + return ret; +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern int gst_pad_pull_range (IntPtr raw, ulong offset, uint size, out IntPtr buffer); + +public Gst.FlowReturn PullRange (ulong offset, uint size, out Gst.Buffer buffer) { + IntPtr native_buffer; + int raw_ret = gst_pad_pull_range (Handle, offset, size, out native_buffer); + Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret; + buffer = native_buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (native_buffer, typeof (Gst.Buffer), true); + return ret; + +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern bool gst_pad_send_event (IntPtr raw, IntPtr evnt); + +public bool SendEvent (Gst.Event evnt) { + bool raw_ret = gst_pad_send_event (Handle, evnt == null ? IntPtr.Zero : gst_mini_object_ref (evnt.Handle)); + bool ret = raw_ret; + return ret; +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern bool gst_pad_event_default (IntPtr raw, IntPtr evnt); + +public bool EventDefault (Gst.Event evnt) { + bool raw_ret = gst_pad_event_default (Handle, evnt == null ? IntPtr.Zero : gst_mini_object_ref (evnt.Handle)); + bool ret = raw_ret; + return ret; +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_query_function (IntPtr raw, GstSharp.PadQueryFunctionNative query); + +public Gst.PadQueryFunction QueryFunction { + set { + if (PersistentData["QueryFunction"] != null) + PersistentData["QueryFunction"] = null; + + GstSharp.PadQueryFunctionWrapper value_wrapper = new GstSharp.PadQueryFunctionWrapper (value); + PersistentData["QueryFunction"] = value_wrapper; + gst_pad_set_query_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern void gst_pad_set_query_type_function (IntPtr raw, GstSharp.PadQueryTypeFunctionNative query); + +public Gst.PadQueryTypeFunction QueryTypeFunction { + set { + if (PersistentData["QueryTypeFunction"] != null) + PersistentData["QueryTypeFunction"] = null; + + GstSharp.PadQueryTypeFunctionWrapper value_wrapper = new GstSharp.PadQueryTypeFunctionWrapper (value); + PersistentData["QueryTypeFunction"] = value_wrapper; + gst_pad_set_query_type_function (Handle, value_wrapper.NativeDelegate); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern IntPtr gst_pad_get_query_types (IntPtr raw); + +public Gst.QueryType[] QueryTypes { + get { + IntPtr raw_ret = gst_pad_get_query_types (Handle); + if (raw_ret == IntPtr.Zero) + return new Gst.QueryType[] {}; + + ArrayList result = new ArrayList (); + bool term = false; + int ofs = 0; + while (!term) { + Gst.QueryType t = (Gst.QueryType) Marshal.ReadInt32 (raw_ret, ofs); + if (t == Gst.QueryType.None) { + term = true; + } else { + result.Add (t); + ofs += 4; + } + } + + return (Gst.QueryType[]) result.ToArray (typeof (Gst.QueryType)); + } +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern IntPtr gst_pad_get_query_types_default (IntPtr raw); + +static Gst.QueryType[] GetQueryTypesDefault (Gst.Pad pad) { + IntPtr raw_ret = gst_pad_get_query_types_default ( (pad != null) ? pad.Handle : IntPtr.Zero); + if (raw_ret == IntPtr.Zero) + return new Gst.QueryType[] {}; + + ArrayList result = new ArrayList (); + bool term = false; + int ofs = 0; + while (!term) { + Gst.QueryType t = (Gst.QueryType) Marshal.ReadInt32 (raw_ret, ofs); + if (t == Gst.QueryType.None) { + term = true; + } else { + result.Add (t); + ofs += 4; + } + } + + return (Gst.QueryType[]) result.ToArray (typeof (Gst.QueryType)); +} + +[DllImport ("gstreamer-0.10.dll") ] +static extern int gst_pad_chain (IntPtr raw, IntPtr buffer); + +public Gst.FlowReturn Chain (Gst.Buffer buffer) { + int raw_ret = gst_pad_chain (Handle, buffer == null ? IntPtr.Zero : gst_mini_object_ref (buffer.Handle)); + Gst.FlowReturn ret = (Gst.FlowReturn) raw_ret; + return ret; +} + +[DllImport ("gstreamersharpglue-0.10") ] +extern static uint gstsharp_gst_pad_get_stream_lock_offset (); + +static uint stream_lock_offset = gstsharp_gst_pad_get_stream_lock_offset (); +private IntPtr StreamLockPtr { + get { + unsafe { + IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + stream_lock_offset); + return (*raw_ptr); + } + } +} + +[DllImport ("libglib-2.0-0.dll") ] +static extern void g_static_rec_mutex_lock (IntPtr mutex); +[DllImport ("libglib-2.0-0.dll") ] +static extern void g_static_rec_mutex_unlock (IntPtr mutex); +[DllImport ("libglib-2.0-0.dll") ] +static extern void g_static_rec_mutex_lock_full (IntPtr mutex, uint depth); +[DllImport ("libglib-2.0-0.dll") ] +static extern void g_static_rec_mutex_unlock_full (IntPtr mutex, uint depth); +[DllImport ("libglib-2.0-0.dll") ] +static extern bool g_static_rec_mutex_trylock (IntPtr mutex); + +public void StreamLock () { + g_static_rec_mutex_lock (StreamLockPtr); +} + +public void StreamUnlock () { + g_static_rec_mutex_unlock (StreamLockPtr); +} + +public void StreamLock (uint depth) { + g_static_rec_mutex_lock_full (StreamLockPtr, depth); +} + +public void StreamUnlock (uint depth) { + g_static_rec_mutex_unlock_full (StreamLockPtr, depth); +} + +public bool StreamTryLock () { + return g_static_rec_mutex_trylock (StreamLockPtr); +} + + diff --git a/gstreamer-sharp/PadQueryTypeFunction.cs b/gstreamer-sharp/PadQueryTypeFunction.cs new file mode 100644 index 0000000000..3def03ad37 --- /dev/null +++ b/gstreamer-sharp/PadQueryTypeFunction.cs @@ -0,0 +1,10 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace Gst { + + using System; + + public delegate Gst.QueryType[] PadQueryTypeFunction (Gst.Pad pad); + +} diff --git a/gstreamer-sharp/glue/Makefile.am b/gstreamer-sharp/glue/Makefile.am index 5fe9674dcc..7fb63f07d4 100644 --- a/gstreamer-sharp/glue/Makefile.am +++ b/gstreamer-sharp/glue/Makefile.am @@ -12,6 +12,7 @@ libgstreamersharpglue_0_10_la_SOURCES = \ taglist.c \ task.c \ object.c \ + pad.c \ gobject.c nodist_libgstreamersharpglue_0_10_la_SOURCES = generated.c diff --git a/gstreamer-sharp/glue/pad.c b/gstreamer-sharp/glue/pad.c new file mode 100644 index 0000000000..785cf326c0 --- /dev/null +++ b/gstreamer-sharp/glue/pad.c @@ -0,0 +1,7 @@ +#include + +uint +gstsharp_gst_pad_get_stream_lock_offset (void) +{ + return (uint) G_STRUCT_OFFSET (GstPad, stream_rec_lock); +}