mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 23:46:43 +00:00
168 lines
5.7 KiB
Text
168 lines
5.7 KiB
Text
[DllImport ("libgobject-2.0-0.dll") ]
|
|
static extern IntPtr g_object_ref (IntPtr raw);
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern bool gst_element_add_pad (IntPtr raw, IntPtr pad);
|
|
|
|
public bool AddPad (Pad p) {
|
|
bool ret = gst_element_add_pad (this.Handle, p == null ? IntPtr.Zero : p.Handle);
|
|
if (ret)
|
|
g_object_ref (p.Handle);
|
|
return ret;
|
|
}
|
|
|
|
public static bool Link (params Element [] elements) {
|
|
for (int i = 0; i < elements.Length - 1; i++) {
|
|
if (!elements[i].Link (elements[i+1]))
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static void Unlink (params Element [] elements) {
|
|
for (int i = 0; i < elements.Length - 1; i++) {
|
|
elements[i].Unlink (elements[i+1]);
|
|
}
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_element_iterate_pads (IntPtr element);
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_element_iterate_src_pads (IntPtr element);
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_element_iterate_sink_pads (IntPtr element);
|
|
|
|
public IEnumerable Pads {
|
|
get {
|
|
return new Enumerable (gst_element_iterate_pads (Handle));
|
|
}
|
|
}
|
|
|
|
public IEnumerable SinkPads {
|
|
get {
|
|
return new Enumerable (gst_element_iterate_sink_pads (Handle));
|
|
}
|
|
}
|
|
|
|
public IEnumerable SrcPads {
|
|
get {
|
|
return new Enumerable (gst_element_iterate_src_pads (Handle));
|
|
}
|
|
}
|
|
|
|
public Gst.StateChangeReturn GetState (out Gst.State state, ulong timeout) {
|
|
Gst.State pending;
|
|
return GetState (out state, out pending, timeout);
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern void gst_element_found_tags (IntPtr raw, IntPtr list);
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_tag_list_copy (IntPtr raw);
|
|
|
|
public void FoundTags (Gst.TagList list) {
|
|
gst_element_found_tags (Handle, list == null ? IntPtr.Zero : gst_tag_list_copy (list.Handle));
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern void gst_element_found_tags_for_pad (IntPtr raw, IntPtr pad, IntPtr list);
|
|
|
|
public void FoundTagsForPad (Gst.Pad pad, Gst.TagList list) {
|
|
gst_element_found_tags_for_pad (Handle, pad == null ? IntPtr.Zero : pad.Handle, list == null ? IntPtr.Zero : gst_tag_list_copy (list.Handle));
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern bool gst_element_post_message (IntPtr raw, IntPtr message);
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_mini_object_ref (IntPtr raw);
|
|
|
|
public bool PostMessage (Gst.Message message) {
|
|
bool raw_ret = gst_element_post_message (Handle, message == null ? IntPtr.Zero : gst_mini_object_ref (message.Handle));
|
|
bool ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_element_get_query_types (IntPtr raw);
|
|
|
|
public Gst.QueryType[] GetQueryTypes () {
|
|
IntPtr raw_ret = gst_element_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("libgstreamer-0.10.dll") ]
|
|
static extern bool gst_element_send_event (IntPtr raw, IntPtr evnt);
|
|
|
|
public bool SendEvent (Gst.Event evnt) {
|
|
bool raw_ret = gst_element_send_event (Handle, evnt == null ? IntPtr.Zero : gst_mini_object_ref (evnt.Handle));
|
|
bool ret = raw_ret;
|
|
return ret;
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern void gst_element_class_add_pad_template (IntPtr klass, IntPtr templ);
|
|
|
|
protected static void AddPadTemplate (GLib.GType gtype, Gst.PadTemplate templ) {
|
|
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
|
|
gst_element_class_add_pad_template (class_ptr, templ.Handle);
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_element_class_get_pad_template (IntPtr klass, IntPtr name);
|
|
|
|
public Gst.PadTemplate GetPadTemplate (string name) {
|
|
GLib.GType gtype = this.LookupGType ();
|
|
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
|
|
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
|
|
IntPtr raw_ret = gst_element_class_get_pad_template (class_ptr, native_name);
|
|
GLib.Marshaller.Free (native_name);
|
|
|
|
return GLib.Object.GetObject (raw_ret, false) as Gst.PadTemplate;
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern IntPtr gst_element_class_get_pad_template_list (IntPtr klass);
|
|
|
|
public Gst.PadTemplate[] PadTemplates {
|
|
get {
|
|
GLib.GType gtype = this.LookupGType ();
|
|
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
|
|
IntPtr raw_ret = gst_element_class_get_pad_template_list (class_ptr);
|
|
|
|
return (Gst.PadTemplate[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof (GLib.List), false, false, typeof (Gst.PadTemplate));
|
|
}
|
|
}
|
|
|
|
[DllImport("libgstreamer-0.10.dll") ]
|
|
static extern void gst_element_class_set_details_simple (IntPtr klass, IntPtr longname, IntPtr classification, IntPtr desc, IntPtr author);
|
|
|
|
protected static void SetDetails (GLib.GType gtype, string longname, string klass, string description, string author) {
|
|
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
|
|
IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
|
|
IntPtr native_klass = GLib.Marshaller.StringToPtrGStrdup (klass);
|
|
IntPtr native_desc = GLib.Marshaller.StringToPtrGStrdup (description);
|
|
IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
|
|
gst_element_class_set_details_simple (class_ptr, native_longname, native_klass, native_desc, native_author);
|
|
|
|
GLib.Marshaller.Free (native_longname);
|
|
GLib.Marshaller.Free (native_klass);
|
|
GLib.Marshaller.Free (native_desc);
|
|
GLib.Marshaller.Free (native_author);
|
|
}
|