2006-07-13 16:16:51 +00:00
|
|
|
using System;
|
|
|
|
using Gst;
|
|
|
|
|
|
|
|
public static class GstTypefindTest
|
|
|
|
{
|
|
|
|
private static TypeFindElement typefind;
|
|
|
|
|
|
|
|
public static void Main(string [] args)
|
|
|
|
{
|
|
|
|
Application.Init();
|
|
|
|
|
|
|
|
Pipeline pipeline = new Pipeline("pipeline");
|
|
|
|
Element source = ElementFactory.Make("filesrc", "source");
|
|
|
|
typefind = TypeFindElement.Make("typefind");
|
|
|
|
Element sink = ElementFactory.Make("fakesink", "sink");
|
|
|
|
|
|
|
|
source.SetProperty("location", args[0]);
|
|
|
|
|
|
|
|
typefind.HaveType += OnHaveType;
|
|
|
|
|
|
|
|
pipeline.AddMany(source, typefind, sink);
|
|
|
|
source.Link(typefind);
|
|
|
|
typefind.Link(sink);
|
|
|
|
|
|
|
|
pipeline.SetState(State.Paused);
|
|
|
|
pipeline.SetState(State.Null);
|
2006-08-25 09:49:52 +00:00
|
|
|
|
|
|
|
source.Dispose();
|
|
|
|
typefind.Dispose();
|
|
|
|
sink.Dispose();
|
2006-07-13 16:16:51 +00:00
|
|
|
pipeline.Dispose();
|
|
|
|
}
|
|
|
|
|
2006-08-30 00:46:32 +00:00
|
|
|
private static void OnHaveType(object o, GLib.SignalArgs args)
|
2006-07-13 16:16:51 +00:00
|
|
|
{
|
2006-08-30 00:46:32 +00:00
|
|
|
Caps caps = args.Args[1] as Caps;
|
|
|
|
caps.Refcount++;
|
2006-09-07 22:22:09 +00:00
|
|
|
Console.WriteLine("MimeType: {0}", caps);
|
2006-07-13 16:16:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|