diff --git a/gstreamer-sharp/Event.custom b/gstreamer-sharp/Event.custom index afe3bd6df1..6c69e1ee0d 100644 --- a/gstreamer-sharp/Event.custom +++ b/gstreamer-sharp/Event.custom @@ -322,3 +322,22 @@ public void ParseLatency (out ulong latency) { gst_event_parse_latency (Handle, out latency); } +[DllImport("libgstreamer-0.10.dll") ] +static extern IntPtr gst_event_new_step (Gst.Format format, ulong amount, double rate, bool flush, bool intermediate); + +public static Gst.Event NewStep (Gst.Format format, ulong amount, double rate, bool flush, bool intermediate) { + Gst.Event ev = (Gst.Event) Gst.MiniObject.GetObject (gst_event_new_step (format, amount, rate, flush, intermediate), true); + + return ev; +} + +[DllImport("libgstreamer-0.10.dll") ] +static extern void gst_event_parse_step (IntPtr ev, out Gst.Format format, out ulong amount, out double rate, out bool flush, out bool intermediate); + +public void ParseStep (out Gst.Format format, out ulong amount, out double rate, out bool flush, out bool intermediate) { + if (Type != EventType.Step) + throw new ArgumentException (); + + gst_event_parse_step (Handle, out format, out amount, out rate, out flush, out intermediate); +} + diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index 00c38e048d..34d4c4734c 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -80,6 +80,8 @@ MiniObjectFlags.Last << 8 mini-object + true + true true true @@ -308,6 +310,7 @@ protected protected protected + LostState 1 @@ -527,6 +530,7 @@ 1 1 1 + 1 Last @@ -574,6 +578,7 @@ true 1 1 + 1 1 1 1 @@ -612,7 +617,9 @@ true + true true + true true true true @@ -648,6 +655,7 @@ out true + true true Last @@ -714,10 +722,10 @@ true true - SetStreamTime - GetStreamTime true true + 1 + 1 BinFlags.Last << 0 BinFlags.Last << 4 @@ -735,6 +743,8 @@ 1 + 1 + SetFeatureName GetFeatureName @@ -879,6 +889,10 @@ 1 1 private + 1 + 1 + 1 + 1 1 @@ -889,6 +903,8 @@ 1 1 + 1 + 1 1 1 @@ -938,12 +954,14 @@ 1 1 true + private 1 1 1 1 - AddTags + AddTag + AddTag out ref diff --git a/gstreamer-sharp/Message.custom b/gstreamer-sharp/Message.custom index 3c7c22c76f..3e4054fabd 100644 --- a/gstreamer-sharp/Message.custom +++ b/gstreamer-sharp/Message.custom @@ -73,6 +73,25 @@ public uint Seqnum { } } +[DllImport("libgstreamer-0.10.dll") ] +static extern IntPtr gst_message_get_stream_status_object (IntPtr raw); + +[DllImport("libgstreamer-0.10.dll") ] +static extern void gst_message_set_stream_status_object (IntPtr raw, ref Gst.GLib.Value o); + +public GLib.Value StreamStatusObject { + get { + IntPtr raw_ret = gst_message_get_stream_status_object (Handle); + GLib.Value ret = (Gst.GLib.Value) Marshal.PtrToStructure (raw_ret, typeof (Gst.GLib.Value)); + return ret; + } + set { + if (!IsWritable) + throw new ApplicationException (); + + gst_message_set_stream_status_object (Handle, ref value); + } +} private Gst.Structure cached_structure = null; @@ -546,6 +565,8 @@ public void ParseInfo (out Enum error) { [DllImport("libgstreamer-0.10.dll") ] static extern IntPtr gst_message_new_tag (IntPtr src, IntPtr tags); +[DllImport("libgstreamer-0.10.dll") ] +static extern IntPtr gst_message_new_tag_full (IntPtr src, IntPtr pad, IntPtr tags); [DllImport("libgstreamer-0.10.dll") ] static extern IntPtr gst_tag_list_copy (IntPtr handle); @@ -556,20 +577,31 @@ public static Message NewTag (Gst.Object src, TagList tags) { return msg; } -[DllImport("libgstreamer-0.10.dll") ] -static extern void gst_message_parse_tag (IntPtr msg, out IntPtr tags); +public static Message NewTag (Gst.Object src, Gst.Pad pad, TagList tags) { + Message msg = (Message) Gst.MiniObject.GetObject (gst_message_new_tag_full (src.Handle, pad.Handle, gst_tag_list_copy (tags.Handle)), true); -public void ParseTag (out TagList tags) { + return msg; +} + +[DllImport("libgstreamer-0.10.dll") ] +static extern void gst_message_parse_tag_full (IntPtr msg, out IntPtr pad, out IntPtr tags); + +public void ParseTag (out Gst.Pad pad, out TagList tags) { if (Type != MessageType.Tag) throw new ArgumentException (); IntPtr raw_ptr; + IntPtr raw_ptr2; - gst_message_parse_tag (Handle, out raw_ptr); + gst_message_parse_tag_full (Handle, out raw_ptr2, out raw_ptr); if (raw_ptr == IntPtr.Zero) tags = null; else tags = (TagList) Gst.GLib.Opaque.GetOpaque (raw_ptr, typeof (TagList), true); + if (raw_ptr2 == IntPtr.Zero) + pad = null; + else + pad = (Gst.Pad) Gst.GLib.Object.GetObject (raw_ptr2, true); } [DllImport("libgstreamer-0.10.dll") ] @@ -861,3 +893,64 @@ public void ParseStructureChange (out StructureChangeType type, out Gst.Element static Message () { Gst.GLib.GType.Register (Message.GType, typeof (Message)); } + +[DllImport("libgstreamer-0.10.dll") ] +static extern IntPtr gst_message_new_step_done (IntPtr src, Gst.Format format, ulong amount, double rate, bool flush, bool intermediate, ulong duration, bool eos); + +public static Message NewStepDone (Gst.Object src, Gst.Format format, ulong amount, double rate, bool flush, bool intermediate, ulong duration, bool eos) { + Message msg = (Message) Gst.MiniObject.GetObject (gst_message_new_step_done (src.Handle, format, amount, rate, flush, intermediate, duration, eos), true); + + return msg; +} + +[DllImport("libgstreamer-0.10.dll") ] +static extern void gst_message_parse_step_done (IntPtr msg, out Gst.Format format, out ulong amount, out double rate, out bool flush, out bool intermediate, out ulong duration, out bool eos); + +public void ParseStepDone (out Gst.Format format, out ulong amount, out double rate, out bool flush, out bool intermediate, out ulong duration, out bool eos) { + if (Type != MessageType.StepDone) + throw new ArgumentException (); + + gst_message_parse_step_done (Handle, out format, out amount, out rate, out flush, out intermediate, out duration, out eos); +} + +[DllImport("libgstreamer-0.10.dll") ] +static extern IntPtr gst_message_new_step_start (IntPtr src, bool active, Gst.Format format, ulong amount, double rate, bool flush, bool intermediate); + +public static Message NewStepDone (Gst.Object src, bool active, Gst.Format format, ulong amount, double rate, bool flush, bool intermediate) { + Message msg = (Message) Gst.MiniObject.GetObject (gst_message_new_step_start (src.Handle, active, format, amount, rate, flush, intermediate), true); + + return msg; +} + +[DllImport("libgstreamer-0.10.dll") ] +static extern void gst_message_parse_step_start (IntPtr msg, out bool active, out Gst.Format format, out ulong amount, out double rate, out bool flush, out bool intermediate); + +public void ParseStepStart (out bool active, out Gst.Format format, out ulong amount, out double rate, out bool flush, out bool intermediate) { + if (Type != MessageType.StepStart) + throw new ArgumentException (); + + gst_message_parse_step_start (Handle, out active, out format, out amount, out rate, out flush, out intermediate); +} + +[DllImport("libgstreamer-0.10.dll") ] +static extern IntPtr gst_message_new_stream_status (IntPtr src, StreamStatusType type, IntPtr owner); + +public static Message NewStreamStatus (Gst.Object src, StreamStatusType type, Gst.Element owner) { + Message msg = (Message) Gst.MiniObject.GetObject (gst_message_new_stream_status (src.Handle, type, owner.Handle), true); + + return msg; +} + +[DllImport("libgstreamer-0.10.dll") ] +static extern void gst_message_parse_stream_status (IntPtr msg, out StreamStatusType type, out IntPtr owner); + +public void ParseStreamStatus (out StreamStatusType type, out Gst.Element owner) { + if (Type != MessageType.StreamStatus) + throw new ArgumentException (); + + IntPtr raw_ptr; + + gst_message_parse_stream_status (Handle, out type, out raw_ptr); + owner = Gst.GLib.Object.GetObject (raw_ptr, false) as Gst.Element; +} + diff --git a/gstreamer-sharp/Object.custom b/gstreamer-sharp/Object.custom index 2a0bd4ebb6..5798422ef8 100644 --- a/gstreamer-sharp/Object.custom +++ b/gstreamer-sharp/Object.custom @@ -70,9 +70,7 @@ public object Emit (string signal, params object[] parameters) { } [DllImport("libgstreamer-0.10.dll") ] -static extern void gst_object_sink (IntPtr raw); -[DllImport("libgstreamer-0.10.dll") ] -static extern IntPtr gst_object_ref (IntPtr raw); +static extern IntPtr gst_object_ref_sink (IntPtr raw); protected override IntPtr Raw { get { @@ -80,8 +78,7 @@ protected override IntPtr Raw { } set { if (value != IntPtr.Zero) { - gst_object_ref (value); - gst_object_sink (value); + gst_object_ref_sink (value); } base.Raw = value; } diff --git a/gstreamer-sharp/Pad.custom b/gstreamer-sharp/Pad.custom index 55d1ce9866..ea81977572 100644 --- a/gstreamer-sharp/Pad.custom +++ b/gstreamer-sharp/Pad.custom @@ -60,6 +60,20 @@ public Gst.PadChainFunction ChainFunction { } } +[DllImport("libgstreamer-0.10.dll") ] +static extern void gst_pad_set_chain_list_function (IntPtr raw, GstSharp.PadChainListFunctionNative chain); + +public Gst.PadChainListFunction ChainListFunction { + set { + if (PersistentData["ChainListFunction"] != null) + PersistentData["ChainListFunction"] = null; + + GstSharp.PadChainListFunctionWrapper value_wrapper = new GstSharp.PadChainListFunctionWrapper (value); + PersistentData["ChainListFunction"] = value_wrapper; + gst_pad_set_chain_list_function (Handle, value_wrapper.NativeDelegate); + } +} + [DllImport("libgstreamer-0.10.dll") ] static extern void gst_pad_set_checkgetrange_function (IntPtr raw, GstSharp.PadCheckGetRangeFunctionNative check); diff --git a/gstreamer-sharp/TagList.custom b/gstreamer-sharp/TagList.custom index 16ed208ef6..73eacbba9a 100644 --- a/gstreamer-sharp/TagList.custom +++ b/gstreamer-sharp/TagList.custom @@ -57,17 +57,16 @@ public object this[string tag] { } } -[DllImport ("gstreamersharpglue-0.10.dll") ] -static extern void gstsharp_gst_tag_list_add_value (IntPtr list, Gst.TagMergeMode mode, IntPtr tag, ref Gst.GLib.Value v); - public void Add (Gst.TagMergeMode mode, string tag, object value) { if (!Tag.Exists (tag)) throw new ArgumentException (String.Format ("Invalid tag name '{0}'", tag)); Gst.GLib.Value v = new Gst.GLib.Value (value); + IntPtr raw_v = Gst.GLib.Marshaller.StructureToPtrAlloc (v); IntPtr raw_string = Gst.GLib.Marshaller.StringToPtrGStrdup (tag); - gstsharp_gst_tag_list_add_value (Handle, mode, raw_string, ref v); + gst_tag_list_add_value (Handle, (int) mode, raw_string, raw_v); + Marshal.FreeHGlobal (raw_v); v.Dispose (); Gst.GLib.Marshaller.Free (raw_string); } diff --git a/gstreamer-sharp/glue/Makefile.am b/gstreamer-sharp/glue/Makefile.am index 62654f7fb2..48945b72f5 100644 --- a/gstreamer-sharp/glue/Makefile.am +++ b/gstreamer-sharp/glue/Makefile.am @@ -9,7 +9,6 @@ libgstreamersharpglue_0_10_la_SOURCES = \ message.c \ event.c \ structure.c \ - taglist.c \ task.c \ object.c \ pad.c \ diff --git a/gstreamer-sharp/glue/taglist.c b/gstreamer-sharp/glue/taglist.c deleted file mode 100644 index 09ab2da054..0000000000 --- a/gstreamer-sharp/glue/taglist.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -void -gstsharp_gst_tag_list_add_value (GstTagList * list, GstTagMergeMode mode, - const gchar * tag, const GValue * v) -{ - gst_tag_list_add_values (list, mode, tag, v, NULL); -}