diff --git a/ChangeLog b/ChangeLog index 36e64f589c..7f2993f228 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2006-08-29 Khaled Mohammed * sample/MetaData.cs: a sample file which extracts tag information from media files and displays them to console. + * sample/TypeFind.cs: fixed to make it work with the new DynamicSignal + class. 2006-08-25 Khaled Mohammed * sample/QueueExample.cs: a sample file showcasing diff --git a/gstreamer-sharp/plugins-base/TypeFindElement.cs b/gstreamer-sharp/plugins-base/TypeFindElement.cs index 10b27b3fb1..991833a62e 100644 --- a/gstreamer-sharp/plugins-base/TypeFindElement.cs +++ b/gstreamer-sharp/plugins-base/TypeFindElement.cs @@ -40,21 +40,29 @@ namespace Gst { return ElementFactory.Make("typefind", name) as TypeFindElement; } - + /* protected virtual void OnHaveType(object o, GLib.SignalArgs args) { BindingHelper.InvokeProxySignalDelegate(have_type_delegate, typeof(HaveTypeArgs), o, args); } + */ + - public event HaveTypeHandler HaveType { + public event GLib.DynamicSignalHandler HaveType { add { + /* have_type_delegate = BindingHelper.AddProxySignalDelegate(this, "have-type", OnHaveType, have_type_delegate, value); + */ + GLib.DynamicSignal.Connect(this, "have-type", value); } remove { + /* have_type_delegate = BindingHelper.RemoveProxySignalDelegate(this, "have-type", OnHaveType, have_type_delegate, value); + */ + GLib.DynamicSignal.Disconnect(this, "have-type", value); } } diff --git a/sample/MetaData.cs b/sample/MetaData.cs index 8931222773..2778846267 100644 --- a/sample/MetaData.cs +++ b/sample/MetaData.cs @@ -46,6 +46,9 @@ public class MetaData switch(message.Type) { case MessageType.Error: + string error; + message.ParseError(out error); + Console.Error.WriteLine("Error: {0}", error); message.Dispose(); return true; case MessageType.Eos: @@ -84,10 +87,15 @@ public class MetaData source = ElementFactory.Make("filesrc", "source"); decodebin = ElementFactory.Make("decodebin", "decodebin"); + if(pipeline == null) Console.Error.WriteLine("Pipeline count not be created"); + if(source == null) Console.Error.WriteLine("Element filesrc could not be created"); + if(decodebin == null) Console.Error.WriteLine("Element decodebin coult not be created"); + Bin bin = (Bin) pipeline; bin.AddMany(source, decodebin); - source.Link(decodebin); - decodebin.Dispose(); + if(!source.Link(decodebin)) + Console.Error.WriteLine("filesrc could not be linked with decodebin"); + //decodebin.Dispose(); } public static void Main(string [] args) diff --git a/sample/TypeFind.cs b/sample/TypeFind.cs index 6e13ae93e9..d718c5427a 100644 --- a/sample/TypeFind.cs +++ b/sample/TypeFind.cs @@ -31,10 +31,11 @@ public static class GstTypefindTest pipeline.Dispose(); } - private static void OnHaveType(object o, HaveTypeArgs args) + private static void OnHaveType(object o, GLib.SignalArgs args) { - args.Caps.Refcount++; - Console.WriteLine("MimeType: {0}, {1}", args.Caps, typefind.Caps); + Caps caps = args.Args[1] as Caps; + caps.Refcount++; + Console.WriteLine("MimeType: {0}, {1}", caps , typefind.Caps); } }