Fixed sample/TypeFind.cs

git-svn-id: svn://anonsvn.mono-project.com/source/branches/abock/gstreamer-sharp@64526 e3ebcda4-bce8-0310-ba0a-eca2169e7518
This commit is contained in:
Khaled Mohammed 2006-08-30 00:46:32 +00:00
parent 5097ae8adc
commit 2301711e91
4 changed files with 26 additions and 7 deletions

View file

@ -1,6 +1,8 @@
2006-08-29 Khaled Mohammed <khaled.mohammed@gmail.com> 2006-08-29 Khaled Mohammed <khaled.mohammed@gmail.com>
* sample/MetaData.cs: a sample file which extracts tag information * sample/MetaData.cs: a sample file which extracts tag information
from media files and displays them to console. 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 <khaled.mohammed@gmail.com> 2006-08-25 Khaled Mohammed <khaled.mohammed@gmail.com>
* sample/QueueExample.cs: a sample file showcasing * sample/QueueExample.cs: a sample file showcasing

View file

@ -40,21 +40,29 @@ namespace Gst
{ {
return ElementFactory.Make("typefind", name) as TypeFindElement; return ElementFactory.Make("typefind", name) as TypeFindElement;
} }
/*
protected virtual void OnHaveType(object o, GLib.SignalArgs args) protected virtual void OnHaveType(object o, GLib.SignalArgs args)
{ {
BindingHelper.InvokeProxySignalDelegate(have_type_delegate, typeof(HaveTypeArgs), o, args); BindingHelper.InvokeProxySignalDelegate(have_type_delegate, typeof(HaveTypeArgs), o, args);
} }
*/
public event HaveTypeHandler HaveType { public event GLib.DynamicSignalHandler HaveType {
add { add {
/*
have_type_delegate = BindingHelper.AddProxySignalDelegate(this, "have-type", have_type_delegate = BindingHelper.AddProxySignalDelegate(this, "have-type",
OnHaveType, have_type_delegate, value); OnHaveType, have_type_delegate, value);
*/
GLib.DynamicSignal.Connect(this, "have-type", value);
} }
remove { remove {
/*
have_type_delegate = BindingHelper.RemoveProxySignalDelegate(this, "have-type", have_type_delegate = BindingHelper.RemoveProxySignalDelegate(this, "have-type",
OnHaveType, have_type_delegate, value); OnHaveType, have_type_delegate, value);
*/
GLib.DynamicSignal.Disconnect(this, "have-type", value);
} }
} }

View file

@ -46,6 +46,9 @@ public class MetaData
switch(message.Type) { switch(message.Type) {
case MessageType.Error: case MessageType.Error:
string error;
message.ParseError(out error);
Console.Error.WriteLine("Error: {0}", error);
message.Dispose(); message.Dispose();
return true; return true;
case MessageType.Eos: case MessageType.Eos:
@ -84,10 +87,15 @@ public class MetaData
source = ElementFactory.Make("filesrc", "source"); source = ElementFactory.Make("filesrc", "source");
decodebin = ElementFactory.Make("decodebin", "decodebin"); 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 bin = (Bin) pipeline;
bin.AddMany(source, decodebin); bin.AddMany(source, decodebin);
source.Link(decodebin); if(!source.Link(decodebin))
decodebin.Dispose(); Console.Error.WriteLine("filesrc could not be linked with decodebin");
//decodebin.Dispose();
} }
public static void Main(string [] args) public static void Main(string [] args)

View file

@ -31,10 +31,11 @@ public static class GstTypefindTest
pipeline.Dispose(); pipeline.Dispose();
} }
private static void OnHaveType(object o, HaveTypeArgs args) private static void OnHaveType(object o, GLib.SignalArgs args)
{ {
args.Caps.Refcount++; Caps caps = args.Args[1] as Caps;
Console.WriteLine("MimeType: {0}, {1}", args.Caps, typefind.Caps); caps.Refcount++;
Console.WriteLine("MimeType: {0}, {1}", caps , typefind.Caps);
} }
} }