Fix indention everywhere

This commit is contained in:
Sebastian Dröge 2009-09-20 10:19:49 +02:00
parent bd9052c00a
commit 80a5794fc1
61 changed files with 1682 additions and 1793 deletions

View file

@ -152,13 +152,13 @@ public class ElementGen {
if (parms != null) {
si.parameters = new ArrayList ();
foreach (XmlElement parm in parms.ChildNodes) {
SignalParameter par = new SignalParameter ();
par.type = parm.InnerText;
SignalParameter par = new SignalParameter ();
par.type = parm.InnerText;
if (parm.Attributes["name"] == null)
throw new Exception ("All signal parameters need the 'name' attribute");
if (parm.Attributes["name"] == null)
throw new Exception ("All signal parameters need the 'name' attribute");
par.name = parm.Attributes["name"].InnerText;
par.name = parm.Attributes["name"].InnerText;
si.parameters.Add (par);
}
}
@ -190,13 +190,13 @@ public class ElementGen {
if (parms != null) {
si.parameters = new ArrayList ();
foreach (XmlElement parm in parms.ChildNodes) {
SignalParameter par = new SignalParameter ();
par.type = parm.InnerText;
SignalParameter par = new SignalParameter ();
par.type = parm.InnerText;
if (parm.Attributes["name"] == null)
throw new Exception ("All signal parameters need the 'name' attribute");
if (parm.Attributes["name"] == null)
throw new Exception ("All signal parameters need the 'name' attribute");
par.name = parm.Attributes["name"].InnerText;
par.name = parm.Attributes["name"].InnerText;
si.parameters.Add (par);
}
}
@ -207,44 +207,44 @@ public class ElementGen {
}
public static string CTypeToManagedType (string ctype, XmlDocument api_doc) {
switch (ctype) {
case "GObject":
return "Gst.GLib.Object";
case "gchararray":
return "string";
case "gboolean":
return "bool";
case "guint":
return "uint";
case "gint":
return "int";
case "gulong":
case "guint64":
return "ulong";
case "glong":
case "gint64":
return "long";
case "gfloat":
return "float";
case "gdouble":
return "double";
case "GValueArray":
return "Gst.GLib.ValueArray";
}
XPathNavigator api_nav = api_doc.CreateNavigator ();
XPathNodeIterator type_iter = api_nav.Select ("/api/namespace/*[@cname='" + ctype + "']");
while (type_iter.MoveNext ()) {
string ret = type_iter.Current.GetAttribute ("name", "");
if (ret != null && ret != String.Empty) {
XPathNavigator parent = type_iter.Current.Clone ();
parent.MoveToParent ();
ret = parent.GetAttribute ("name", "") + "." + ret;
return ret;
}
}
switch (ctype) {
case "GObject":
return "Gst.GLib.Object";
case "gchararray":
return "string";
case "gboolean":
return "bool";
case "guint":
return "uint";
case "gint":
return "int";
case "gulong":
case "guint64":
return "ulong";
case "glong":
case "gint64":
return "long";
case "gfloat":
return "float";
case "gdouble":
return "double";
case "GValueArray":
return "Gst.GLib.ValueArray";
}
return null;
XPathNavigator api_nav = api_doc.CreateNavigator ();
XPathNodeIterator type_iter = api_nav.Select ("/api/namespace/*[@cname='" + ctype + "']");
while (type_iter.MoveNext ()) {
string ret = type_iter.Current.GetAttribute ("name", "");
if (ret != null && ret != String.Empty) {
XPathNavigator parent = type_iter.Current.Clone ();
parent.MoveToParent ();
ret = parent.GetAttribute ("name", "") + "." + ret;
return ret;
}
}
return null;
}
public static void writeElement (TextWriter writer, ElementInfo ei, StreamReader custom_code, XmlDocument api_doc, string interfaces_dir) {
@ -261,7 +261,7 @@ public class ElementGen {
string parent_managed_type = CTypeToManagedType (parent_type, api_doc);
if (parent_managed_type != null) {
writer.Write (parent_managed_type);
break;
break;
}
}
@ -302,28 +302,28 @@ public class ElementGen {
} else if (managed_type == null) {
pinfo.enuminfo.name = pinfo.type;
enums.Add (pinfo.enuminfo);
managed_type = pinfo.type.StartsWith (ei.gtype_name) ? pinfo.type.Substring (ei.gtype_name.Length) : pinfo.type.StartsWith ("Gst") ? pinfo.type.Substring (3) : pinfo.type;
managed_type += "Type";
managed_type = pinfo.type.StartsWith (ei.gtype_name) ? pinfo.type.Substring (ei.gtype_name.Length) : pinfo.type.StartsWith ("Gst") ? pinfo.type.Substring (3) : pinfo.type;
managed_type += "Type";
}
writer.WriteLine ("\t\t[Gst.GLib.Property (\"" + pinfo.name + "\")]");
writer.WriteLine ("\t\tpublic " + managed_type + " " + managed_name + " {");
if (pinfo.readable) {
writer.WriteLine ("\t\t\tget {");
writer.WriteLine ("\t\t\t\tGst.GLib.Value val = GetProperty (\"" + pinfo.name + "\");");
writer.WriteLine ("\t\t\t\t" + managed_type + " ret = (" + managed_type + ") val.Val;");
writer.WriteLine ("\t\t\t\tval.Dispose ();");
writer.WriteLine ("\t\t\t\treturn ret;");
writer.WriteLine ("\t\t\t}");
writer.WriteLine ("\t\t\t\tGst.GLib.Value val = GetProperty (\"" + pinfo.name + "\");");
writer.WriteLine ("\t\t\t\t" + managed_type + " ret = (" + managed_type + ") val.Val;");
writer.WriteLine ("\t\t\t\tval.Dispose ();");
writer.WriteLine ("\t\t\t\treturn ret;");
writer.WriteLine ("\t\t\t}");
}
if (pinfo.writeable) {
writer.WriteLine ("\t\t\tset {");
writer.WriteLine ("\t\t\t\tGst.GLib.Value val = new Gst.GLib.Value (this, \"" + pinfo.name + "\");");
writer.WriteLine ("\t\t\t\tval.Val = value;");
writer.WriteLine ("\t\t\t\tSetProperty (\"" + pinfo.name + "\", val);");
writer.WriteLine ("\t\t\t\tval.Dispose ();");
writer.WriteLine ("\t\t\t}");
writer.WriteLine ("\t\t\t\tGst.GLib.Value val = new Gst.GLib.Value (this, \"" + pinfo.name + "\");");
writer.WriteLine ("\t\t\t\tval.Val = value;");
writer.WriteLine ("\t\t\t\tSetProperty (\"" + pinfo.name + "\", val);");
writer.WriteLine ("\t\t\t\tval.Dispose ();");
writer.WriteLine ("\t\t\t}");
}
writer.WriteLine ("\t\t}\n");
}
@ -334,66 +334,66 @@ public class ElementGen {
foreach (SignalInfo si in ei.signals) {
string managed_name = (si.managed_name != null) ? si.managed_name : PropToCamelCase (si.name);
if (si.parameters.Count > 0) {
writer.WriteLine ("\t\tpublic delegate void " + managed_name + "Handler (object o, " + managed_name + "Args args);\n");
writer.WriteLine ("\t\tpublic class " + managed_name + "Args : Gst.GLib.SignalArgs {");
for (int i = 0; i < si.parameters.Count; i++) {
SignalParameter param = (SignalParameter) si.parameters[i];
if (si.parameters.Count > 0) {
writer.WriteLine ("\t\tpublic delegate void " + managed_name + "Handler (object o, " + managed_name + "Args args);\n");
writer.WriteLine ("\t\tpublic class " + managed_name + "Args : Gst.GLib.SignalArgs {");
for (int i = 0; i < si.parameters.Count; i++) {
SignalParameter param = (SignalParameter) si.parameters[i];
string managed_type = CTypeToManagedType (param.type, api_doc);
writer.WriteLine ("\t\t\tpublic " + managed_type + " " + param.name + " {");
writer.WriteLine ("\t\t\t\tget {");
writer.WriteLine ("\t\t\t\t\treturn (" + managed_type + ") Args[" + i + "];");
writer.WriteLine ("\t\t\t\t}");
writer.WriteLine ("\t\t\t}\n");
}
writer.WriteLine ("\t\t}\n");
writer.WriteLine ("\t\t\tpublic " + managed_type + " " + param.name + " {");
writer.WriteLine ("\t\t\t\tget {");
writer.WriteLine ("\t\t\t\t\treturn (" + managed_type + ") Args[" + i + "];");
writer.WriteLine ("\t\t\t\t}");
writer.WriteLine ("\t\t\t}\n");
}
writer.WriteLine ("\t\t}\n");
writer.WriteLine ("\t\tpublic event " + managed_name + "Handler " + managed_name + " {");
} else {
writer.WriteLine ("\t\tpublic event SignalHandler " + managed_name + " {");
}
writer.WriteLine ("\t\tpublic event " + managed_name + "Handler " + managed_name + " {");
} else {
writer.WriteLine ("\t\tpublic event SignalHandler " + managed_name + " {");
}
writer.WriteLine ("\t\t\tadd {");
writer.WriteLine ("\t\t\t\tDynamicSignal.Connect (this, \"" + si.name + "\", value);");
writer.WriteLine ("\t\t\t}\n");
writer.WriteLine ("\t\t\tadd {");
writer.WriteLine ("\t\t\t\tDynamicSignal.Connect (this, \"" + si.name + "\", value);");
writer.WriteLine ("\t\t\t}\n");
writer.WriteLine ("\t\t\tremove {");
writer.WriteLine ("\t\t\t\tDynamicSignal.Disconnect (this, \"" + si.name + "\", value);");
writer.WriteLine ("\t\t\t}");
writer.WriteLine ("\t\t}");
writer.WriteLine ("\t\t\tremove {");
writer.WriteLine ("\t\t\t\tDynamicSignal.Disconnect (this, \"" + si.name + "\", value);");
writer.WriteLine ("\t\t\t}");
writer.WriteLine ("\t\t}");
}
}
if (ei.actions.Count > 0) {
foreach (SignalInfo si in ei.actions) {
string managed_name = (si.managed_name != null) ? si.managed_name : PropToCamelCase (si.name);
string managed_return = CTypeToManagedType (si.return_type, api_doc);
string managed_return = CTypeToManagedType (si.return_type, api_doc);
writer.Write ("\t\tpublic " + managed_return + " " + managed_name + " (");
writer.Write ("\t\tpublic " + managed_return + " " + managed_name + " (");
for (int i = 0; i < si.parameters.Count; i++) {
SignalParameter param = (SignalParameter) si.parameters[i];
for (int i = 0; i < si.parameters.Count; i++) {
SignalParameter param = (SignalParameter) si.parameters[i];
string managed_type = CTypeToManagedType (param.type, api_doc);
if (i == 0)
writer.Write (managed_type + " " + param.name);
else
writer.Write (", " + managed_type + " " + param.name);
}
writer.WriteLine (") {");
if (i == 0)
writer.Write (managed_type + " " + param.name);
else
writer.Write (", " + managed_type + " " + param.name);
}
writer.WriteLine (") {");
writer.WriteLine ("\t\t\tobject[] parameters = new object[" + si.parameters.Count + "];");
for (int i = 0; i < si.parameters.Count; i++) {
SignalParameter param = (SignalParameter) si.parameters[i];
writer.WriteLine ("\t\t\tparameters[" + i + "] = " + param.name + ";");
}
writer.WriteLine ("\t\t\tobject[] parameters = new object[" + si.parameters.Count + "];");
writer.WriteLine ("\t\t\treturn (" + managed_return + ") Emit (\"" + si.name + "\", parameters);");
for (int i = 0; i < si.parameters.Count; i++) {
SignalParameter param = (SignalParameter) si.parameters[i];
writer.WriteLine ("\t\t}\n");
writer.WriteLine ("\t\t\tparameters[" + i + "] = " + param.name + ";");
}
writer.WriteLine ("\t\t\treturn (" + managed_return + ") Emit (\"" + si.name + "\", parameters);");
writer.WriteLine ("\t\t}\n");
}
}
@ -403,32 +403,32 @@ public class ElementGen {
writer.WriteLine ("#region Customized code");
writer.WriteLine ("#line 1 \"" + iface + ".cs\"");
StreamReader interface_code = System.IO.File.OpenText (interfaces_dir + "/" + iface + ".cs");
string iface_code = interface_code.ReadToEnd ();
writer.WriteLine (iface_code);
}
string iface_code = interface_code.ReadToEnd ();
writer.WriteLine (iface_code);
}
}
if (enums.Count > 0) {
foreach (EnumInfo eni in enums) {
writer.WriteLine ("\t\t[GTypeName (\"" + eni.name + "\")]");
if (eni.flag)
writer.WriteLine ("\t\t[Flags]");
if (eni.flag)
writer.WriteLine ("\t\t[Flags]");
string enum_name = eni.name.StartsWith (ei.gtype_name) ? eni.name.Substring (ei.gtype_name.Length) : eni.name.StartsWith ("Gst") ? eni.name.Substring (3) : eni.name;
string enum_name = eni.name.StartsWith (ei.gtype_name) ? eni.name.Substring (ei.gtype_name.Length) : eni.name.StartsWith ("Gst") ? eni.name.Substring (3) : eni.name;
enum_name += "Type";
enum_name += "Type";
writer.WriteLine ("\t\tpublic enum " + enum_name + " {");
if (eni.flag) {
foreach (FlagValue ev in eni.values) {
writer.WriteLine ("\t\t\t" + PropToCamelCase (ev.name) + " = " + ev.value + ", ");
}
} else {
foreach (EnumValue ev in eni.values) {
writer.WriteLine ("\t\t\t" + PropToCamelCase (ev.name) + " = " + ev.value + ", ");
}
}
writer.WriteLine ("\t\t}\n");
writer.WriteLine ("\t\tpublic enum " + enum_name + " {");
if (eni.flag) {
foreach (FlagValue ev in eni.values) {
writer.WriteLine ("\t\t\t" + PropToCamelCase (ev.name) + " = " + ev.value + ", ");
}
} else {
foreach (EnumValue ev in eni.values) {
writer.WriteLine ("\t\t\t" + PropToCamelCase (ev.name) + " = " + ev.value + ", ");
}
}
writer.WriteLine ("\t\t}\n");
}
}
@ -449,13 +449,13 @@ public class ElementGen {
public static string PropToCamelCase (string pname) {
string ret = Char.ToUpper (pname[0]).ToString ();
bool next_upper = false;
for (int i = 1; i < pname.Length; i++) {
if (pname[i] == '-') {
next_upper = true;
} else if (next_upper) {
ret = ret + Char.ToUpper (pname[i]);
next_upper = false;
next_upper = false;
} else {
ret = ret + pname[i];
}

View file

@ -252,12 +252,12 @@ print_element_properties (GstElement * element, gint pfx)
/* Ignore GstObject, GstElement, GstBin, GstPipeline properties */
if (param->owner_type == GST_TYPE_OBJECT ||
param->owner_type == GST_TYPE_ELEMENT ||
param->owner_type == GST_TYPE_BIN ||
param->owner_type == GST_TYPE_PIPELINE ||
param->owner_type == GST_TYPE_BASE_SRC ||
param->owner_type == GST_TYPE_BASE_SINK ||
param->owner_type == GST_TYPE_BASE_TRANSFORM ||
param->owner_type == GST_TYPE_PUSH_SRC)
param->owner_type == GST_TYPE_BIN ||
param->owner_type == GST_TYPE_PIPELINE ||
param->owner_type == GST_TYPE_BASE_SRC ||
param->owner_type == GST_TYPE_BASE_SINK ||
param->owner_type == GST_TYPE_BASE_TRANSFORM ||
param->owner_type == GST_TYPE_PUSH_SRC)
continue;
PUT_START_TAG (pfx + 1, "element-property");

View file

@ -1,6 +1,6 @@
[DllImport ("gstreamersharpglue-0.10.dll") ]
static extern IntPtr gstsharp_gst_adapter_peek_buffer (IntPtr adapter, uint size);
[DllImport ("gstreamersharpglue-0.10.dll") ]
static extern IntPtr gstsharp_gst_adapter_peek_buffer (IntPtr adapter, uint size);
public Gst.Buffer Peek (uint size) {
return (Gst.Buffer) Gst.MiniObject.GetObject (gstsharp_gst_adapter_peek_buffer (Handle, size), true);
}
public Gst.Buffer Peek (uint size) {
return (Gst.Buffer) Gst.MiniObject.GetObject (gstsharp_gst_adapter_peek_buffer (Handle, size), true);
}

View file

@ -1,14 +1,14 @@
[DllImport("libgstreamer-0.10.dll") ]
static extern IntPtr gst_element_factory_make (IntPtr element, IntPtr name);
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_element_factory_make (IntPtr element, IntPtr name);
public AppSink (string name) : base (IntPtr.Zero) {
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr native_element = Gst.GLib.Marshaller.StringToPtrGStrdup ("appsink");
Raw = gst_element_factory_make (native_element, native_name);
Gst.GLib.Marshaller.Free (native_name);
Gst.GLib.Marshaller.Free (native_element);
if (Raw == IntPtr.Zero)
throw new Exception ("Failed to instantiate element \"appsink\"");
}
public AppSink (string name) : base (IntPtr.Zero) {
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr native_element = Gst.GLib.Marshaller.StringToPtrGStrdup ("appsink");
Raw = gst_element_factory_make (native_element, native_name);
Gst.GLib.Marshaller.Free (native_name);
Gst.GLib.Marshaller.Free (native_element);
if (Raw == IntPtr.Zero)
throw new Exception ("Failed to instantiate element \"appsink\"");
}
public AppSink () : this ((string) null) { }
public AppSink () : this ( (string) null) { }

View file

@ -28,8 +28,7 @@ namespace Gst {
public string TypeName {
get {
return type_name;
}
set {
} set {
type_name = value;
}
}
@ -160,16 +159,16 @@ namespace Gst {
RegisterManagedTypes ();
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_init (ref int argc, ref IntPtr argv);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern bool gst_init_check (ref int argc, ref IntPtr argv, out IntPtr error);
[DllImport("libgstcontroller-0.10.dll") ]
[DllImport ("libgstcontroller-0.10.dll") ]
private static extern void gst_controller_init (ref int argc, ref IntPtr argv);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_deinit();
}
}

View file

@ -1,6 +1,6 @@
public Bin () : this (null) {}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_bin_add (IntPtr raw, IntPtr element);
[DllImport ("libgobject-2.0-0.dll") ]

View file

@ -1,4 +1,4 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_buffer_try_new_and_alloc (uint size);
public Buffer (Gst.GLib.Value val) : base (val) { }
@ -57,8 +57,7 @@ public byte this [uint index] {
byte **raw_ptr = (byte **) ( ( (byte*) Handle) + data_offset);
return * ( (*raw_ptr) + index);
}
}
set {
} set {
if (index >= Size)
throw new ArgumentOutOfRangeException ();
if (!IsWritable)
@ -85,9 +84,9 @@ public void MakeMetadataWritable() {
gst_mini_object_unref (old);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_buffer_get_caps (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_buffer_set_caps (IntPtr raw, IntPtr caps);
public Gst.Caps Caps {
@ -95,8 +94,7 @@ public Gst.Caps Caps {
IntPtr raw_ret = gst_buffer_get_caps (Handle);
Gst.Caps ret = raw_ret == IntPtr.Zero ? null : (Gst.Caps) Gst.GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Caps), true);
return ret;
}
set {
} set {
if (!IsMetadataWritable)
throw new ApplicationException ();
gst_buffer_set_caps (Handle, value == null ? IntPtr.Zero : value.Handle);

View file

@ -1,4 +1,4 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern int gst_bus_sync_signal_handler (IntPtr raw, IntPtr message, IntPtr data);
public Gst.BusSyncReply SyncSignalHandler (Gst.Message message) {
@ -11,7 +11,7 @@ public uint AddWatch (Gst.BusFunc func) {
return AddWatch (0, func);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_bus_async_signal_func (IntPtr raw, IntPtr message, IntPtr data);
public bool AsyncSignalFunc (Gst.Message message) {

View file

@ -12,7 +12,7 @@ public Caps (Structure[] s) : this () {
}
public Caps (string mediaType, params object[] fields) : this () {
Append (new Structure(mediaType, fields));
Append (new Structure (mediaType, fields));
}
[DllImport ("gstreamersharpglue-0.10.dll") ]
@ -61,7 +61,7 @@ private void RemoveStructureReferences () {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_caps_get_structure (IntPtr handle, uint index);
public Structure this [uint index] {
@ -120,10 +120,10 @@ public IEnumerator GetEnumerator() {
return new StructureEnumerator (this);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_caps_append_structure (IntPtr caps, IntPtr structure);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_structure_copy (IntPtr raw);
public void Append (Structure s) {
@ -133,7 +133,7 @@ public void Append (Structure s) {
gst_caps_append_structure (Handle, gst_structure_copy (s.Handle));
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_caps_append (IntPtr caps, IntPtr caps2);
public void Append (Caps caps) {
@ -143,7 +143,7 @@ public void Append (Caps caps) {
gst_caps_append (Handle, gst_caps_copy (caps.Handle));
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_caps_merge_structure (IntPtr caps, IntPtr structure);
public void Merge (Structure s) {
@ -153,7 +153,7 @@ public void Merge (Structure s) {
gst_caps_merge_structure (Handle, gst_structure_copy (s.Handle));
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_caps_merge (IntPtr caps, IntPtr caps2);
public void Merge (Caps caps) {
@ -167,7 +167,7 @@ public void Merge (Caps caps) {
gst_caps_merge (Handle, gst_caps_copy (caps.Handle));
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_caps_remove_structure (IntPtr caps, uint index);
public void RemoveStructure (uint index) {
@ -183,7 +183,7 @@ public void RemoveStructure (uint index) {
gst_caps_remove_structure (Handle, index);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_caps_do_simplify (IntPtr caps);
public bool DoSimplify () {
@ -197,7 +197,7 @@ public bool DoSimplify () {
return gst_caps_do_simplify (Handle);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_caps_truncate (IntPtr caps);
public void Truncate () {
@ -210,7 +210,7 @@ public void Truncate () {
gst_caps_truncate (Handle);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_caps_unref (IntPtr raw);
protected override void Unref (IntPtr raw) {

View file

@ -92,17 +92,16 @@ public bool TrySlaveLock () {
return g_mutex_trylock (SlaveLockPtr);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_clock_get_master (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_clock_set_master (IntPtr raw, IntPtr master);
public Gst.Clock Master {
get {
IntPtr raw_ret = gst_clock_get_master (Handle);
Gst.Clock ret = Gst.GLib.Object.GetObject (raw_ret, true) as Gst.Clock;
return ret;
}
set {
} set {
if (!gst_clock_set_master (Handle, value == null ? IntPtr.Zero : value.Handle))
throw new Exception ();
}

View file

@ -1,5 +1,5 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_debug_set_default_threshold (Gst.DebugLevel debug_level);
public static void SetDefaultThreshold (Gst.DebugLevel debug_level) {

View file

@ -56,8 +56,7 @@ namespace Gst {
public IntPtr Closure {
get {
return closure;
}
set {
} set {
closure = value;
}
}
@ -65,8 +64,7 @@ namespace Gst {
public uint HandlerId {
get {
return handlerId;
}
set {
} set {
handlerId = value;
}
}
@ -74,8 +72,7 @@ namespace Gst {
public Delegate RegisteredHandler {
get {
return registeredHandler;
}
set {
} set {
registeredHandler = value;
}
}
@ -83,8 +80,7 @@ namespace Gst {
public Type ArgsType {
get {
return argsType;
}
set {
} set {
argsType = value;
}
}
@ -94,65 +90,65 @@ namespace Gst {
this.closure = closure;
this.registeredHandler = registeredHandler;
if (!IsValidDelegate (registeredHandler))
throw new Exception ("Invalid delegate");
if (!IsValidDelegate (registeredHandler))
throw new Exception ("Invalid delegate");
MethodInfo mi = registeredHandler.Method;
ParameterInfo[] parms = mi.GetParameters ();
this.argsType = parms[1].ParameterType;
MethodInfo mi = registeredHandler.Method;
ParameterInfo[] parms = mi.GetParameters ();
this.argsType = parms[1].ParameterType;
}
public void UpdateArgsType (Delegate d) {
if (!IsCompatibleDelegate (d))
throw new Exception ("Incompatible delegate");
throw new Exception ("Incompatible delegate");
MethodInfo mi = d.Method;
ParameterInfo[] parms = mi.GetParameters ();
MethodInfo mi = d.Method;
ParameterInfo[] parms = mi.GetParameters ();
Type t1 = parms[1].ParameterType;
Type t2 = argsType;
Type t1 = parms[1].ParameterType;
Type t2 = argsType;
if (t1 == t2)
return;
if (t1.IsSubclassOf (t2))
argsType = t1;
else if (t2.IsSubclassOf (t1))
argsType = t2;
else
throw new Exception ("Incompatible delegate");
if (t1 == t2)
return;
if (t1.IsSubclassOf (t2))
argsType = t1;
else if (t2.IsSubclassOf (t1))
argsType = t2;
else
throw new Exception ("Incompatible delegate");
}
public bool IsCompatibleDelegate (Delegate d) {
if (!IsValidDelegate (d))
return false;
MethodInfo mi = d.Method;
ParameterInfo[] parms = mi.GetParameters ();
return false;
if (parms[1].ParameterType != this.argsType &&
!parms[1].ParameterType.IsSubclassOf (this.argsType) &&
!this.argsType.IsSubclassOf (parms[1].ParameterType))
return false;
MethodInfo mi = d.Method;
ParameterInfo[] parms = mi.GetParameters ();
return true;
if (parms[1].ParameterType != this.argsType &&
!parms[1].ParameterType.IsSubclassOf (this.argsType) &&
!this.argsType.IsSubclassOf (parms[1].ParameterType))
return false;
return true;
}
public static bool IsValidDelegate (Delegate d) {
MethodInfo mi = d.Method;
if (mi.ReturnType != typeof (void))
return false;
MethodInfo mi = d.Method;
ParameterInfo[] parms = mi.GetParameters ();
if (parms.Length != 2)
return false;
if (parms[1].ParameterType != typeof (Gst.GLib.SignalArgs) &&
!parms[1].ParameterType.IsSubclassOf (typeof (Gst.GLib.SignalArgs)))
return false;
if (mi.ReturnType != typeof (void))
return false;
return true;
ParameterInfo[] parms = mi.GetParameters ();
if (parms.Length != 2)
return false;
if (parms[1].ParameterType != typeof (Gst.GLib.SignalArgs) &&
!parms[1].ParameterType.IsSubclassOf (typeof (Gst.GLib.SignalArgs)))
return false;
return true;
}
}
@ -181,20 +177,20 @@ namespace Gst {
ObjectSignalKey k = new ObjectSignalKey (o, name);
if (!SignalInfo.IsValidDelegate (handler))
throw new Exception ("Invalid delegate");
if (!SignalInfo.IsValidDelegate (handler))
throw new Exception ("Invalid delegate");
if (SignalHandlers[k] != null) {
SignalInfo si = (SignalInfo) SignalHandlers[k];
if (!si.IsCompatibleDelegate (handler))
throw new Exception ("Incompatible delegate");
if (!si.IsCompatibleDelegate (handler))
throw new Exception ("Incompatible delegate");
newHandler = Delegate.Combine (si.RegisteredHandler, handler);
si.UpdateArgsType (handler);
si.UpdateArgsType (handler);
si.RegisteredHandler = newHandler;
} else {
if (!SignalInfo.IsValidDelegate (handler))
throw new Exception ("Invalid delegate");
if (!SignalInfo.IsValidDelegate (handler))
throw new Exception ("Invalid delegate");
IntPtr closure = g_closure_new_simple (g_closure_sizeof, IntPtr.Zero);
g_closure_set_meta_marshal (closure, (IntPtr) GCHandle.Alloc (k), marshalHandler);
@ -233,13 +229,13 @@ namespace Gst {
if (data == IntPtr.Zero) {
Console.Error.WriteLine ("No available data");
return;
return;
}
ObjectSignalKey k = (ObjectSignalKey) ( (GCHandle) data).Target;
if (k != null) {
SignalInfo si = (SignalInfo) SignalHandlers[k];
Gst.GLib.SignalArgs arg = (Gst.GLib.SignalArgs) Activator.CreateInstance (si.ArgsType);
Gst.GLib.SignalArgs arg = (Gst.GLib.SignalArgs) Activator.CreateInstance (si.ArgsType);
arg.Args = args;
si.RegisteredHandler.DynamicInvoke (new object[] {o, arg});
if (arg.RetVal != null) {
@ -254,7 +250,7 @@ namespace Gst {
[DllImport ("libgobject-2.0-0.dll") ]
static extern uint g_signal_connect_closure (IntPtr instance,
string name, IntPtr closure, bool after);
string name, IntPtr closure, bool after);
[DllImport ("libgobject-2.0-0.dll") ]
static extern void g_closure_set_meta_marshal (IntPtr closure, IntPtr data, GClosureMarshal marshal);

View file

@ -1,6 +1,6 @@
[DllImport ("libgobject-2.0-0.dll") ]
static extern IntPtr g_object_ref (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_element_add_pad (IntPtr raw, IntPtr pad);
protected bool AddPad (Pad p) {
@ -30,23 +30,23 @@ public Gst.StateChangeReturn GetState (out Gst.State state, ulong timeout) {
return GetState (out state, out pending, timeout);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_element_found_tags (IntPtr raw, IntPtr list);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_tag_list_copy (IntPtr raw);
protected 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") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_element_found_tags_for_pad (IntPtr raw, IntPtr pad, IntPtr list);
protected 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") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_element_get_query_types (IntPtr raw);
public Gst.QueryType[] GetQueryTypes () {
@ -70,7 +70,7 @@ public Gst.QueryType[] GetQueryTypes () {
return (Gst.QueryType[]) result.ToArray (typeof (Gst.QueryType));
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_element_class_add_pad_template (IntPtr klass, IntPtr templ);
protected static void AddPadTemplate (Gst.GLib.GType gtype, Gst.PadTemplate templ) {
@ -78,7 +78,7 @@ protected static void AddPadTemplate (Gst.GLib.GType gtype, Gst.PadTemplate temp
gst_element_class_add_pad_template (class_ptr, templ.Handle);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_element_class_get_pad_template (IntPtr klass, IntPtr name);
public Gst.PadTemplate GetPadTemplate (string name) {
@ -91,7 +91,7 @@ public Gst.PadTemplate GetPadTemplate (string name) {
return Gst.GLib.Object.GetObject (raw_ret, false) as Gst.PadTemplate;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_element_class_get_pad_template_list (IntPtr klass);
public Gst.PadTemplate[] PadTemplates {
@ -104,7 +104,7 @@ public Gst.PadTemplate[] PadTemplates {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[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 (Gst.GLib.GType gtype, string longname, string klass, string description, string author) {

View file

@ -10,8 +10,7 @@ public ulong Timestamp {
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
return (*raw_ptr);
}
}
set {
} set {
if (!IsWritable)
throw new ApplicationException ();
@ -38,8 +37,7 @@ public Gst.Object Src {
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object;
}
}
set {
} set {
if (!IsWritable)
throw new ApplicationException ();
@ -53,10 +51,10 @@ public Gst.Object Src {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern uint gst_event_get_seqnum (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_event_set_seqnum (IntPtr raw, uint seqnum);
public uint Seqnum {
@ -64,8 +62,7 @@ public uint Seqnum {
uint raw_ret = gst_event_get_seqnum (Handle);
uint ret = raw_ret;
return ret;
}
set {
} set {
if (!IsWritable)
throw new ApplicationException ();
@ -76,7 +73,7 @@ public uint Seqnum {
private Gst.Structure cached_structure = null;
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_get_structure (IntPtr raw);
public Gst.Structure Structure {
@ -123,7 +120,7 @@ public bool IsSerialized {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern Gst.EventTypeFlags gst_event_type_get_flags (Gst.EventType type);
public static Gst.EventTypeFlags GetTypeFlags (Gst.EventType type) {
@ -138,7 +135,7 @@ public static uint GetTypeNumber (Gst.EventType type) {
return ( (uint) type) >> 4;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_custom (Gst.EventType type, IntPtr structure);
public static Gst.Event NewCustom (Gst.EventType type, Gst.Structure structure) {
@ -149,7 +146,7 @@ public static Gst.Event NewCustom (Gst.EventType type, Gst.Structure structure)
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_flush_start ();
public static Gst.Event NewFlushStart () {
@ -158,7 +155,7 @@ public static Gst.Event NewFlushStart () {
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_flush_stop ();
public static Gst.Event NewFlushStop () {
@ -167,7 +164,7 @@ public static Gst.Event NewFlushStop () {
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_eos ();
public static Gst.Event NewEos () {
@ -176,7 +173,7 @@ public static Gst.Event NewEos () {
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_new_segment_full (bool update, double rate, double applied_rate, Gst.Format format, long start, long stop, long position);
public static Gst.Event NewNewSegment (bool update, double rate, double applied_rate, Gst.Format format, long start, long stop, long position) {
@ -189,7 +186,7 @@ public static Gst.Event NewNewSegment (bool update, double rate, Gst.Format form
return NewNewSegment (update, rate, 1.0, format, start, stop, position);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_event_parse_new_segment_full (IntPtr raw, out bool update, out double rate, out double applied_rate, out Gst.Format format, out long start, out long stop, out long position);
public void ParseNewSegment (out bool update, out double rate, out double applied_rate, out Gst.Format format, out long start, out long stop, out long position) {
@ -205,10 +202,10 @@ public void ParseNewSegment (out bool update, out double rate, Gst.Format format
ParseNewSegment (out update, out rate, out applied_rate, out format, out start, out stop, out position);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_tag (IntPtr tags);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_tag_list_copy (IntPtr raw);
public static Gst.Event NewTag (Gst.TagList tags) {
@ -217,7 +214,7 @@ public static Gst.Event NewTag (Gst.TagList tags) {
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_event_parse_tag (IntPtr ev, out IntPtr tags);
public void ParseTag (out TagList tags) {
@ -234,7 +231,7 @@ public void ParseTag (out TagList tags) {
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_buffer_size (Gst.Format format, long min, long max, bool async);
public static Gst.Event NewBufferSize (Gst.Format format, long min, long max, bool async) {
@ -243,7 +240,7 @@ public static Gst.Event NewBufferSize (Gst.Format format, long min, long max, bo
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_event_parse_buffer_size (IntPtr ev, out Gst.Format format, out long min, out long max, out bool async);
public void ParseBufferSize (out Gst.Format format, out long min, out long max, out bool async) {
@ -253,7 +250,7 @@ public void ParseBufferSize (out Gst.Format format, out long min, out long max,
gst_event_parse_buffer_size (Handle, out format, out min, out max, out async);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_qos (double proportion, long diff, ulong timestamp);
public static Gst.Event NewQos (double proportion, long diff, ulong timestamp) {
@ -262,7 +259,7 @@ public static Gst.Event NewQos (double proportion, long diff, ulong timestamp) {
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_event_parse_qos (IntPtr ev, out double proportion, out long diff, out ulong timestamp);
public void ParseQos (out double proportion, out long diff, out ulong timestamp) {
@ -273,7 +270,7 @@ public void ParseQos (out double proportion, out long diff, out ulong timestamp)
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_seek (double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType start_type, long start, Gst.SeekType stop_type, long stop);
public static Gst.Event NewSeek (double rate, Gst.Format format, Gst.SeekFlags flags, Gst.SeekType start_type, long start, Gst.SeekType stop_type, long stop) {
@ -282,7 +279,7 @@ public static Gst.Event NewSeek (double rate, Gst.Format format, Gst.SeekFlags f
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_event_parse_seek (IntPtr ev, out double rate, out Gst.Format format, out Gst.SeekFlags flags, out Gst.SeekType start_type, out long start, out Gst.SeekType stop_type, out long stop);
public void ParseSeek (out double rate, out Gst.Format format, out Gst.SeekFlags flags, out Gst.SeekType start_type, out long start, out Gst.SeekType stop_type, out long stop) {
@ -292,7 +289,7 @@ public void ParseSeek (out double rate, out Gst.Format format, out Gst.SeekFlags
gst_event_parse_seek (Handle, out rate, out format, out flags, out start_type, out start, out stop_type, out stop);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_navigation (IntPtr structure);
public static Gst.Event NewNavigation (Gst.Structure structure) {
@ -303,7 +300,7 @@ public static Gst.Event NewNavigation (Gst.Structure structure) {
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_event_new_latency (ulong latency);
public static Gst.Event NewLatency (ulong latency) {
@ -312,7 +309,7 @@ public static Gst.Event NewLatency (ulong latency) {
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_event_parse_latency (IntPtr ev, out ulong latency);
public void ParseLatency (out ulong latency) {
@ -322,7 +319,7 @@ public void ParseLatency (out ulong latency) {
gst_event_parse_latency (Handle, out latency);
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {
@ -331,7 +328,7 @@ public static Gst.Event NewStep (Gst.Format format, ulong amount, double rate, b
return ev;
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {

View file

@ -18,8 +18,7 @@ namespace Gst {
public uint Domain {
get {
return domain_quark;
}
set {
} set {
domain_quark = value;
}
}
@ -27,8 +26,7 @@ namespace Gst {
public int Code {
get {
return code;
}
set {
} set {
code = value;
}
}
@ -38,8 +36,7 @@ namespace Gst {
if (message == IntPtr.Zero)
return null;
return Gst.GLib.Marshaller.Utf8PtrToString (message);
}
set {
} set {
if (message != IntPtr.Zero)
Gst.GLib.Marshaller.Free (message);
message = Gst.GLib.Marshaller.StringToPtrGStrdup (value);

100
gstreamer-sharp/Iterator.custom Executable file → Normal file
View file

@ -4,72 +4,72 @@ static extern int gst_iterator_next (IntPtr iterator, out IntPtr elem);
static extern void gst_iterator_resync (IntPtr iterator);
private class Enumerator : IEnumerator {
Iterator iterator;
Hashtable seen = new Hashtable ();
Iterator iterator;
Hashtable seen = new Hashtable ();
private object current = null;
public object Current {
get {
return current;
}
}
private object current = null;
public object Current {
get {
return current;
}
}
public bool MoveNext () {
IntPtr raw_ret;
bool retry = false;
public bool MoveNext () {
IntPtr raw_ret;
bool retry = false;
if (iterator.Handle == IntPtr.Zero)
return false;
if (iterator.Handle == IntPtr.Zero)
return false;
do {
int ret = gst_iterator_next (iterator.Handle, out raw_ret);
switch (ret) {
case 0:
return false;
case 1:
if (seen.Contains (raw_ret)) {
retry = true;
break;
}
seen.Add (raw_ret, null);
current = Gst.GLib.Object.GetObject (raw_ret, true);
return true;
case 2:
gst_iterator_resync (iterator.Handle);
retry = true;
break;
default:
case 3:
throw new Exception ("Error while iterating pads");
}
} while (retry);
do {
int ret = gst_iterator_next (iterator.Handle, out raw_ret);
switch (ret) {
case 0:
return false;
case 1:
if (seen.Contains (raw_ret)) {
retry = true;
break;
}
seen.Add (raw_ret, null);
current = Gst.GLib.Object.GetObject (raw_ret, true);
return true;
case 2:
gst_iterator_resync (iterator.Handle);
retry = true;
break;
default:
case 3:
throw new Exception ("Error while iterating pads");
}
} while (retry);
return false;
}
return false;
}
public void Reset () {
seen.Clear ();
if (iterator.Handle != IntPtr.Zero)
gst_iterator_resync (iterator.Handle);
}
public void Reset () {
seen.Clear ();
if (iterator.Handle != IntPtr.Zero)
gst_iterator_resync (iterator.Handle);
}
public Enumerator (Iterator iterator) {
this.iterator = iterator;
}
public Enumerator (Iterator iterator) {
this.iterator = iterator;
}
}
private Enumerator enumerator = null;
public IEnumerator GetEnumerator () {
if (this.enumerator == null)
this.enumerator = new Enumerator (this);
return this.enumerator;
if (this.enumerator == null)
this.enumerator = new Enumerator (this);
return this.enumerator;
}
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_iterator_free (IntPtr iterator);
~Iterator () {
if (Raw != IntPtr.Zero)
gst_iterator_free (Raw);
if (Raw != IntPtr.Zero)
gst_iterator_free (Raw);
}

View file

@ -4,43 +4,41 @@ using System.Runtime.InteropServices;
using Gst.GLib;
namespace Gst {
internal static class Marshaller {
internal static class Marshaller {
public static IntPtr StringArrayToNullTermPointer (string[] strs)
{
if (strs == null)
return IntPtr.Zero;
public static IntPtr StringArrayToNullTermPointer (string[] strs) {
if (strs == null)
return IntPtr.Zero;
IntPtr result = Gst.GLib.Marshaller.Malloc ((ulong) ((strs.Length + 1) * IntPtr.Size));
IntPtr result = Gst.GLib.Marshaller.Malloc ( (ulong) ( (strs.Length + 1) * IntPtr.Size));
for (int i = 0; i < strs.Length; i++)
Marshal.WriteIntPtr (result, i * IntPtr.Size, Gst.GLib.Marshaller.StringToPtrGStrdup (strs [i]));
for (int i = 0; i < strs.Length; i++)
Marshal.WriteIntPtr (result, i * IntPtr.Size, Gst.GLib.Marshaller.StringToPtrGStrdup (strs [i]));
Marshal.WriteIntPtr (result, strs.Length * IntPtr.Size, IntPtr.Zero);
Marshal.WriteIntPtr (result, strs.Length * IntPtr.Size, IntPtr.Zero);
return result;
}
return result;
}
[DllImport("libglib-2.0-0.dll")]
static extern void g_strfreev (IntPtr mem);
[DllImport ("libglib-2.0-0.dll") ]
static extern void g_strfreev (IntPtr mem);
public static string[] NullTermPtrToStringArray (IntPtr null_term_array, bool owned)
{
if (null_term_array == IntPtr.Zero)
return new string [0];
public static string[] NullTermPtrToStringArray (IntPtr null_term_array, bool owned) {
if (null_term_array == IntPtr.Zero)
return new string [0];
int count = 0;
System.Collections.ArrayList result = new System.Collections.ArrayList ();
IntPtr s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
while (s != IntPtr.Zero) {
result.Add (Gst.GLib.Marshaller.Utf8PtrToString (s));
s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
}
int count = 0;
System.Collections.ArrayList result = new System.Collections.ArrayList ();
IntPtr s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
while (s != IntPtr.Zero) {
result.Add (Gst.GLib.Marshaller.Utf8PtrToString (s));
s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
}
if (owned)
g_strfreev (null_term_array);
if (owned)
g_strfreev (null_term_array);
return (string[]) result.ToArray (typeof(string));
}
}
return (string[]) result.ToArray (typeof (string));
}
}
}

View file

@ -10,8 +10,7 @@ public ulong Timestamp {
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
return (*raw_ptr);
}
}
set {
} set {
if (!IsWritable)
throw new ApplicationException ();
@ -38,8 +37,7 @@ public Gst.Object Src {
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
return Gst.GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object;
}
}
set {
} set {
if (!IsWritable)
throw new ApplicationException ();
@ -53,10 +51,10 @@ public Gst.Object Src {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern uint gst_message_get_seqnum (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_set_seqnum (IntPtr raw, uint seqnum);
public uint Seqnum {
@ -64,8 +62,7 @@ public uint Seqnum {
uint raw_ret = gst_message_get_seqnum (Handle);
uint ret = raw_ret;
return ret;
}
set {
} set {
if (!IsWritable)
throw new ApplicationException ();
@ -73,10 +70,10 @@ public uint Seqnum {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_get_stream_status_object (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[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 {
@ -84,8 +81,7 @@ public GLib.Value StreamStatusObject {
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 {
} set {
if (!IsWritable)
throw new ApplicationException ();
@ -95,7 +91,7 @@ public GLib.Value StreamStatusObject {
private Gst.Structure cached_structure = null;
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_get_structure (IntPtr raw);
public Gst.Structure Structure {
@ -118,7 +114,7 @@ public Gst.Structure Structure {
cached_structure = null;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_eos (IntPtr src);
public static Message NewEos (Gst.Object src) {
@ -127,7 +123,7 @@ public static Message NewEos (Gst.Object src) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_error_get_message (uint domain, int code);
static string GetMessage (uint domain, int code) {
@ -138,16 +134,16 @@ static string GetMessage (uint domain, int code) {
return Gst.GLib.Marshaller.PtrToStringGFree (raw_ret);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern uint gst_core_error_quark ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern uint gst_library_error_quark ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern uint gst_stream_error_quark ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern uint gst_resource_error_quark ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_error (IntPtr src, ref Gst.GError error, IntPtr debug);
public static Message NewError (Gst.Object src, Gst.CoreError error, string message, string debug) {
@ -237,7 +233,7 @@ public static Message NewError (Gst.Object src, Gst.ResourceError error) {
return NewError (src, error, null, null);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_error (IntPtr msg, out IntPtr err, out IntPtr debug);
public void ParseError (out Enum error, out string message, out string debug) {
@ -285,7 +281,7 @@ public void ParseError (out Enum error) {
ParseError (out error, out tmp, out tmp2);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_warning (IntPtr src, ref Gst.GError error, IntPtr debug);
public static Message NewWarning (Gst.Object src, Gst.CoreError error, string message, string debug) {
@ -376,7 +372,7 @@ public static Message NewWarning (Gst.Object src, Gst.ResourceError error) {
return NewWarning (src, error, null, null);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_warning (IntPtr msg, out IntPtr err, out IntPtr debug);
public void ParseWarning (out Enum error, out string message, out string debug) {
@ -424,7 +420,7 @@ public void ParseWarning (out Enum error) {
ParseWarning (out error, out tmp, out tmp2);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_info (IntPtr src, ref Gst.GError error, IntPtr debug);
public static Message NewInfo (Gst.Object src, Gst.CoreError error, string message, string debug) {
@ -515,7 +511,7 @@ public static Message NewInfo (Gst.Object src, Gst.ResourceError error) {
return NewInfo (src, error, null, null);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_info (IntPtr msg, out IntPtr err, out IntPtr debug);
public void ParseInfo (out Enum error, out string message, out string debug) {
@ -563,12 +559,12 @@ public void ParseInfo (out Enum error) {
ParseInfo (out error, out tmp, out tmp2);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_tag (IntPtr src, IntPtr tags);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_tag_full (IntPtr src, IntPtr pad, IntPtr tags);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_tag_list_copy (IntPtr handle);
public static Message NewTag (Gst.Object src, TagList tags) {
@ -583,7 +579,7 @@ public static Message NewTag (Gst.Object src, Gst.Pad pad, TagList tags) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {
@ -604,7 +600,7 @@ public void ParseTag (out Gst.Pad pad, out TagList tags) {
pad = (Gst.Pad) Gst.GLib.Object.GetObject (raw_ptr2, true);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_buffering (IntPtr src, int percent);
public static Message NewBuffering (Gst.Object src, int percent) {
@ -613,7 +609,7 @@ public static Message NewBuffering (Gst.Object src, int percent) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_buffering (IntPtr msg, out int percent);
public void ParseBuffering (out int percent) {
@ -623,7 +619,7 @@ public void ParseBuffering (out int percent) {
gst_message_parse_buffering (Handle, out percent);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_set_buffering_stats (IntPtr msg, Gst.BufferingMode mode, int avg_in, int avg_out, long buffering_left);
public void SetBufferingStats (Gst.BufferingMode mode, int avg_in, int avg_out, long buffering_left) {
@ -635,7 +631,7 @@ public void SetBufferingStats (Gst.BufferingMode mode, int avg_in, int avg_out,
gst_message_set_buffering_stats (Handle, mode, avg_in, avg_out, buffering_left);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_buffering_stats (IntPtr msg, out Gst.BufferingMode mode, out int avg_in, out int avg_out, out long buffering_left);
public void ParseBufferingStats (out Gst.BufferingMode mode, out int avg_in, out int avg_out, out long buffering_left) {
@ -645,7 +641,7 @@ public void ParseBufferingStats (out Gst.BufferingMode mode, out int avg_in, out
gst_message_parse_buffering_stats (Handle, out mode, out avg_in, out avg_out, out buffering_left);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_state_changed (IntPtr src, State oldstate, State newstate, State pendingstate);
public static Message NewStateChanged (Gst.Object src, State oldstate, State newstate, State pendingstate) {
@ -654,7 +650,7 @@ public static Message NewStateChanged (Gst.Object src, State oldstate, State new
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_state_changed (IntPtr msg, out State oldstate, out State newstate, out State pendingstate);
public void ParseStateChanged (out State oldstate, out State newstate, out State pendingstate) {
@ -664,7 +660,7 @@ public void ParseStateChanged (out State oldstate, out State newstate, out State
gst_message_parse_state_changed (Handle, out oldstate, out newstate, out pendingstate);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_state_dirty (IntPtr src);
public static Message NewStateDirty (Gst.Object src) {
@ -672,7 +668,7 @@ public static Message NewStateDirty (Gst.Object src) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_clock_provide (IntPtr src, IntPtr clock, bool ready);
public static Message NewClockProvide (Gst.Object src, Gst.Clock clock, bool ready) {
@ -681,7 +677,7 @@ public static Message NewClockProvide (Gst.Object src, Gst.Clock clock, bool rea
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_clock_provide (IntPtr msg, out IntPtr clock, out bool ready);
public void ParseClockProvide (out Gst.Clock clock, out bool ready) {
@ -695,7 +691,7 @@ public void ParseClockProvide (out Gst.Clock clock, out bool ready) {
clock = Gst.GLib.Object.GetObject (raw, false) as Gst.Clock;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_clock_lost (IntPtr src, IntPtr clock);
public static Message NewClockLost (Gst.Object src, Gst.Clock clock) {
@ -704,7 +700,7 @@ public static Message NewClockLost (Gst.Object src, Gst.Clock clock) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_clock_lost (IntPtr msg, out IntPtr clock);
public void ParseClockLost (out Gst.Clock clock) {
@ -718,7 +714,7 @@ public void ParseClockLost (out Gst.Clock clock) {
clock = Gst.GLib.Object.GetObject (raw, true) as Gst.Clock;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_new_clock (IntPtr src, IntPtr clock);
public static Message NewNewClock (Gst.Object src, Gst.Clock clock) {
@ -727,7 +723,7 @@ public static Message NewNewClock (Gst.Object src, Gst.Clock clock) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_new_clock (IntPtr msg, out IntPtr clock);
public void ParseNewClock (out Gst.Clock clock) {
@ -741,7 +737,7 @@ public void ParseNewClock (out Gst.Clock clock) {
clock = Gst.GLib.Object.GetObject (raw, true) as Gst.Clock;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_application (IntPtr src, IntPtr structure);
public static Message NewApplication (Gst.Object src, Gst.Structure structure) {
@ -752,7 +748,7 @@ public static Message NewApplication (Gst.Object src, Gst.Structure structure) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_element (IntPtr src, IntPtr structure);
public static Message NewElement (Gst.Object src, Gst.Structure structure) {
@ -763,7 +759,7 @@ public static Message NewElement (Gst.Object src, Gst.Structure structure) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_custom (Gst.MessageType type, IntPtr src, IntPtr structure);
public static Message NewCustom (Gst.MessageType type, Gst.Object src, Gst.Structure structure) {
@ -774,7 +770,7 @@ public static Message NewCustom (Gst.MessageType type, Gst.Object src, Gst.Struc
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_segment_start (IntPtr src, Gst.Format format, long position);
public static Message NewSegmentStart (Gst.Object src, Gst.Format format, long position) {
@ -783,7 +779,7 @@ public static Message NewSegmentStart (Gst.Object src, Gst.Format format, long p
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_segment_start (IntPtr msg, out Gst.Format format, out long position);
public void ParseSegmentStart (out Gst.Format format, out long position) {
@ -793,7 +789,7 @@ public void ParseSegmentStart (out Gst.Format format, out long position) {
gst_message_parse_segment_start (Handle, out format, out position);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_segment_done (IntPtr src, Gst.Format format, long position);
public static Message NewSegmentDone (Gst.Object src, Gst.Format format, long position) {
@ -802,7 +798,7 @@ public static Message NewSegmentDone (Gst.Object src, Gst.Format format, long po
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_segment_done (IntPtr msg, out Gst.Format format, out long position);
public void ParseSegmentDone (out Gst.Format format, out long position) {
@ -812,7 +808,7 @@ public void ParseSegmentDone (out Gst.Format format, out long position) {
gst_message_parse_segment_done (Handle, out format, out position);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_duration (IntPtr src, Gst.Format format, long duration);
public static Message NewDuration (Gst.Object src, Gst.Format format, long duration) {
@ -821,7 +817,7 @@ public static Message NewDuration (Gst.Object src, Gst.Format format, long durat
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_duration (IntPtr msg, out Gst.Format format, out long duration);
public void ParseDuration (out Gst.Format format, out long duration) {
@ -831,7 +827,7 @@ public void ParseDuration (out Gst.Format format, out long duration) {
gst_message_parse_duration (Handle, out format, out duration);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_latency (IntPtr src);
public static Message NewLatency (Gst.Object src) {
@ -840,7 +836,7 @@ public static Message NewLatency (Gst.Object src) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_async_start (IntPtr src, bool new_base_time);
public static Message NewAsyncStart (Gst.Object src, bool new_base_time) {
@ -849,7 +845,7 @@ public static Message NewAsyncStart (Gst.Object src, bool new_base_time) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_async_start (IntPtr msg, out bool new_base_time);
public void ParseAsyncStart (out bool new_base_time) {
@ -859,7 +855,7 @@ public void ParseAsyncStart (out bool new_base_time) {
gst_message_parse_async_start (Handle, out new_base_time);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_async_done (IntPtr src);
public static Message NewAsyncDone (Gst.Object src) {
@ -868,7 +864,7 @@ public static Message NewAsyncDone (Gst.Object src) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_structure_change (IntPtr src, StructureChangeType type, IntPtr owner, bool busy);
public static Message NewStructureChange (Gst.Object src, StructureChangeType type, Gst.Element owner, bool busy) {
@ -877,7 +873,7 @@ public static Message NewStructureChange (Gst.Object src, StructureChangeType ty
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_structure_change (IntPtr msg, out StructureChangeType type, out IntPtr owner, out bool busy);
public void ParseStructureChange (out StructureChangeType type, out Gst.Element owner, out bool busy) {
@ -894,7 +890,7 @@ static Message () {
Gst.GLib.GType.Register (Message.GType, typeof (Message));
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {
@ -903,7 +899,7 @@ public static Message NewStepDone (Gst.Object src, Gst.Format format, ulong amou
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {
@ -913,7 +909,7 @@ public void ParseStepDone (out Gst.Format format, out ulong amount, out double r
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") ]
[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) {
@ -922,7 +918,7 @@ public static Message NewStepDone (Gst.Object src, bool active, Gst.Format forma
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {
@ -932,7 +928,7 @@ public void ParseStepStart (out bool active, out Gst.Format format, out ulong am
gst_message_parse_step_start (Handle, out active, out format, out amount, out rate, out flush, out intermediate);
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {
@ -941,7 +937,7 @@ public static Message NewStreamStatus (Gst.Object src, StreamStatusType type, Gs
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[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) {
@ -954,7 +950,7 @@ public void ParseStreamStatus (out StreamStatusType type, out Gst.Element owner)
owner = Gst.GLib.Object.GetObject (raw_ptr, false) as Gst.Element;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_message_new_request_state (IntPtr src, Gst.State state);
public static Message NewRequestState (Gst.Object src, Gst.State state) {
@ -963,7 +959,7 @@ public static Message NewRequestState (Gst.Object src, Gst.State state) {
return msg;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_message_parse_request_state (IntPtr msg, out Gst.State state);
public void ParseRequestState (out Gst.State state) {

View file

@ -341,8 +341,7 @@ namespace Gst {
protected virtual IntPtr Raw {
get {
return handle;
}
set {
} set {
if (handle != IntPtr.Zero)
Objects.Remove (handle);
handle = value;
@ -409,8 +408,7 @@ namespace Gst {
get {
GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject));
return inst_struct.flags;
}
set {
} set {
GstMiniObject inst_struct = (GstMiniObject) Marshal.PtrToStructure (Handle, typeof (GstMiniObject));
inst_struct.flags = value;
}

View file

@ -8,7 +8,7 @@ namespace Gst.Interfaces {
using Gst.Interfaces;
public static class MixerMessage {
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern int gst_mixer_message_get_type (IntPtr message);
public static Gst.Interfaces.MixerMessageType MessageGetType (Gst.Message message) {
@ -17,7 +17,7 @@ namespace Gst.Interfaces {
return ret;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern void gst_mixer_message_parse_mute_toggled (IntPtr message, out IntPtr track, out bool mute);
public static void ParseMuteToggled (Gst.Message message, out Gst.Interfaces.MixerTrack track, out bool mute) {
@ -28,7 +28,7 @@ namespace Gst.Interfaces {
track = (MixerTrack) Gst.GLib.Object.GetObject (native_ptr, false);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern void gst_mixer_message_parse_option_changed (IntPtr message, out IntPtr options, out IntPtr value);
public static void ParseOptionChanged (Gst.Message message, out Gst.Interfaces.MixerOptions options, out string value) {
@ -41,7 +41,7 @@ namespace Gst.Interfaces {
value = Gst.GLib.Marshaller.Utf8PtrToString (native_value);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern void gst_mixer_message_parse_record_toggled (IntPtr message, out IntPtr track, out bool record);
public static void ParseRecordToggled (Gst.Message message, out Gst.Interfaces.MixerTrack track, out bool record) {
@ -51,7 +51,7 @@ namespace Gst.Interfaces {
track = (MixerTrack) Gst.GLib.Object.GetObject (native_ptr, false);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern void gst_mixer_message_parse_volume_changed (IntPtr message, out IntPtr track, out IntPtr volumes, out int num_channels);
public static void ParseVolumeChanged (Gst.Message message, out Gst.Interfaces.MixerTrack track, out int[] volumes) {
@ -68,7 +68,7 @@ namespace Gst.Interfaces {
Gst.GLib.Marshaller.Free (native_volumes);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern void gst_mixer_message_parse_options_list_changed (IntPtr message, out IntPtr options);
public static void ParseOptionsListChanged (Gst.Message message, out Gst.Interfaces.MixerOptions options) {

View file

@ -8,7 +8,7 @@ namespace Gst.Interfaces {
using Gst.Interfaces;
public static class NavigationEvent {
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern int gst_navigation_event_get_type (IntPtr evnt);
public static Gst.Interfaces.NavigationEventType EventGetType (Gst.Event evnt) {
@ -17,7 +17,7 @@ namespace Gst.Interfaces {
return ret;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_event_parse_key_event (IntPtr evnt, out IntPtr key);
public static bool ParseKeyEvent (Gst.Event evnt, out string key) {
@ -29,21 +29,21 @@ namespace Gst.Interfaces {
return ret;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_event_parse_mouse_button_event (IntPtr evnt, out int button, out double x, out double y);
public static bool ParseMouseButtonEvent (Gst.Event evnt, out int button, out double x, out double y) {
return gst_navigation_event_parse_mouse_button_event (evnt.Handle, out button, out x, out y);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_event_parse_mouse_move_event (IntPtr evnt, out double x, out double y);
public static bool ParseMouseMoveEvent (Gst.Event evnt, out double x, out double y) {
return gst_navigation_event_parse_mouse_move_event (evnt.Handle, out x, out y);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_event_parse_command (IntPtr evnt, out int command);
public static bool ParseCommand (Gst.Event evnt, out Gst.Interfaces.NavigationCommand command) {

View file

@ -8,7 +8,7 @@ namespace Gst.Interfaces {
using Gst.Interfaces;
public static class NavigationMessage {
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern int gst_navigation_message_get_type (IntPtr message);
public static Gst.Interfaces.NavigationMessageType MessageGetType (Gst.Message message) {
@ -17,7 +17,7 @@ namespace Gst.Interfaces {
return ret;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern IntPtr gst_navigation_message_new_mouse_over (IntPtr src, bool active);
public static Gst.Message NewMouseOver (Gst.Object src, bool active) {
@ -25,14 +25,14 @@ namespace Gst.Interfaces {
return msg;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_message_parse_mouse_over (IntPtr msg, out bool active);
public static bool ParseMouseOver (Gst.Message msg, out bool active) {
return gst_navigation_message_parse_mouse_over (msg.Handle, out active);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern IntPtr gst_navigation_message_new_angles_changed (IntPtr src, uint cur_angle, uint n_angles);
public static Gst.Message NewAnglesChanged (Gst.Object src, uint cur_angle, uint n_angles) {
@ -40,14 +40,14 @@ namespace Gst.Interfaces {
return msg;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_message_parse_angles_changed (IntPtr msg, out uint cur_angle, out uint n_angles);
public static bool ParseMouseOver (Gst.Message msg, out uint cur_angle, out uint n_angles) {
return gst_navigation_message_parse_angles_changed (msg.Handle, out cur_angle, out n_angles);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern IntPtr gst_navigation_message_new_commands_changed (IntPtr src);
public static Gst.Message NewCommandsChanged (Gst.Object src) {

View file

@ -8,7 +8,7 @@ namespace Gst.Interfaces {
using Gst.Interfaces;
public static class NavigationQuery {
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern int gst_navigation_query_get_type (IntPtr query);
public static Gst.Interfaces.NavigationQueryType QueryGetType (Gst.Query query) {
@ -17,7 +17,7 @@ namespace Gst.Interfaces {
return ret;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern IntPtr gst_navigation_query_new_commands ();
public static Gst.Query NewCommands () {
@ -25,7 +25,7 @@ namespace Gst.Interfaces {
return query;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern void gst_navigation_query_set_commandsv (IntPtr query, uint n_commands, int[] cmds);
public static void SetCommands (Gst.Query query, Gst.Interfaces.NavigationCommand[] cmds) {
@ -39,9 +39,9 @@ namespace Gst.Interfaces {
gst_navigation_query_set_commandsv (query.Handle, (uint) raw_cmds.Length, raw_cmds);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_query_parse_commands_length (IntPtr query, out uint n_commands);
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_query_parse_commands_nth (IntPtr query, uint nth, out int cmd);
public static bool ParseCommands (Gst.Query query, out Gst.Interfaces.NavigationCommand[] cmds) {
@ -64,7 +64,7 @@ namespace Gst.Interfaces {
return true;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern IntPtr gst_navigation_query_new_angles ();
public static Gst.Query NewAngles () {
@ -72,7 +72,7 @@ namespace Gst.Interfaces {
return query;
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern void gst_navigation_query_set_angles (IntPtr query, uint cur_angle, uint n_angles);
public static void SetAngles (Gst.Query query, uint cur_angle, uint n_angles) {
@ -82,7 +82,7 @@ namespace Gst.Interfaces {
gst_navigation_query_set_angles (query.Handle, cur_angle, n_angles);
}
[DllImport("libgstinterfaces-0.10.dll") ]
[DllImport ("libgstinterfaces-0.10.dll") ]
static extern bool gst_navigation_query_parse_angles (IntPtr query, out uint cur_angle, out uint n_angles);
public static bool ParseAngles (Gst.Query query, out uint cur_angle, out uint n_angles) {

View file

@ -4,8 +4,7 @@ public object this[string property] {
object o = v.Val;
v.Dispose ();
return o;
}
set {
} set {
Gst.GLib.Value v = new Gst.GLib.Value (this, property);
v.Val = value;
SetProperty (property, v);
@ -69,14 +68,13 @@ public object Emit (string signal, params object[] parameters) {
return DynamicSignal.Emit (this, signal, parameters);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_object_ref_sink (IntPtr raw);
protected override IntPtr Raw {
get {
return base.Raw;
}
set {
} set {
if (value != IntPtr.Zero) {
gst_object_ref_sink (value);
}
@ -85,9 +83,9 @@ protected override IntPtr Raw {
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_object_set_parent (IntPtr raw, IntPtr parent);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_object_get_parent (IntPtr raw);
public Gst.Object Parent {
@ -135,7 +133,7 @@ public bool TryLock () {
return g_mutex_trylock (LockPtr);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_object_check_uniqueness (IntPtr list, IntPtr name);
public static bool CheckUniqueness (Gst.Object[] objects, string name) {

View file

@ -1,6 +1,6 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_pad_get_pad_template_caps (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_caps_copy (IntPtr raw);
public Gst.Caps PadTemplateCaps {
@ -11,28 +11,28 @@ public Gst.Caps PadTemplateCaps {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_remove_data_probe (IntPtr raw, uint handler_id);
public void RemoveDataProbe (ulong handler_id) {
gst_pad_remove_data_probe (Handle, (uint) handler_id);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_remove_event_probe (IntPtr raw, uint handler_id);
public void RemoveEventProbe (ulong handler_id) {
gst_pad_remove_event_probe (Handle, (uint) handler_id);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_remove_buffer_probe (IntPtr raw, uint handler_id);
public void RemoveBufferProbe (ulong handler_id) {
gst_pad_remove_buffer_probe (Handle, (uint) handler_id);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_bufferalloc_function (IntPtr raw, GstSharp.PadBufferAllocFunctionNative bufalloc);
public Gst.PadBufferAllocFunction BufferAllocFunction {
@ -46,7 +46,7 @@ public Gst.PadBufferAllocFunction BufferAllocFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_chain_function (IntPtr raw, GstSharp.PadChainFunctionNative chain);
public Gst.PadChainFunction ChainFunction {
@ -60,7 +60,7 @@ public Gst.PadChainFunction ChainFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_chain_list_function (IntPtr raw, GstSharp.PadChainListFunctionNative chain);
public Gst.PadChainListFunction ChainListFunction {
@ -74,7 +74,7 @@ public Gst.PadChainListFunction ChainListFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_checkgetrange_function (IntPtr raw, GstSharp.PadCheckGetRangeFunctionNative check);
public Gst.PadCheckGetRangeFunction CheckGetRangeFunction {
@ -88,7 +88,7 @@ public Gst.PadCheckGetRangeFunction CheckGetRangeFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_getrange_function (IntPtr raw, GstSharp.PadGetRangeFunctionNative get);
public Gst.PadGetRangeFunction GetRangeFunction {
@ -102,7 +102,7 @@ public Gst.PadGetRangeFunction GetRangeFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_event_function (IntPtr raw, GstSharp.PadEventFunctionNative evnt);
public Gst.PadEventFunction EventFunction {
@ -116,7 +116,7 @@ public Gst.PadEventFunction EventFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_link_function (IntPtr raw, GstSharp.PadLinkFunctionNative link);
public Gst.PadLinkFunction LinkFunction {
@ -130,7 +130,7 @@ public Gst.PadLinkFunction LinkFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_unlink_function (IntPtr raw, GstSharp.PadUnlinkFunctionNative unlink);
public Gst.PadUnlinkFunction UnlinkFunction {
@ -144,7 +144,7 @@ public Gst.PadUnlinkFunction UnlinkFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_acceptcaps_function (IntPtr raw, GstSharp.PadAcceptCapsFunctionNative acceptcaps);
public Gst.PadAcceptCapsFunction AcceptCapsFunction {
@ -158,7 +158,7 @@ public Gst.PadAcceptCapsFunction AcceptCapsFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_getcaps_function (IntPtr raw, GstSharp.PadGetCapsFunctionNative getcaps);
public Gst.PadGetCapsFunction GetCapsFunction {
@ -172,7 +172,7 @@ public Gst.PadGetCapsFunction GetCapsFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_setcaps_function (IntPtr raw, GstSharp.PadSetCapsFunctionNative setcaps);
public Gst.PadSetCapsFunction SetCapsFunction {
@ -186,7 +186,7 @@ public Gst.PadSetCapsFunction SetCapsFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_fixatecaps_function (IntPtr raw, GstSharp.PadFixateCapsFunctionNative fixatecaps);
public Gst.PadFixateCapsFunction FixateCapsFunction {
@ -200,7 +200,7 @@ public Gst.PadFixateCapsFunction FixateCapsFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_activate_function (IntPtr raw, GstSharp.PadActivateFunctionNative activate);
public Gst.PadActivateFunction ActivateFunction {
@ -214,7 +214,7 @@ public Gst.PadActivateFunction ActivateFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_activatepull_function (IntPtr raw, GstSharp.PadActivateModeFunctionNative activatepull);
public Gst.PadActivateModeFunction ActivatePullFunction {
@ -228,7 +228,7 @@ public Gst.PadActivateModeFunction ActivatePullFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_activatepush_function (IntPtr raw, GstSharp.PadActivateModeFunctionNative activatepush);
public Gst.PadActivateModeFunction ActivatePushFunction {
@ -242,7 +242,7 @@ public Gst.PadActivateModeFunction ActivatePushFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern int gst_pad_pull_range (IntPtr raw, ulong offset, uint size, out IntPtr buffer);
public Gst.FlowReturn PullRange (ulong offset, uint size, out Gst.Buffer buffer) {
@ -254,7 +254,7 @@ public Gst.FlowReturn PullRange (ulong offset, uint size, out Gst.Buffer buffer)
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_query_function (IntPtr raw, GstSharp.PadQueryFunctionNative query);
public Gst.PadQueryFunction QueryFunction {
@ -268,7 +268,7 @@ public Gst.PadQueryFunction QueryFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_pad_set_query_type_function (IntPtr raw, GstSharp.PadQueryTypeFunctionNative query);
public Gst.PadQueryTypeFunction QueryTypeFunction {
@ -282,7 +282,7 @@ public Gst.PadQueryTypeFunction QueryTypeFunction {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_pad_get_query_types (IntPtr raw);
public Gst.QueryType[] QueryTypes {
@ -308,7 +308,7 @@ public Gst.QueryType[] QueryTypes {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_pad_get_query_types_default (IntPtr raw);
static Gst.QueryType[] GetQueryTypesDefault (Gst.Pad pad) {

View file

@ -1,7 +1,7 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_pad_template_new (IntPtr name_template, int direction, int presence, IntPtr caps);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_caps_ref (IntPtr handle);
public PadTemplate (string name_template, Gst.PadDirection direction, Gst.PadPresence presence, Gst.Caps caps) : base (IntPtr.Zero) {

View file

@ -1,4 +1,4 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_plugin_load_file (IntPtr filename, out IntPtr gerror);
public static Gst.Plugin LoadFile (string filename) {

View file

@ -29,7 +29,7 @@ namespace Gst {
[DllImport ("libgobject-2.0-0.dll") ]
static extern IntPtr g_type_default_interface_ref (IntPtr type);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_preset_get_type();
static PresetDefault () {

View file

@ -2,7 +2,7 @@ public Query (Gst.GLib.Value val) : base (val) { }
private Gst.Structure cached_structure = null;
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_get_structure (IntPtr raw);
public Gst.Structure Structure {
@ -31,7 +31,7 @@ public new string TypeName {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_application (QueryType type, IntPtr structure);
public static Query NewApplication (Gst.QueryType type, Structure structure) {
@ -42,7 +42,7 @@ public static Query NewApplication (Gst.QueryType type, Structure structure) {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_convert (Gst.Format src_format, long value, Gst.Format dest_format);
public static Query NewConvert (Gst.Format src_format, long value, Gst.Format dest_format) {
@ -51,7 +51,7 @@ public static Query NewConvert (Gst.Format src_format, long value, Gst.Format de
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_convert (IntPtr query, Gst.Format src_format, long src_value, Gst.Format dest_format, long dest_value);
public void SetConvert (Gst.Format src_format, long src_value, Gst.Format dest_format, long dest_value) {
@ -63,7 +63,7 @@ public void SetConvert (Gst.Format src_format, long src_value, Gst.Format dest_f
gst_query_set_convert (Handle, src_format, src_value, dest_format, dest_value);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_convert (IntPtr query, out Gst.Format src_format, out long src_value, out Gst.Format dest_format, out long dest_value);
public void ParseConvert (out Gst.Format src_format, out long src_value, out Gst.Format dest_format, out long dest_value) {
@ -73,7 +73,7 @@ public void ParseConvert (out Gst.Format src_format, out long src_value, out Gst
gst_query_parse_convert (Handle, out src_format, out src_value, out dest_format, out dest_value);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_position (Gst.Format format);
public static Query NewPosition (Gst.Format format) {
@ -82,7 +82,7 @@ public static Query NewPosition (Gst.Format format) {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_position (IntPtr query, Gst.Format format, long cur);
public void SetPosition (Gst.Format format, long cur) {
@ -94,7 +94,7 @@ public void SetPosition (Gst.Format format, long cur) {
gst_query_set_position (Handle, format, cur);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_position (IntPtr query, out Gst.Format format, out long cur);
public void ParsePosition (out Gst.Format format, out long cur) {
@ -104,7 +104,7 @@ public void ParsePosition (out Gst.Format format, out long cur) {
gst_query_parse_position (Handle, out format, out cur);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_duration (Gst.Format format);
public static Query NewDuration (Gst.Format format) {
@ -113,7 +113,7 @@ public static Query NewDuration (Gst.Format format) {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_duration (IntPtr query, Gst.Format format, long duration);
public void SetDuration (Gst.Format format, long duration) {
@ -125,7 +125,7 @@ public void SetDuration (Gst.Format format, long duration) {
gst_query_set_duration (Handle, format, duration);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_duration (IntPtr query, out Gst.Format format, out long duration);
public void ParseDuration (out Gst.Format format, out long duration) {
@ -135,7 +135,7 @@ public void ParseDuration (out Gst.Format format, out long duration) {
gst_query_parse_duration (Handle, out format, out duration);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_latency ();
public static Query NewLatency() {
@ -144,7 +144,7 @@ public static Query NewLatency() {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_latency (IntPtr query, bool live, ulong min, ulong max);
public void SetLatency (bool live, ulong min, ulong max) {
@ -156,7 +156,7 @@ public void SetLatency (bool live, ulong min, ulong max) {
gst_query_set_latency (Handle, live, min, max);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_latency (IntPtr query, out bool live, out ulong min, out ulong max);
public void ParseLatency (out bool live, out ulong min, out ulong max) {
@ -166,7 +166,7 @@ public void ParseLatency (out bool live, out ulong min, out ulong max) {
gst_query_parse_latency (Handle, out live, out min, out max);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_seeking (Gst.Format format);
public static Query NewSeeking (Gst.Format format) {
@ -175,7 +175,7 @@ public static Query NewSeeking (Gst.Format format) {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_seeking (IntPtr query, Gst.Format format, bool seekable, long segment_start, long segment_stop);
public void SetSeeking (Gst.Format format, bool seekable, long segment_start, long segment_stop) {
@ -187,7 +187,7 @@ public void SetSeeking (Gst.Format format, bool seekable, long segment_start, lo
gst_query_set_seeking (Handle, format, seekable, segment_start, segment_stop);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_seeking (IntPtr query, out Gst.Format format, out bool seekable, out long segment_start, out long segment_stop);
public void ParseSeeking (out Gst.Format format, out bool seekable, out long segment_start, out long segment_stop) {
@ -197,7 +197,7 @@ public void ParseSeeking (out Gst.Format format, out bool seekable, out long seg
gst_query_parse_seeking (Handle, out format, out seekable, out segment_start, out segment_stop);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_formats ();
public static Query NewFormats() {
@ -217,9 +217,9 @@ public void SetFormats (Gst.Format[] formats) {
s["formats"] = l;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_formats_length (IntPtr query, out uint n_formats);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_formats_nth (IntPtr query, uint nth, out Gst.Format format);
public void ParseFormats (out Gst.Format[] formats) {
@ -235,7 +235,7 @@ public void ParseFormats (out Gst.Format[] formats) {
gst_query_parse_formats_nth (Handle, i, out formats[i]);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_segment (Gst.Format format);
public static Query NewSegment (Gst.Format format) {
@ -244,7 +244,7 @@ public static Query NewSegment (Gst.Format format) {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_segment (IntPtr query, double rate, Gst.Format format, long segment_start, long segment_stop);
public void SetSegment (double rate, Gst.Format format, long segment_start, long segment_stop) {
@ -256,7 +256,7 @@ public void SetSegment (double rate, Gst.Format format, long segment_start, long
gst_query_set_segment (Handle, rate, format, segment_start, segment_stop);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_segment (IntPtr query, out double rate, out Gst.Format format, out long segment_start, out long segment_stop);
public void ParseSegment (out double rate, out Gst.Format format, out long segment_start, out long segment_stop) {
@ -266,7 +266,7 @@ public void ParseSegment (out double rate, out Gst.Format format, out long segme
gst_query_parse_segment (Handle, out rate, out format, out segment_start, out segment_stop);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_buffering (Gst.Format format);
public static Query NewBuffering (Gst.Format format) {
@ -275,7 +275,7 @@ public static Query NewBuffering (Gst.Format format) {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_buffering_percent (IntPtr query, bool busy, int percent);
public void SetBufferingPercent (bool busy, int percent) {
@ -287,7 +287,7 @@ public void SetBufferingPercent (bool busy, int percent) {
gst_query_set_buffering_percent (Handle, busy, percent);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_buffering_percent (IntPtr query, out bool busy, out int percent);
public void ParseBufferingPercent (out bool busy, out int percent) {
@ -297,7 +297,7 @@ public void ParseBufferingPercent (out bool busy, out int percent) {
gst_query_parse_buffering_percent (Handle, out busy, out percent);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_buffering_stats (IntPtr query, Gst.BufferingMode mode, int avg_in, int avg_out, long buffering_left);
public void SetBufferingStats (Gst.BufferingMode mode, int avg_in, int avg_out, long buffering_left) {
@ -309,7 +309,7 @@ public void SetBufferingStats (Gst.BufferingMode mode, int avg_in, int avg_out,
gst_query_set_buffering_stats (Handle, mode, avg_in, avg_out, buffering_left);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_buffering_stats (IntPtr query, out Gst.BufferingMode mode, out int avg_in, out int avg_out, out long buffering_left);
public void ParseBufferingStats (out Gst.BufferingMode mode, out int avg_in, out int avg_out, out long buffering_left) {
@ -319,7 +319,7 @@ public void ParseBufferingStats (out Gst.BufferingMode mode, out int avg_in, out
gst_query_parse_buffering_stats (Handle, out mode, out avg_in, out avg_out, out buffering_left);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_buffering_range (IntPtr query, Gst.Format format, long start, long stop, long estimated_total);
public void SetBufferingRange (Gst.Format format, long start, long stop, long estimated_total) {
@ -331,7 +331,7 @@ public void SetBufferingRange (Gst.Format format, long start, long stop, long es
gst_query_set_buffering_range (Handle, format, start, stop, estimated_total);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_buffering_range (IntPtr query, out Gst.Format format, out long start, out long stop, out long estimated_total);
public void ParseBufferingRange (out Gst.Format format, out long start, out long stop, out long estimated_total) {
@ -341,7 +341,7 @@ public void ParseBufferingRange (out Gst.Format format, out long start, out long
gst_query_parse_buffering_range (Handle, out format, out start, out stop, out estimated_total);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_query_new_uri ();
public static Query NewUri() {
@ -350,7 +350,7 @@ public static Query NewUri() {
return query;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_set_uri (IntPtr query, IntPtr uri);
public void SetUri (string uri) {
@ -364,7 +364,7 @@ public void SetUri (string uri) {
Gst.GLib.Marshaller.Free (raw_string);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_query_parse_uri (IntPtr query, out IntPtr uri);
public void ParseUri (out string uri) {

View file

@ -1,6 +1,6 @@
internal bool FreeNative = true;
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_structure_free (IntPtr raw);
protected override void Free (IntPtr raw) {
@ -30,10 +30,10 @@ class FinalizerInfo {
Gst.GLib.Timeout.Add (50, new Gst.GLib.TimeoutHandler (info.Handler));
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_structure_get_name (IntPtr raw);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_structure_set_name (IntPtr raw, IntPtr name);
public string Name {
@ -41,8 +41,7 @@ public string Name {
IntPtr raw_ret = gst_structure_get_name (Handle);
string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret);
return ret;
}
set {
} set {
if (!IsMutable)
throw new ApplicationException ();
@ -52,7 +51,7 @@ public string Name {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_structure_set_value (IntPtr raw, IntPtr fieldname, IntPtr value);
public void SetValue (string fieldname, Gst.GLib.Value value) {
@ -67,7 +66,7 @@ public void SetValue (string fieldname, Gst.GLib.Value value) {
Marshal.FreeHGlobal (native_value);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_structure_fixate_field_boolean (IntPtr raw, IntPtr field_name, bool target);
public bool FixateFieldBoolean (string field_name, bool target) {
@ -81,7 +80,7 @@ public bool FixateFieldBoolean (string field_name, bool target) {
return ret;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_structure_remove_all_fields (IntPtr raw);
public void RemoveAllFields() {
@ -91,7 +90,7 @@ public void RemoveAllFields() {
gst_structure_remove_all_fields (Handle);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_structure_remove_field (IntPtr raw, IntPtr fieldname);
public void RemoveField (string fieldname) {
@ -103,7 +102,7 @@ public void RemoveField (string fieldname) {
Gst.GLib.Marshaller.Free (native_fieldname);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_structure_fixate_field_nearest_double (IntPtr raw, IntPtr field_name, double target);
public bool FixateFieldNearestDouble (string field_name, double target) {
@ -117,7 +116,7 @@ public bool FixateFieldNearestDouble (string field_name, double target) {
return ret;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_structure_fixate_field_nearest_int (IntPtr raw, IntPtr field_name, int target);
public bool FixateFieldNearestInt (string field_name, int target) {
@ -131,7 +130,7 @@ public bool FixateFieldNearestInt (string field_name, int target) {
return ret;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_structure_fixate_field_nearest_fraction (IntPtr raw, IntPtr field_name, int target_numerator, int target_denominator);
public bool FixateFieldNearestFraction (string field_name, int target_numerator, int target_denominator) {
@ -212,7 +211,7 @@ public static Structure FromString (string structure) {
return ret;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_structure_from_string (IntPtr structure, IntPtr end);
public bool FixateFieldNearestFraction (string field_name, Fraction target) {

View file

@ -1,4 +1,4 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_structure_to_string (IntPtr handle);
public override string ToString () {
@ -7,7 +7,7 @@ public override string ToString () {
return ret;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern int gst_structure_n_fields (IntPtr raw);
public int Size {
@ -18,9 +18,9 @@ public int Size {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_tag_list_copy_value (ref Gst.GLib.Value dest, IntPtr list, IntPtr tag);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_tag_list_get_value_index (IntPtr raw, IntPtr tag, uint index);
public object this[string tag, uint index] {
@ -83,7 +83,7 @@ public void Add (Gst.TagMergeMode mode, params object[] parameters) {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_structure_nth_field_name (IntPtr raw, uint index);
private string NthFieldName (uint index) {
@ -102,7 +102,7 @@ public string[] Tags {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_structure_get_value (IntPtr raw, IntPtr fieldname);
public Gst.List GetTag (string tag) {

View file

@ -12,7 +12,7 @@ public Gst.Fraction Framerate {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_set_fraction (IntPtr v, int numerator, int denominator);
public TunerNorm (string label, Gst.Fraction framerate) {

View file

@ -1,4 +1,4 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern IntPtr gst_type_find_peek (IntPtr raw, long offset, uint size);
public byte[] Peek (long offset, uint size) {

View file

@ -1,4 +1,4 @@
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_type_find_register (IntPtr plugin, IntPtr name, uint rank, GstSharp.TypeFindFunctionNative func, IntPtr[] extensions, IntPtr possible_caps, IntPtr data, IntPtr data_notify);
public static bool Register (Gst.Plugin plugin, string name, uint rank, Gst.TypeFindFunction func, string[] extensions, Gst.Caps possible_caps) {

View file

@ -114,13 +114,13 @@ namespace Gst {
return new Fraction (a.Numerator * b.Denominator, a.Denominator * b.Numerator);
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_set_fraction (ref Gst.GLib.Value v, int numerator, int denominator);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern int gst_value_get_fraction_numerator (ref Gst.GLib.Value v);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern int gst_value_get_fraction_denominator (ref Gst.GLib.Value v);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_fraction_get_type ();
}
@ -162,13 +162,13 @@ namespace Gst {
return val;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_double_range_get_type ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_set_double_range (ref Gst.GLib.Value v, double min, double max);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern double gst_value_get_double_range_min (ref Gst.GLib.Value v);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern double gst_value_get_double_range_max (ref Gst.GLib.Value v);
}
@ -210,13 +210,13 @@ namespace Gst {
return val;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_int_range_get_type ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_set_int_range (ref Gst.GLib.Value v, int min, int max);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern int gst_value_get_int_range_min (ref Gst.GLib.Value v);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern int gst_value_get_int_range_max (ref Gst.GLib.Value v);
}
@ -276,13 +276,13 @@ namespace Gst {
return val;
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_fraction_range_get_type ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_set_fraction_range (ref Gst.GLib.Value v, ref Gst.GLib.Value min, ref Gst.GLib.Value max);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_value_get_fraction_range_min (ref Gst.GLib.Value v);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_value_get_fraction_range_max (ref Gst.GLib.Value v);
}
@ -352,11 +352,11 @@ namespace Gst {
return fourcc.ToString ();
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_fourcc_get_type ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_set_fourcc (ref Gst.GLib.Value v, uint fourcc);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern uint gst_value_get_fourcc (ref Gst.GLib.Value v);
}
@ -433,11 +433,11 @@ namespace Gst {
[DllImport ("libglib-2.0-0.dll") ]
private static extern void g_date_free (IntPtr date);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_date_get_type ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_value_get_date (ref Gst.GLib.Value val);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_set_date (ref Gst.GLib.Value val, IntPtr date);
}
@ -512,13 +512,13 @@ namespace Gst {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_value_list_get_type ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern uint gst_value_list_get_size (ref Gst.GLib.Value val);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_value_list_get_value (ref Gst.GLib.Value val, uint index);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_list_append_value (ref Gst.GLib.Value val, ref Gst.GLib.Value el);
}
@ -593,13 +593,13 @@ namespace Gst {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_value_array_get_type ();
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern uint gst_value_array_get_size (ref Gst.GLib.Value val);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_value_array_get_value (ref Gst.GLib.Value val, uint index);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_value_array_append_value (ref Gst.GLib.Value val, ref Gst.GLib.Value el);
}
}

View file

@ -57,10 +57,10 @@ namespace Gst {
}
}
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern void gst_version (out uint major, out uint minor, out uint micro, out uint nano);
[DllImport("libgstreamer-0.10.dll") ]
[DllImport ("libgstreamer-0.10.dll") ]
private static extern IntPtr gst_version_string();
}
}

View file

@ -52,8 +52,7 @@ public class StreamInfo : Gst.GLib.Object {
bool ret = (bool) val;
val.Dispose ();
return ret;
}
set {
} set {
Gst.GLib.Value val = new Gst.GLib.Value (this, "mute");
val.Val = value;
SetProperty ("mute", val);

View file

@ -2,7 +2,8 @@
#include <gst/base/gstadapter.h>
GstBuffer *
gstsharp_gst_adapter_peek_buffer (GstAdapter *adapter, guint size) {
gstsharp_gst_adapter_peek_buffer (GstAdapter * adapter, guint size)
{
GstBuffer *ret = gst_buffer_try_new_and_alloc (size);
if (ret == NULL)

View file

@ -1,22 +1,25 @@
#include <gst/gst.h>
guint
gstsharp_gst_clock_get_entries_changed_offset (void) {
gstsharp_gst_clock_get_entries_changed_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, entries_changed);
}
guint
gstsharp_gst_clock_get_slave_lock_offset (void) {
gstsharp_gst_clock_get_slave_lock_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, slave_lock);
}
guint
gstsharp_gst_clock_get_entries_offset (void) {
gstsharp_gst_clock_get_entries_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, entries);
}
guint
gstsharp_gst_clock_get_times_offset (void) {
gstsharp_gst_clock_get_times_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstClock, times);
}

View file

@ -3,12 +3,11 @@
guint
gst__controllersharp_gst__controller_controller_get_properties_offset (void)
{
return (guint)G_STRUCT_OFFSET (GstController, properties);
return (guint) G_STRUCT_OFFSET (GstController, properties);
}
guint
gst__controllersharp_gst__controller_controller_get_object_offset (void)
{
return (guint)G_STRUCT_OFFSET (GstController, object);
return (guint) G_STRUCT_OFFSET (GstController, object);
}

View file

@ -4,40 +4,43 @@
guint
gst__controllersharp_gst__controller_controlsource_get_get_value_offset (void)
{
return (guint)G_STRUCT_OFFSET (GstControlSource, get_value);
return (guint) G_STRUCT_OFFSET (GstControlSource, get_value);
}
const gchar *__gtype_prefix = "__gtksharp_";
#define HAS_PREFIX(a) (*((guint64 *)(a)) == *((guint64 *) __gtype_prefix))
static GObjectClass *
get_threshold_class (GObject *obj)
get_threshold_class (GObject * obj)
{
GObjectClass *klass;
GType gtype = G_TYPE_FROM_INSTANCE (obj);
GObjectClass *klass;
GType gtype = G_TYPE_FROM_INSTANCE (obj);
while (HAS_PREFIX (g_type_name (gtype)))
gtype = g_type_parent (gtype);
klass = g_type_class_peek (gtype);
if (klass == NULL) klass = g_type_class_ref (gtype);
return klass;
while (HAS_PREFIX (g_type_name (gtype)))
gtype = g_type_parent (gtype);
klass = g_type_class_peek (gtype);
if (klass == NULL)
klass = g_type_class_ref (gtype);
return klass;
}
gboolean
gst__controllersharp_gst__controller_controlsource_base_bind (GstControlSource *csource, GParamSpec *pspec)
gboolean
gst__controllersharp_gst__controller_controlsource_base_bind (GstControlSource *
csource, GParamSpec * pspec)
{
GstControlSourceClass *parent = (GstControlSourceClass *) get_threshold_class (G_OBJECT (csource));
if (parent->bind)
return parent->bind (csource, pspec);
return FALSE;
GstControlSourceClass *parent =
(GstControlSourceClass *) get_threshold_class (G_OBJECT (csource));
if (parent->bind)
return parent->bind (csource, pspec);
return FALSE;
}
void
gst__controllersharp_gst__controller_controlsource_override_bind (GType gtype, gpointer cb)
void
gst__controllersharp_gst__controller_controlsource_override_bind (GType gtype,
gpointer cb)
{
GstControlSourceClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((GstControlSourceClass *) klass)->bind = cb;
GstControlSourceClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((GstControlSourceClass *) klass)->bind = cb;
}

View file

@ -27,7 +27,5 @@ gboolean gstglibsharp_g_thread_supported (void);
gboolean
gstglibsharp_g_thread_supported ()
{
return g_thread_supported ();
return g_thread_supported ();
}

View file

@ -2,27 +2,31 @@
#include <gst/interfaces/mixertrack.h>
guint
gst__interfacessharp_gst__interfaces_mixertrack_get_label_offset (void) {
gst__interfacessharp_gst__interfaces_mixertrack_get_label_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, label);
}
guint
gst__interfacessharp_gst__interfaces_mixertrack_get_flags_offset (void) {
gst__interfacessharp_gst__interfaces_mixertrack_get_flags_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, flags);
}
guint
gst__interfacessharp_gst__interfaces_mixertrack_get_num_channels_offset (void) {
gst__interfacessharp_gst__interfaces_mixertrack_get_num_channels_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, num_channels);
}
guint
gst__interfacessharp_gst__interfaces_mixertrack_get_min_volume_offset (void) {
gst__interfacessharp_gst__interfaces_mixertrack_get_min_volume_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, min_volume);
}
guint
gst__interfacessharp_gst__interfaces_mixertrack_get_max_volume_offset (void) {
gst__interfacessharp_gst__interfaces_mixertrack_get_max_volume_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstMixerTrack, max_volume);
}

View file

@ -5,4 +5,3 @@ gstsharp_gst_task_get_cond_offset (void)
{
return (guint) G_STRUCT_OFFSET (GstTask, cond);
}

View file

@ -3,6 +3,5 @@
guint
gst__interfacessharp_gst__interfaces_tunernorm_get_framerate_offset (void)
{
return (guint)G_STRUCT_OFFSET (GstTunerNorm, framerate);
return (guint) G_STRUCT_OFFSET (GstTunerNorm, framerate);
}

View file

@ -14,95 +14,89 @@ using GLib;
using Gst;
using Cairo;
public class AppSrcDemo
{
static MainLoop loop;
static Gst.App.AppSrc appsrc;
static Pipeline pipeline;
public class AppSrcDemo {
static MainLoop loop;
static Gst.App.AppSrc appsrc;
static Pipeline pipeline;
public static void Main (string[] args)
{
Application.Init();
loop = new MainLoop();
public static void Main (string[] args) {
Application.Init();
loop = new MainLoop();
// Construct all the elements
pipeline = new Pipeline();
appsrc = new Gst.App.AppSrc("AppSrcDemo");
Element color = ElementFactory.Make("ffmpegcolorspace");
Element sink = ElementFactory.Make("autovideosink");
// Construct all the elements
pipeline = new Pipeline();
appsrc = new Gst.App.AppSrc ("AppSrcDemo");
Element color = ElementFactory.Make ("ffmpegcolorspace");
Element sink = ElementFactory.Make ("autovideosink");
// Link the elements
pipeline.Add(appsrc, color, sink);
Element.Link(appsrc, color, sink);
// Link the elements
pipeline.Add (appsrc, color, sink);
Element.Link (appsrc, color, sink);
// Set the caps on the AppSrc to RGBA, 640x480, 4 fps, square pixels
Gst.Video.VideoFormat fmt = (BitConverter.IsLittleEndian) ? Gst.Video.VideoFormat.BGRA : Gst.Video.VideoFormat.ARGB;
appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps(fmt, 640, 480, 4, 1, 1, 1);
// Set the caps on the AppSrc to RGBA, 640x480, 4 fps, square pixels
Gst.Video.VideoFormat fmt = (BitConverter.IsLittleEndian) ? Gst.Video.VideoFormat.BGRA : Gst.Video.VideoFormat.ARGB;
appsrc.Caps = Gst.Video.VideoUtil.FormatNewCaps (fmt, 640, 480, 4, 1, 1, 1);
// Connect the handlers
appsrc.NeedData += PushAppData;
pipeline.Bus.AddSignalWatch();
pipeline.Bus.Message += MessageHandler;
// Connect the handlers
appsrc.NeedData += PushAppData;
pipeline.Bus.AddSignalWatch();
pipeline.Bus.Message += MessageHandler;
// Run, loop, run!
pipeline.SetState(State.Playing);
loop.Run();
pipeline.SetState(State.Null);
}
// Run, loop, run!
pipeline.SetState (State.Playing);
loop.Run();
pipeline.SetState (State.Null);
}
static void PushAppData(object o, Gst.App.NeedDataArgs args)
{
ulong mseconds = 0;
if (appsrc.Clock != null)
mseconds = appsrc.Clock.Time / Clock.MSecond;
byte[] data = DrawData(mseconds);
static void PushAppData (object o, Gst.App.NeedDataArgs args) {
ulong mseconds = 0;
if (appsrc.Clock != null)
mseconds = appsrc.Clock.Time / Clock.MSecond;
byte[] data = DrawData (mseconds);
Gst.Buffer buffer = new Gst.Buffer(data);
appsrc.PushBuffer(buffer);
}
Gst.Buffer buffer = new Gst.Buffer (data);
appsrc.PushBuffer (buffer);
}
// Returns a byte[] presentation of one 640x480 BGRA frame using Cairo
static byte[] DrawData(ulong seconds)
{
Cairo.ImageSurface img = new Cairo.ImageSurface(Cairo.Format.Argb32, 640, 480);
using(Cairo.Context context = new Cairo.Context(img))
{
double dx = (double) (seconds % 2180) / 5;
context.Color = new Color(1.0, 1.0, 0);
context.Paint();
context.MoveTo(300, 10 + dx);
context.LineTo(500 - dx, 400);
context.LineWidth = 4.0;
context.Color = new Color(0, 0, 1.0);
context.Stroke();
}
// Returns a byte[] presentation of one 640x480 BGRA frame using Cairo
static byte[] DrawData (ulong seconds) {
Cairo.ImageSurface img = new Cairo.ImageSurface (Cairo.Format.Argb32, 640, 480);
using (Cairo.Context context = new Cairo.Context (img)) {
double dx = (double) (seconds % 2180) / 5;
context.Color = new Color (1.0, 1.0, 0);
context.Paint();
context.MoveTo (300, 10 + dx);
context.LineTo (500 - dx, 400);
context.LineWidth = 4.0;
context.Color = new Color (0, 0, 1.0);
context.Stroke();
}
byte[] data = img.Data;
img.Destroy();
return data;
}
byte[] data = img.Data;
img.Destroy();
return data;
}
static void MessageHandler(object sender, MessageArgs args)
{
Message message = args.Message;
string text = String.Format("Message from {0}: \t{1}", message.Src.Name, message.Type);
switch (message.Type) {
case MessageType.Error:
Enum err;
string msg;
message.ParseError(out err, out msg);
text += String.Format("\t({0})", msg);
break;
case MessageType.StateChanged:
State oldstate, newstate, pending;
message.ParseStateChanged(out oldstate, out newstate, out pending);
text += String.Format("\t\t{0} -> {1} ({2})", oldstate, newstate, pending);
break;
case MessageType.Eos:
loop.Quit();
break;
}
Console.WriteLine(text);
}
static void MessageHandler (object sender, MessageArgs args) {
Message message = args.Message;
string text = String.Format ("Message from {0}: \t{1}", message.Src.Name, message.Type);
switch (message.Type) {
case MessageType.Error:
Enum err;
string msg;
message.ParseError (out err, out msg);
text += String.Format ("\t({0})", msg);
break;
case MessageType.StateChanged:
State oldstate, newstate, pending;
message.ParseStateChanged (out oldstate, out newstate, out pending);
text += String.Format ("\t\t{0} -> {1} ({2})", oldstate, newstate, pending);
break;
case MessageType.Eos:
loop.Quit();
break;
}
Console.WriteLine (text);
}
}

View file

@ -12,188 +12,174 @@ using Gst;
using Gst.CorePlugins;
using Gst.BasePlugins;
public delegate void ErrorHandler(object o, ErrorArgs args);
public delegate void ProgressHandler(object o, ProgressArgs args);
public delegate void ErrorHandler (object o, ErrorArgs args);
public delegate void ProgressHandler (object o, ProgressArgs args);
public class ErrorArgs : EventArgs
{
public string Error;
public class ErrorArgs : EventArgs {
public string Error;
}
public class ProgressArgs : EventArgs
{
public long Duration;
public long Position;
public class ProgressArgs : EventArgs {
public long Duration;
public long Position;
}
public class DecodeBinTranscoder : IDisposable
{
private Pipeline pipeline;
private FileSrc filesrc;
private FileSink filesink;
private Element audioconvert;
private Element encoder;
private DecodeBin decodebin;
private uint progress_timeout;
public event EventHandler Finished;
public event ErrorHandler Error;
public event ProgressHandler Progress;
public DecodeBinTranscoder()
{
ConstructPipeline();
public class DecodeBinTranscoder : IDisposable {
private Pipeline pipeline;
private FileSrc filesrc;
private FileSink filesink;
private Element audioconvert;
private Element encoder;
private DecodeBin decodebin;
private uint progress_timeout;
public event EventHandler Finished;
public event ErrorHandler Error;
public event ProgressHandler Progress;
public DecodeBinTranscoder() {
ConstructPipeline();
}
public void Transcode (string inputFile, string outputFile) {
filesrc.Location = inputFile;
filesink.Location = outputFile;
pipeline.SetState (State.Playing);
progress_timeout = GLib.Timeout.Add (250, OnProgressTimeout);
}
public void Dispose() {
pipeline.Dispose();
}
protected virtual void OnFinished() {
EventHandler handler = Finished;
if (handler != null) {
handler (this, new EventArgs());
}
public void Transcode(string inputFile, string outputFile)
{
filesrc.Location = inputFile;
filesink.Location = outputFile;
pipeline.SetState(State.Playing);
progress_timeout = GLib.Timeout.Add(250, OnProgressTimeout);
}
protected virtual void OnError (string error) {
ErrorHandler handler = Error;
if (handler != null) {
ErrorArgs args = new ErrorArgs();
args.Error = error;
handler (this, args);
}
public void Dispose()
{
pipeline.Dispose();
}
protected virtual void OnProgress (long position, long duration) {
ProgressHandler handler = Progress;
if (handler != null) {
ProgressArgs args = new ProgressArgs();
args.Position = position;
args.Duration = duration;
handler (this, args);
}
protected virtual void OnFinished()
{
EventHandler handler = Finished;
if(handler != null) {
handler(this, new EventArgs());
}
}
protected virtual void OnError(string error)
{
ErrorHandler handler = Error;
if(handler != null) {
ErrorArgs args = new ErrorArgs();
args.Error = error;
handler(this, args);
}
}
protected virtual void OnProgress(long position, long duration)
{
ProgressHandler handler = Progress;
if(handler != null) {
ProgressArgs args = new ProgressArgs();
args.Position = position;
args.Duration = duration;
handler(this, args);
}
}
private void ConstructPipeline() {
pipeline = new Pipeline ("pipeline");
filesrc = ElementFactory.Make ("filesrc", "filesrc") as FileSrc;
filesink = ElementFactory.Make ("filesink", "filesink") as FileSink;
audioconvert = ElementFactory.Make ("audioconvert", "audioconvert");
encoder = ElementFactory.Make ("wavenc", "wavenc");
decodebin = ElementFactory.Make ("decodebin", "decodebin") as DecodeBin;
decodebin.NewDecodedPad += OnNewDecodedPad;
pipeline.Add (filesrc, decodebin, audioconvert, encoder, filesink);
filesrc.Link (decodebin);
audioconvert.Link (encoder);
encoder.Link (filesink);
pipeline.Bus.AddWatch (new BusFunc (OnBusMessage));
}
private void OnNewDecodedPad (object o, DecodeBin.NewDecodedPadArgs args) {
Pad sinkpad = audioconvert.GetStaticPad ("sink");
if (sinkpad.IsLinked) {
return;
}
private void ConstructPipeline()
{
pipeline = new Pipeline("pipeline");
filesrc = ElementFactory.Make("filesrc", "filesrc") as FileSrc;
filesink = ElementFactory.Make("filesink", "filesink") as FileSink;
audioconvert = ElementFactory.Make("audioconvert", "audioconvert");
encoder = ElementFactory.Make("wavenc", "wavenc");
decodebin = ElementFactory.Make("decodebin", "decodebin") as DecodeBin;
decodebin.NewDecodedPad += OnNewDecodedPad;
pipeline.Add (filesrc, decodebin, audioconvert, encoder, filesink);
filesrc.Link(decodebin);
audioconvert.Link(encoder);
encoder.Link(filesink);
pipeline.Bus.AddWatch(new BusFunc(OnBusMessage));
}
private void OnNewDecodedPad(object o, DecodeBin.NewDecodedPadArgs args)
{
Pad sinkpad = audioconvert.GetStaticPad("sink");
Caps caps = args.Pad.Caps;
Structure structure = caps[0];
if(sinkpad.IsLinked) {
return;
}
if (!structure.Name.StartsWith ("audio")) {
return;
}
Caps caps = args.Pad.Caps;
Structure structure = caps[0];
if(!structure.Name.StartsWith("audio")) {
return;
}
args.Pad.Link(sinkpad);
}
private bool OnBusMessage(Bus bus, Message message)
{
switch(message.Type) {
case MessageType.Error:
string msg;
Enum err;
message.ParseError(out err, out msg);
GLib.Source.Remove(progress_timeout);
OnError(msg);
break;
case MessageType.Eos:
pipeline.SetState(State.Null);
GLib.Source.Remove(progress_timeout);
OnFinished();
break;
}
args.Pad.Link (sinkpad);
}
return true;
private bool OnBusMessage (Bus bus, Message message) {
switch (message.Type) {
case MessageType.Error:
string msg;
Enum err;
message.ParseError (out err, out msg);
GLib.Source.Remove (progress_timeout);
OnError (msg);
break;
case MessageType.Eos:
pipeline.SetState (State.Null);
GLib.Source.Remove (progress_timeout);
OnFinished();
break;
}
private bool OnProgressTimeout()
{
long duration, position;
Gst.Format fmt = Gst.Format.Time;
if(pipeline.QueryDuration(ref fmt, out duration) && fmt == Gst.Format.Time && encoder.QueryPosition(ref fmt, out position) && fmt == Gst.Format.Time) {
OnProgress(position, duration);
}
return true;
return true;
}
private bool OnProgressTimeout() {
long duration, position;
Gst.Format fmt = Gst.Format.Time;
if (pipeline.QueryDuration (ref fmt, out duration) && fmt == Gst.Format.Time && encoder.QueryPosition (ref fmt, out position) && fmt == Gst.Format.Time) {
OnProgress (position, duration);
}
private static GLib.MainLoop loop;
public static void Main(string [] args)
{
if(args.Length < 2) {
Console.WriteLine("Usage: mono decodebin-transcoder.exe <input-file> <output-file>");
return;
}
Gst.Application.Init();
loop = new GLib.MainLoop();
DecodeBinTranscoder transcoder = new DecodeBinTranscoder();
transcoder.Error += delegate(object o, ErrorArgs eargs) {
Console.WriteLine("Error: {0}", eargs.Error);
transcoder.Dispose();
loop.Quit();
};
transcoder.Finished += delegate {
Console.WriteLine("\nFinished");
transcoder.Dispose();
loop.Quit();
};
transcoder.Progress += delegate(object o, ProgressArgs pargs) {
Console.Write("\rEncoding: {0} / {1} ({2:00.00}%) ",
new TimeSpan((pargs.Position / (long) Clock.Second) * TimeSpan.TicksPerSecond),
new TimeSpan((pargs.Duration / (long) Clock.Second) * TimeSpan.TicksPerSecond),
((double)pargs.Position / (double)pargs.Duration) * 100.0);
};
transcoder.Transcode(args[0], args[1]);
loop.Run();
return true;
}
private static GLib.MainLoop loop;
public static void Main (string [] args) {
if (args.Length < 2) {
Console.WriteLine ("Usage: mono decodebin-transcoder.exe <input-file> <output-file>");
return;
}
Gst.Application.Init();
loop = new GLib.MainLoop();
DecodeBinTranscoder transcoder = new DecodeBinTranscoder();
transcoder.Error += delegate (object o, ErrorArgs eargs) {
Console.WriteLine ("Error: {0}", eargs.Error);
transcoder.Dispose();
loop.Quit();
};
transcoder.Finished += delegate {
Console.WriteLine ("\nFinished");
transcoder.Dispose();
loop.Quit();
};
transcoder.Progress += delegate (object o, ProgressArgs pargs) {
Console.Write ("\rEncoding: {0} / {1} ({2:00.00}%) ",
new TimeSpan ( (pargs.Position / (long) Clock.Second) * TimeSpan.TicksPerSecond),
new TimeSpan ( (pargs.Duration / (long) Clock.Second) * TimeSpan.TicksPerSecond),
( (double) pargs.Position / (double) pargs.Duration) * 100.0);
};
transcoder.Transcode (args[0], args[1]);
loop.Run();
}
}

View file

@ -2,101 +2,95 @@ using System;
using Gst;
using GLib;
public class HelloWorld
{
private MainLoop loop;
private Element pipeline, source, parser, decoder, conv, identity, sink;
public static void Main(string [] args)
{
new HelloWorld(args);
public class HelloWorld {
private MainLoop loop;
private Element pipeline, source, parser, decoder, conv, identity, sink;
public static void Main (string [] args) {
new HelloWorld (args);
}
public HelloWorld (string [] args) {
Application.Init();
loop = new MainLoop();
pipeline = new Pipeline ("audio-player");
if ( (source = ElementFactory.Make ("filesrc", "file-source")) == null) {
Console.WriteLine ("Could not create file-source");
}
public HelloWorld(string [] args)
{
Application.Init();
parser = ElementFactory.Make ("oggdemux", "ogg-parser");
decoder = ElementFactory.Make ("vorbisdec", "vorbis-decoder");
conv = ElementFactory.Make ("audioconvert", "converter");
identity = ElementFactory.Make ("identity", "identitye");
sink = ElementFactory.Make ("alsasink", "alsa-output");
loop = new MainLoop();
pipeline = new Pipeline("audio-player");
if((source = ElementFactory.Make("filesrc", "file-source")) == null) {
Console.WriteLine("Could not create file-source");
}
parser = ElementFactory.Make("oggdemux", "ogg-parser");
decoder = ElementFactory.Make("vorbisdec", "vorbis-decoder");
conv = ElementFactory.Make("audioconvert", "converter");
identity = ElementFactory.Make("identity", "identitye");
sink = ElementFactory.Make("alsasink", "alsa-output");
source["location"] = args[0];
Bin bin = (Bin) pipeline;
bin.Bus.AddWatch(new BusFunc(BusCall));
source["location"] = args[0];
bin.Add (source, parser, decoder, conv, identity, sink);
Bin bin = (Bin) pipeline;
bin.Bus.AddWatch (new BusFunc (BusCall));
if(!source.Link(parser)) {
Console.WriteLine("link failed between source and parser");
}
if(!decoder.Link(conv)) {
Console.WriteLine("link failed between decoder and converter");
}
if(!conv.Link(identity)) {
Console.WriteLine("link failed between converter and identity");
}
if(!identity.Link(sink)) {
Console.Error.WriteLine("link failed between identity and sink");
}
parser.PadAdded += new PadAddedHandler(OnPadAdded);
identity.Connect("handoff", OnHandoff);
bin.Add (source, parser, decoder, conv, identity, sink);
pipeline.SetState(State.Playing);
Console.WriteLine("Playing [" + args[0] + "]");
loop.Run();
pipeline.SetState(State.Null);
pipeline.Dispose();
if (!source.Link (parser)) {
Console.WriteLine ("link failed between source and parser");
}
private bool BusCall(Bus bus, Message message)
{
switch(message.Type) {
case MessageType.Error:
string msg;
Enum err;
message.ParseError(out err, out msg);
Console.WriteLine ("Gstreamer error: {0}", msg);
loop.Quit();
break;
case MessageType.Eos:
Console.WriteLine("End-of-stream");
loop.Quit();
break;
default:
Console.WriteLine("Entered BusCall:\t{0}", message.Type);
break;
}
return true;
if (!decoder.Link (conv)) {
Console.WriteLine ("link failed between decoder and converter");
}
private void OnHandoff(object o, Gst.GLib.SignalArgs args)
{
Gst.Buffer buffer = args.Args[0] as Gst.Buffer;
Console.WriteLine(buffer.Duration + "\t" + buffer.Timestamp);
if (!conv.Link (identity)) {
Console.WriteLine ("link failed between converter and identity");
}
void OnPadAdded(object o, PadAddedArgs args)
{
Console.WriteLine("Entered OnPadAdded");
Pad sinkpad = decoder.GetStaticPad("sink");
args.Pad.Link(sinkpad);
if (!identity.Link (sink)) {
Console.Error.WriteLine ("link failed between identity and sink");
}
parser.PadAdded += new PadAddedHandler (OnPadAdded);
identity.Connect ("handoff", OnHandoff);
pipeline.SetState (State.Playing);
Console.WriteLine ("Playing [" + args[0] + "]");
loop.Run();
pipeline.SetState (State.Null);
pipeline.Dispose();
}
private bool BusCall (Bus bus, Message message) {
switch (message.Type) {
case MessageType.Error:
string msg;
Enum err;
message.ParseError (out err, out msg);
Console.WriteLine ("Gstreamer error: {0}", msg);
loop.Quit();
break;
case MessageType.Eos:
Console.WriteLine ("End-of-stream");
loop.Quit();
break;
default:
Console.WriteLine ("Entered BusCall:\t{0}", message.Type);
break;
}
return true;
}
private void OnHandoff (object o, Gst.GLib.SignalArgs args) {
Gst.Buffer buffer = args.Args[0] as Gst.Buffer;
Console.WriteLine (buffer.Duration + "\t" + buffer.Timestamp);
}
void OnPadAdded (object o, PadAddedArgs args) {
Console.WriteLine ("Entered OnPadAdded");
Pad sinkpad = decoder.GetStaticPad ("sink");
args.Pad.Link (sinkpad);
}
}

View file

@ -9,62 +9,58 @@ using System;
using Gst;
public class MP3LaunchParse
{
static void EventLoop (Element pipe)
{
Bus bus = pipe.Bus;
Message message = null;
public class MP3LaunchParse {
static void EventLoop (Element pipe) {
Bus bus = pipe.Bus;
Message message = null;
while(true) {
message = bus.Poll(MessageType.Any, -1);
while (true) {
message = bus.Poll (MessageType.Any, -1);
if(message == null) {
Console.Error.WriteLine("Message is null!!!");
System.Application.Exit();
}
if (message == null) {
Console.Error.WriteLine ("Message is null!!!");
System.Application.Exit();
}
switch(message.Type)
{
case MessageType.Eos:
message.Dispose();
return;
case MessageType.Warning:
case MessageType.Error:
message.Dispose();
return;
default:
message.Dispose();
break;
}
}
}
switch (message.Type) {
case MessageType.Eos:
message.Dispose();
return;
case MessageType.Warning:
case MessageType.Error:
message.Dispose();
return;
default:
message.Dispose();
break;
}
}
}
public static void Main(string [] args)
{
Application.Init();
public static void Main (string [] args) {
Application.Init();
if(args.Length != 1) {
Console.Error.WriteLine("usage: mono mp3launchparse.exe <mp3 file>\n", args[0]);
return;
}
if (args.Length != 1) {
Console.Error.WriteLine ("usage: mono mp3launchparse.exe <mp3 file>\n", args[0]);
return;
}
Element bin = (Element) Parse.Launch("filesrc name=my_filesrc ! mad ! osssink", &error);
if(!bin) {
Console.Error.WriteLine("Parse error");
Application.Exit();
}
Element bin = (Element) Parse.Launch ("filesrc name=my_filesrc ! mad ! osssink", &error);
if (!bin) {
Console.Error.WriteLine ("Parse error");
Application.Exit();
}
Bin b = (Bin) bin;
Bin b = (Bin) bin;
Element filesrc = b.GetByName("my_filesrc");
filesrc.SetProperty("location", args[0]);
Element filesrc = b.GetByName ("my_filesrc");
filesrc.SetProperty ("location", args[0]);
bin.SetState(State.Playing);
bin.SetState (State.Playing);
EventLoop(bin);
bin.SetState(State.Null);
return;
}
EventLoop (bin);
bin.SetState (State.Null);
return;
}
}

View file

@ -55,7 +55,7 @@ public class MetaData {
return true;
case MessageType.Tag:
Pad pad;
Pad pad;
TagList new_tags;
message.ParseTag (out pad, out new_tags);

View file

@ -3,62 +3,59 @@ using GLib;
using Gst;
using Gst.BasePlugins;
public class PlayBinPlayer
{
private static MainLoop loop;
private static string[] songs;
private static int song_idx = 0;
private static PlayBin play;
public class PlayBinPlayer {
private static MainLoop loop;
private static string[] songs;
private static int song_idx = 0;
private static PlayBin play;
public static void Main (string[] args)
{
if (args.Length < 1) {
Console.WriteLine ("usage: mono playbin-player.exe audio_file_uri");
return;
}
songs = args;
Gst.Application.Init ();
loop = new MainLoop ();
play = ElementFactory.Make ("playbin", "play") as PlayBin;
if (play == null) {
Console.WriteLine ("error creating a playbin gstreamer object");
return;
}
play.Uri = songs[song_idx++];
play.Bus.AddWatch (new BusFunc (BusCb));
play.SetState (State.Playing);
loop.Run ();
public static void Main (string[] args) {
if (args.Length < 1) {
Console.WriteLine ("usage: mono playbin-player.exe audio_file_uri");
return;
}
private static bool BusCb (Bus bus, Message message)
{
switch (message.Type) {
case MessageType.Error:
Enum err;
string msg;
message.ParseError (out err, out msg);
Console.WriteLine ("Gstreamer error: {0}", msg);
loop.Quit ();
break;
case MessageType.Eos:
if (song_idx >= songs.Length) {
Console.WriteLine ("Thank you, come again");
loop.Quit ();
} else {
play.SetState (State.Null);
play.Uri = songs[song_idx++];
play.SetState (State.Playing);
}
break;
}
songs = args;
return true;
Gst.Application.Init ();
loop = new MainLoop ();
play = ElementFactory.Make ("playbin", "play") as PlayBin;
if (play == null) {
Console.WriteLine ("error creating a playbin gstreamer object");
return;
}
play.Uri = songs[song_idx++];
play.Bus.AddWatch (new BusFunc (BusCb));
play.SetState (State.Playing);
loop.Run ();
}
private static bool BusCb (Bus bus, Message message) {
switch (message.Type) {
case MessageType.Error:
Enum err;
string msg;
message.ParseError (out err, out msg);
Console.WriteLine ("Gstreamer error: {0}", msg);
loop.Quit ();
break;
case MessageType.Eos:
if (song_idx >= songs.Length) {
Console.WriteLine ("Thank you, come again");
loop.Quit ();
} else {
play.SetState (State.Null);
play.Uri = songs[song_idx++];
play.SetState (State.Playing);
}
break;
}
return true;
}
}

View file

@ -8,52 +8,50 @@ using Gst;
using System;
public class QueueExample {
public static void Main(string [] args)
{
Application.Init();
if(args.Length != 1) {
Console.Error.WriteLine("usage: mono queueexample.exe <filename>\n");
return;
}
public static void Main (string [] args) {
Application.Init();
Element pipeline = new Pipeline("pipeline");
Element filesrc = ElementFactory.Make("filesrc", "disk_source");
filesrc.SetProperty("location", args[0]);
Element decode = ElementFactory.Make("mad", "decode");
Element queue = ElementFactory.Make("queue", "queue");
if (args.Length != 1) {
Console.Error.WriteLine ("usage: mono queueexample.exe <filename>\n");
return;
}
Element audiosink = ElementFactory.Make("alsasink", "play_audio");
Element pipeline = new Pipeline ("pipeline");
Bin bin = (Bin) pipeline;
bin.AddMany(filesrc, decode, queue, audiosink);
Element filesrc = ElementFactory.Make ("filesrc", "disk_source");
filesrc.SetProperty ("location", args[0]);
Element decode = ElementFactory.Make ("mad", "decode");
Element queue = ElementFactory.Make ("queue", "queue");
Element.LinkMany(filesrc, decode, queue, audiosink);
Element audiosink = ElementFactory.Make ("alsasink", "play_audio");
pipeline.SetState(State.Playing);
Bin bin = (Bin) pipeline;
bin.AddMany (filesrc, decode, queue, audiosink);
EventLoop(pipeline);
Element.LinkMany (filesrc, decode, queue, audiosink);
pipeline.SetState(State.Null);
}
pipeline.SetState (State.Playing);
static void EventLoop(Element pipe)
{
Bus bus = pipe.Bus;
EventLoop (pipeline);
while(true) {
Message message = bus.Poll(MessageType.Any, -1);
switch(message.Type) {
case MessageType.Eos: {
message.Dispose();
return;
}
case MessageType.Error: {
return;
}
}
}
}
pipeline.SetState (State.Null);
}
static void EventLoop (Element pipe) {
Bus bus = pipe.Bus;
while (true) {
Message message = bus.Poll (MessageType.Any, -1);
switch (message.Type) {
case MessageType.Eos: {
message.Dispose();
return;
}
case MessageType.Error: {
return;
}
}
}
}
}

View file

@ -2,36 +2,33 @@ using System;
using Gst;
using Gst.CorePlugins;
public static class GstTypefindTest
{
private static TypeFindElement typefind;
public static void Main(string [] args)
{
Application.Init();
Pipeline pipeline = new Pipeline("pipeline");
FileSrc source = FileSrc.Make("source");
typefind = TypeFindElement.Make("typefind");
FakeSink sink = FakeSink.Make("sink");
public static class GstTypefindTest {
private static TypeFindElement typefind;
source.Location = args[0];
typefind.HaveType += OnHaveType;
pipeline.Add (source, typefind, sink);
source.Link(typefind);
typefind.Link(sink);
public static void Main (string [] args) {
Application.Init();
pipeline.SetState(State.Paused);
pipeline.SetState(State.Null);
pipeline.Dispose();
}
private static void OnHaveType(object o, TypeFindElement.HaveTypeArgs args)
{
Console.WriteLine("MimeType: {0}", args.Caps);
}
Pipeline pipeline = new Pipeline ("pipeline");
FileSrc source = FileSrc.Make ("source");
typefind = TypeFindElement.Make ("typefind");
FakeSink sink = FakeSink.Make ("sink");
source.Location = args[0];
typefind.HaveType += OnHaveType;
pipeline.Add (source, typefind, sink);
source.Link (typefind);
typefind.Link (sink);
pipeline.SetState (State.Paused);
pipeline.SetState (State.Null);
pipeline.Dispose();
}
private static void OnHaveType (object o, TypeFindElement.HaveTypeArgs args) {
Console.WriteLine ("MimeType: {0}", args.Caps);
}
}

View file

@ -11,25 +11,21 @@ using System;
using NUnit.Framework;
[TestFixture]
public class ApplicationTest
{
[Test]
public void Init()
{
Gst.Application.Init();
}
public class ApplicationTest {
[Test]
public void Init() {
Gst.Application.Init();
}
[Test]
public void InitArgs()
{
string [] args = { "arg_a", "arg_b" };
Gst.Application.Init("gstreamer-sharp-test", ref args);
}
[Test]
public void InitArgs() {
string [] args = { "arg_a", "arg_b" };
Gst.Application.Init ("gstreamer-sharp-test", ref args);
}
[Test]
public void InitArgsCheck()
{
string [] args = { "arg_a", "arg_b" };
Gst.Application.InitCheck("gstreamer-sharp-test", ref args);
}
[Test]
public void InitArgsCheck() {
string [] args = { "arg_a", "arg_b" };
Gst.Application.InitCheck ("gstreamer-sharp-test", ref args);
}
}

View file

@ -14,136 +14,128 @@ using Gst;
using Gst.CorePlugins;
[TestFixture]
public class BinTest
{
[TestFixtureSetUp]
public void Init()
{
Application.Init();
}
public class BinTest {
[TestFixtureSetUp]
public void Init() {
Application.Init();
}
[Test]
public void TestAdd()
{
Bin bin = new Bin("test-bin");
Element e1 = new FakeSrc("fakesrc");
Element e2 = new FakeSink("fakesink");
[Test]
public void TestAdd() {
Bin bin = new Bin ("test-bin");
Element e1 = new FakeSrc ("fakesrc");
Element e2 = new FakeSink ("fakesink");
Assert.IsNotNull(bin, "Could not create bin");
Assert.IsNotNull(e1, "Could not create fakesrc");
Assert.IsNotNull(e2, "Could not create fakesink");
Assert.IsNotNull (bin, "Could not create bin");
Assert.IsNotNull (e1, "Could not create fakesrc");
Assert.IsNotNull (e2, "Could not create fakesink");
bin.Add(e1, e2);
bin.Add (e1, e2);
Assert.AreEqual(bin.ChildrenCount, 2);
}
Assert.AreEqual (bin.ChildrenCount, 2);
}
[Test]
public void TestAddRemove()
{
Bin bin = ElementFactory.Make("bin") as Bin;
Assert.IsNotNull(bin, "Could not create bin");
[Test]
public void TestAddRemove() {
Bin bin = ElementFactory.Make ("bin") as Bin;
Assert.IsNotNull (bin, "Could not create bin");
Element e1 = new FakeSrc("fakesrc");
Element e2 = new Identity("identity");
Element e3 = new FakeSink("fakesink");
Element e1 = new FakeSrc ("fakesrc");
Element e2 = new Identity ("identity");
Element e3 = new FakeSink ("fakesink");
Assert.IsNotNull(e1, "Could not create fakesrc");
Assert.IsNotNull(e2, "Could not create identity");
Assert.IsNotNull(e3, "Could not create fakesink");
Assert.IsNotNull (e1, "Could not create fakesrc");
Assert.IsNotNull (e2, "Could not create identity");
Assert.IsNotNull (e3, "Could not create fakesink");
bin.Add(e1, e2, e3);
Element.Link(e1, e2, e3);
bin.Add (e1, e2, e3);
Element.Link (e1, e2, e3);
Assert.AreEqual(bin.ChildrenCount, 3);
bin.Remove(e2, e3);
Assert.AreEqual(bin.ChildrenCount, 1);
bin.Add(e2);
Assert.AreEqual(bin.ChildrenCount, 2);
bin.Remove(e1, e2);
Assert.AreEqual(bin.ChildrenCount, 0);
}
Assert.AreEqual (bin.ChildrenCount, 3);
bin.Remove (e2, e3);
Assert.AreEqual (bin.ChildrenCount, 1);
bin.Add (e2);
Assert.AreEqual (bin.ChildrenCount, 2);
bin.Remove (e1, e2);
Assert.AreEqual (bin.ChildrenCount, 0);
}
[Test]
public void TestGetByName()
{
Bin bin = new Bin("test-bin");
Element e1 = ElementFactory.Make("fakesrc", "element-name");
bin.Add(e1);
[Test]
public void TestGetByName() {
Bin bin = new Bin ("test-bin");
Element e1 = ElementFactory.Make ("fakesrc", "element-name");
bin.Add (e1);
e1 = bin.GetByName("element-name");
e1 = bin.GetByName ("element-name");
Assert.IsNotNull(e1);
Assert.AreEqual(e1.Name, "element-name");
}
Assert.IsNotNull (e1);
Assert.AreEqual (e1.Name, "element-name");
}
[Test]
public void TestGetChildByIndex()
{
Bin bin = new Bin("test-bin");
[Test]
public void TestGetChildByIndex() {
Bin bin = new Bin ("test-bin");
Element [] elements = new Element [] {
ElementFactory.Make("fakesrc", "fakesrc"),
ElementFactory.Make("audioconvert", "audioconvert"),
ElementFactory.Make("wavenc", "wavenc"),
ElementFactory.Make("fakesink", "fakesink")
};
Element [] elements = new Element [] {
ElementFactory.Make ("fakesrc", "fakesrc"),
ElementFactory.Make ("audioconvert", "audioconvert"),
ElementFactory.Make ("wavenc", "wavenc"),
ElementFactory.Make ("fakesink", "fakesink")
};
foreach(Element element in elements) {
bin.Add(element);
}
foreach (Element element in elements) {
bin.Add (element);
}
Assert.AreEqual(elements.Length, bin.ChildrenCount);
Assert.AreEqual (elements.Length, bin.ChildrenCount);
for(uint i = 0; i < elements.Length; i++) {
Assert.AreEqual(elements[elements.Length - i - 1], bin.GetChildByIndex(i));
}
}
for (uint i = 0; i < elements.Length; i++) {
Assert.AreEqual (elements[elements.Length - i - 1], bin.GetChildByIndex (i));
}
}
[Test]
public void TestElements()
{
Bin bin = new Bin("test-bin");
[Test]
public void TestElements() {
Bin bin = new Bin ("test-bin");
Element [] elements = new Element [] {
new CapsFilter(),
new MultiQueue(),
new Queue(),
new Tee(),
new TypeFindElement()
};
Element [] elements = new Element [] {
new CapsFilter(),
new MultiQueue(),
new Queue(),
new Tee(),
new TypeFindElement()
};
bin.Add(elements);
CollectionAssert.AreEquivalent(elements, bin.Elements);
CollectionAssert.AreEquivalent(elements, bin.ElementsRecurse);
CollectionAssert.AreEquivalent(elements, bin.ElementsSorted);
}
bin.Add (elements);
CollectionAssert.AreEquivalent (elements, bin.Elements);
CollectionAssert.AreEquivalent (elements, bin.ElementsRecurse);
CollectionAssert.AreEquivalent (elements, bin.ElementsSorted);
}
public class MyBin : Gst.Bin {
public MyBin () : base () {
Element filesrc = ElementFactory.Make("filesrc");
Add(filesrc);
CollectionAssert.IsEmpty(Pads);
public class MyBin : Gst.Bin {
public MyBin () : base () {
Element filesrc = ElementFactory.Make ("filesrc");
Add (filesrc);
CollectionAssert.IsEmpty (Pads);
GhostPad pad1 = new GhostPad("ghost-sink", PadDirection.Sink);
GhostPad pad2 = new GhostPad("ghost-src", new PadTemplate("src-template", PadDirection.Src, PadPresence.Request, Caps.NewAny()));
GhostPad pad1 = new GhostPad ("ghost-sink", PadDirection.Sink);
GhostPad pad2 = new GhostPad ("ghost-src", new PadTemplate ("src-template", PadDirection.Src, PadPresence.Request, Caps.NewAny()));
Assert.IsFalse(pad1.SetTarget(filesrc.GetStaticPad("src")));
Assert.IsTrue(pad2.SetTarget(filesrc.GetStaticPad("src")));
Assert.IsFalse (pad1.SetTarget (filesrc.GetStaticPad ("src")));
Assert.IsTrue (pad2.SetTarget (filesrc.GetStaticPad ("src")));
AddPad(pad1);
AddPad(pad2);
AddPad (pad1);
AddPad (pad2);
CollectionAssert.Contains(Pads, pad1);
CollectionAssert.Contains(Pads, pad2);
CollectionAssert.Contains(SinkPads, pad1);
CollectionAssert.Contains(SrcPads, pad2);
}
}
CollectionAssert.Contains (Pads, pad1);
CollectionAssert.Contains (Pads, pad2);
CollectionAssert.Contains (SinkPads, pad1);
CollectionAssert.Contains (SrcPads, pad2);
}
}
[Test]
public void TestGhostPad()
{
new MyBin ();
}
[Test]
public void TestGhostPad() {
new MyBin ();
}
}

View file

@ -10,75 +10,68 @@ using NUnit.Framework;
using Gst;
[TestFixture]
public class BufferTest
{
[TestFixtureSetUp]
public void Init()
{
Application.Init();
}
public class BufferTest {
[TestFixtureSetUp]
public void Init() {
Application.Init();
}
[Test]
public void TestCaps()
{
Gst.Buffer buffer = new Gst.Buffer(4);
Caps caps = Caps.FromString("audio/x-raw-int");
[Test]
public void TestCaps() {
Gst.Buffer buffer = new Gst.Buffer (4);
Caps caps = Caps.FromString ("audio/x-raw-int");
Assert.IsNull(buffer.Caps, "buffer.Caps should be null");
buffer.Caps = caps;
Assert.IsNotNull(buffer.Caps, "buffer.Caps is null");
Assert.IsNull (buffer.Caps, "buffer.Caps should be null");
buffer.Caps = caps;
Assert.IsNotNull (buffer.Caps, "buffer.Caps is null");
Caps caps2 = Caps.FromString("audio/x-raw-float");
buffer.Caps = caps2;
Assert.AreNotEqual(buffer.Caps, caps);
Assert.AreEqual(buffer.Caps, caps2);
Caps caps2 = Caps.FromString ("audio/x-raw-float");
buffer.Caps = caps2;
Assert.AreNotEqual (buffer.Caps, caps);
Assert.AreEqual (buffer.Caps, caps2);
buffer.Caps = null;
Assert.IsNull(buffer.Caps, "buffer.Caps should be null");
}
buffer.Caps = null;
Assert.IsNull (buffer.Caps, "buffer.Caps should be null");
}
[Test]
public void TestSubbuffer()
{
Gst.Buffer buffer = new Gst.Buffer(4);
Gst.Buffer sub = buffer.CreateSub(1, 2);
Assert.IsNotNull(sub);
Assert.AreEqual(sub.Size, 2, "subbuffer has wrong size");
}
[Test]
public void TestSubbuffer() {
Gst.Buffer buffer = new Gst.Buffer (4);
Gst.Buffer sub = buffer.CreateSub (1, 2);
Assert.IsNotNull (sub);
Assert.AreEqual (sub.Size, 2, "subbuffer has wrong size");
}
[Test]
public void TestIsSpanFast()
{
Gst.Buffer buffer = new Gst.Buffer(4);
[Test]
public void TestIsSpanFast() {
Gst.Buffer buffer = new Gst.Buffer (4);
Gst.Buffer sub1 = buffer.CreateSub(0, 2);
Assert.IsNotNull(sub1, "CreateSub of buffer returned null");
Gst.Buffer sub1 = buffer.CreateSub (0, 2);
Assert.IsNotNull (sub1, "CreateSub of buffer returned null");
Gst.Buffer sub2 = buffer.CreateSub(2, 2);
Assert.IsNotNull(sub2, "CreateSub of buffer returned null");
Gst.Buffer sub2 = buffer.CreateSub (2, 2);
Assert.IsNotNull (sub2, "CreateSub of buffer returned null");
Assert.IsFalse(buffer.IsSpanFast(sub2), "a parent buffer can not be SpanFasted");
Assert.IsFalse(sub1.IsSpanFast(buffer), "a parent buffer can not be SpanFasted");
Assert.IsTrue(sub1.IsSpanFast(sub2), "two subbuffers next to each other should be SpanFast");
}
Assert.IsFalse (buffer.IsSpanFast (sub2), "a parent buffer can not be SpanFasted");
Assert.IsFalse (sub1.IsSpanFast (buffer), "a parent buffer can not be SpanFasted");
Assert.IsTrue (sub1.IsSpanFast (sub2), "two subbuffers next to each other should be SpanFast");
}
private void ArrayIsEqual (byte[] a, byte[] b)
{
Assert.IsTrue (a.Length == b.Length);
for (int i = 0; i < a.Length; i++)
Assert.IsTrue (a[i] == b[i]);
}
private void ArrayIsEqual (byte[] a, byte[] b) {
Assert.IsTrue (a.Length == b.Length);
for (int i = 0; i < a.Length; i++)
Assert.IsTrue (a[i] == b[i]);
}
[Test]
public void TestBufferData()
{
byte[] data = new byte[] {0, 1, 2, 3, 4, 5};
[Test]
public void TestBufferData() {
byte[] data = new byte[] {0, 1, 2, 3, 4, 5};
Gst.Buffer buffer = new Gst.Buffer (data);
Gst.Buffer buffer = new Gst.Buffer (data);
ArrayIsEqual (data, buffer.Data);
for (uint i = 0; i < buffer.Size; i++)
Assert.IsTrue (buffer[i] == data[i]);
ArrayIsEqual (data, buffer.Data);
for (uint i = 0; i < buffer.Size; i++)
Assert.IsTrue (buffer[i] == data[i]);
}
}
}

View file

@ -3,7 +3,7 @@
//
// Authors:
// Michael Dominic K. (michaldominik@gmail.com)
//
//
// (C) 2006 Novell, Inc.
//
@ -12,89 +12,83 @@ using NUnit.Framework;
using Gst;
[TestFixture]
public class CapsTest
{
[TestFixtureSetUp]
public void Init()
{
Application.Init();
}
public class CapsTest {
[TestFixtureSetUp]
public void Init() {
Application.Init();
}
[Test]
public void TestPlainCreation()
{
Caps caps = new Caps();
Assert.IsNotNull(caps);
Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
}
[Test]
public void TestPlainCreation() {
Caps caps = new Caps();
Assert.IsNotNull (caps);
Assert.IsFalse (caps.Handle == IntPtr.Zero, "Ooops, null handle");
}
[Test]
public void TestFromString()
{
Caps caps = Caps.FromString("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)384, " +
"height=(int)288, " +
"framerate=(fraction)25/1");
Assert.IsNotNull(caps);
[Test]
public void TestFromString() {
Caps caps = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)384, " +
"height=(int)288, " +
"framerate=(fraction)25/1");
Assert.IsNotNull (caps);
Assert.IsFalse(caps.Handle == IntPtr.Zero, "Ooops, null handle");
Assert.IsTrue(caps.IsFixed, "Caps should be FIXED!");
Assert.IsFalse(caps.IsEmpty, "Caps shouldn't be EMPTY!");
Assert.IsFalse(caps.IsAny, "Caps shouldn't be ANY!");
}
Assert.IsFalse (caps.Handle == IntPtr.Zero, "Ooops, null handle");
Assert.IsTrue (caps.IsFixed, "Caps should be FIXED!");
Assert.IsFalse (caps.IsEmpty, "Caps shouldn't be EMPTY!");
Assert.IsFalse (caps.IsAny, "Caps shouldn't be ANY!");
}
[Test]
public void TestIntersecting()
{
Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)[ 1,1000 ], " +
"height=(int)[ 1, 1000 ], " +
"framerate=(fraction)[ 0/1, 100/1 ]");
Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)640, " +
"height=(int)480");
Assert.IsNotNull(caps1);
Assert.IsNotNull(caps2);
[Test]
public void TestIntersecting() {
Caps caps1 = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)[ 1,1000 ], " +
"height=(int)[ 1, 1000 ], " +
"framerate=(fraction)[ 0/1, 100/1 ]");
Caps caps2 = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)640, " +
"height=(int)480");
Assert.IsNotNull (caps1);
Assert.IsNotNull (caps2);
Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
Assert.IsFalse (caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
Assert.IsFalse (caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
Caps caps3 = caps1.Intersect(caps2);
Caps caps3 = caps1.Intersect (caps2);
Assert.IsFalse(caps3.IsFixed, "How come caps are FIXED?!");
Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
Assert.IsFalse (caps3.IsFixed, "How come caps are FIXED?!");
Assert.IsFalse (caps3.IsEmpty, "How come caps are EMPTY?!");
Assert.AreEqual(caps2.ToString() + ", framerate=(fraction)[ 0/1, 100/1 ]", caps3.ToString());
}
Assert.AreEqual (caps2.ToString() + ", framerate=(fraction)[ 0/1, 100/1 ]", caps3.ToString());
}
[Test]
public void TestUnion()
{
Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)640");
Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"height=(int)480");
Assert.IsNotNull(caps1);
Assert.IsNotNull(caps2);
[Test]
public void TestUnion() {
Caps caps1 = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)640");
Caps caps2 = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"height=(int)480");
Assert.IsNotNull (caps1);
Assert.IsNotNull (caps2);
Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
Assert.IsFalse (caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
Assert.IsFalse (caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");
Caps caps3 = caps1.Union(caps2);
Caps caps3 = caps1.Union (caps2);
Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");
Assert.IsFalse (caps3.IsEmpty, "How come caps are EMPTY?!");
Caps caps4 = Caps.FromString("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)640; " +
"video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"height=(int)480");
Assert.IsTrue(caps3.IsEqual(caps4));
}
Caps caps4 = Caps.FromString ("video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"width=(int)640; " +
"video/x-raw-yuv, " +
"format=(fourcc)I420, " +
"height=(int)480");
Assert.IsTrue (caps3.IsEqual (caps4));
}
}

View file

@ -13,217 +13,211 @@ using Gst;
using Gst.GLib;
[TestFixture]
public class ElementTest
{
[TestFixtureSetUp]
public void Init()
{
Application.Init();
}
public class ElementTest {
[TestFixtureSetUp]
public void Init() {
Application.Init();
}
[Test]
public void TestLinkNoPads()
{
Element src = new Bin("src");
Element sink = new Bin("sink");
[Test]
public void TestLinkNoPads() {
Element src = new Bin ("src");
Element sink = new Bin ("sink");
Assert.IsFalse(src.Link(sink));
Assert.IsFalse(Element.Link(src, sink));
}
Assert.IsFalse (src.Link (sink));
Assert.IsFalse (Element.Link (src, sink));
}
public class PadAddElement : Gst.Element {
public PadAddElement () : base () {
Pad pad = new Pad("source", PadDirection.Src);
CollectionAssert.IsEmpty(Pads);
public class PadAddElement : Gst.Element {
public PadAddElement () : base () {
Pad pad = new Pad ("source", PadDirection.Src);
CollectionAssert.IsEmpty (Pads);
AddPad(pad);
Assert.AreEqual(pad, GetStaticPad("source"));
CollectionAssert.Contains(Pads, pad);
AddPad (pad);
Assert.AreEqual (pad, GetStaticPad ("source"));
CollectionAssert.Contains (Pads, pad);
RemovePad(pad);
Assert.IsNull(GetStaticPad("source"));
CollectionAssert.IsEmpty(Pads);
}
}
RemovePad (pad);
Assert.IsNull (GetStaticPad ("source"));
CollectionAssert.IsEmpty (Pads);
}
}
[Test]
public void TestAddRemovePad()
{
new PadAddElement ();
}
[Test]
public void TestAddRemovePad() {
new PadAddElement ();
}
[Test]
public void TestLink()
{
State state, pending;
[Test]
public void TestLink() {
State state, pending;
Element source = ElementFactory.Make("fakesrc", "source");
Assert.IsNotNull(source);
Element sink = ElementFactory.Make("fakesink", "sink");
Assert.IsNotNull(sink);
Element source = ElementFactory.Make ("fakesrc", "source");
Assert.IsNotNull (source);
Element sink = ElementFactory.Make ("fakesink", "sink");
Assert.IsNotNull (sink);
Assert.IsTrue(source.LinkPads("src", sink, "sink"));
Assert.IsTrue (source.LinkPads ("src", sink, "sink"));
sink.SetState(State.Paused);
source.SetState(State.Paused);
sink.GetState(out state, out pending, Clock.TimeNone);
Assert.AreEqual(state, State.Paused);
sink.SetState (State.Paused);
source.SetState (State.Paused);
sink.GetState (out state, out pending, Clock.TimeNone);
Assert.AreEqual (state, State.Paused);
sink.SetState(State.Playing);
source.SetState(State.Playing);
source.GetState(out state, out pending, Clock.TimeNone);
Assert.AreEqual(state, State.Playing);
sink.SetState (State.Playing);
source.SetState (State.Playing);
source.GetState (out state, out pending, Clock.TimeNone);
Assert.AreEqual (state, State.Playing);
sink.SetState(State.Null);
source.SetState(State.Null);
sink.GetState(out state, out pending, Clock.TimeNone);
Assert.AreEqual(state, State.Null);
sink.SetState (State.Null);
source.SetState (State.Null);
sink.GetState (out state, out pending, Clock.TimeNone);
Assert.AreEqual (state, State.Null);
Assert.AreEqual(source.GetStaticPad("src").Peer, sink.GetStaticPad("sink"));
source.Unlink(sink);
Assert.IsFalse(source.GetStaticPad("src").IsLinked);
}
public class TestSubclassesApp {
static MainLoop loop;
Assert.AreEqual (source.GetStaticPad ("src").Peer, sink.GetStaticPad ("sink"));
source.Unlink (sink);
Assert.IsFalse (source.GetStaticPad ("src").IsLinked);
}
public class MySrc : Gst.Element {
public MySrc () : base () {
Init ();
}
public MySrc (IntPtr raw) : base (raw) {
Init ();
}
private Pad src;
private uint nbuffers = 0;
private void Init () {
src = new Pad (templ, "src");
AddPad (src);
}
static Caps caps = Caps.FromString ("my/dummy-data");
private void loop () {
Gst.Buffer buf = new Gst.Buffer ();
buf.Caps = caps;
Gst.FlowReturn ret = src.Push (buf);
nbuffers++;
Assert.AreEqual (ret, Gst.FlowReturn.Ok);
if (ret != Gst.FlowReturn.Ok) {
src.StopTask ();
this.PostMessage (Message.NewError (this, CoreError.Failed, "Oh no"));
}
public class TestSubclassesApp {
static MainLoop loop;
if (nbuffers == 10) {
Assert.IsTrue (src.PushEvent (Gst.Event.NewEos ()));
src.PauseTask ();
}
}
protected override StateChangeReturn OnChangeState (StateChange transition) {
if (transition == StateChange.ReadyToPaused)
src.StartTask (loop);
else if (transition == StateChange.PausedToReady)
src.StopTask ();
return StateChangeReturn.Success;
}
static PadTemplate templ = new PadTemplate ("src", Gst.PadDirection.Src, Gst.PadPresence.Always, Caps.FromString ("my/dummy-data"));
public static bool Register () {
SetDetails ( (GType) typeof (MySrc), "long", "klass", "desc", "author");
AddPadTemplate ( (GType) typeof (MySrc), templ);
return ElementFactory.Register (null, "mysrc", (uint) Gst.Rank.None, (GType) typeof (MySrc));
}
}
public class MySink : Gst.Element {
public MySink () : base () {
Init ();
}
public MySink (IntPtr raw) : base (raw) {
Init ();
}
Gst.FlowReturn on_chain (Gst.Pad pad, Gst.Buffer buffer) {
Assert.IsNotNull (buffer);
return Gst.FlowReturn.Ok;
}
public class MySrc : Gst.Element {
public MySrc () : base () {
Init ();
}
bool on_event (Gst.Pad pad, Gst.Event evnt) {
if (evnt.Type == Gst.EventType.Eos) {
this.PostMessage (Message.NewEos (this));
}
public MySrc (IntPtr raw) : base (raw) {
Init ();
}
return true;
}
private void Init () {
Pad pad = new Pad (templ, "sink");
pad.ChainFunction = on_chain;
pad.EventFunction = on_event;
AddPad (pad);
}
static PadTemplate templ = new PadTemplate ("sink", Gst.PadDirection.Sink, Gst.PadPresence.Always, Caps.FromString ("my/dummy-data"));
public static bool Register () {
SetDetails ( (GType) typeof (MySink), "long", "klass", "desc", "author");
AddPadTemplate ( (GType) typeof (MySink), templ);
return ElementFactory.Register (null, "mysink", (uint) Gst.Rank.None, (GType) typeof (MySink));
}
}
private Pad src;
private uint nbuffers = 0;
private static bool BusCb (Bus bus, Message message) {
switch (message.Type) {
case MessageType.Error:
Enum err;
string msg;
message.ParseError (out err, out msg);
Assert.Fail (String.Format ("Error message: {0}", msg));
loop.Quit ();
break;
case MessageType.Eos:
loop.Quit ();
break;
}
return true;
}
public static void Run () {
MySrc.Register ();
MySink.Register ();
MySrc mysrc = Gst.ElementFactory.Make ("mysrc") as MySrc;
MySink mysink = Gst.ElementFactory.Make ("mysink") as MySink;
Gst.Pipeline pipeline = new Pipeline ("pipeline");
pipeline.Add (mysrc, mysink);
Assert.IsTrue (mysrc.Link (mysink));
loop = new MainLoop ();
pipeline.Bus.AddWatch (new BusFunc (BusCb));
pipeline.SetState (Gst.State.Playing);
loop.Run ();
private void Init () {
src = new Pad (templ, "src");
AddPad (src);
}
pipeline.SetState (Gst.State.Null);
}
}
static Caps caps = Caps.FromString ("my/dummy-data");
[Test]
public void TestSubclasses ()
{
TestSubclassesApp.Run ();
}
private void loop () {
Gst.Buffer buf = new Gst.Buffer ();
buf.Caps = caps;
Gst.FlowReturn ret = src.Push (buf);
nbuffers++;
Assert.AreEqual (ret, Gst.FlowReturn.Ok);
if (ret != Gst.FlowReturn.Ok) {
src.StopTask ();
this.PostMessage (Message.NewError (this, CoreError.Failed, "Oh no"));
}
if (nbuffers == 10) {
Assert.IsTrue (src.PushEvent (Gst.Event.NewEos ()));
src.PauseTask ();
}
}
protected override StateChangeReturn OnChangeState (StateChange transition) {
if (transition == StateChange.ReadyToPaused)
src.StartTask (loop);
else if (transition == StateChange.PausedToReady)
src.StopTask ();
return StateChangeReturn.Success;
}
static PadTemplate templ = new PadTemplate ("src", Gst.PadDirection.Src, Gst.PadPresence.Always, Caps.FromString ("my/dummy-data"));
public static bool Register () {
SetDetails ( (GType) typeof (MySrc), "long", "klass", "desc", "author");
AddPadTemplate ( (GType) typeof (MySrc), templ);
return ElementFactory.Register (null, "mysrc", (uint) Gst.Rank.None, (GType) typeof (MySrc));
}
}
public class MySink : Gst.Element {
public MySink () : base () {
Init ();
}
public MySink (IntPtr raw) : base (raw) {
Init ();
}
Gst.FlowReturn on_chain (Gst.Pad pad, Gst.Buffer buffer) {
Assert.IsNotNull (buffer);
return Gst.FlowReturn.Ok;
}
bool on_event (Gst.Pad pad, Gst.Event evnt) {
if (evnt.Type == Gst.EventType.Eos) {
this.PostMessage (Message.NewEos (this));
}
return true;
}
private void Init () {
Pad pad = new Pad (templ, "sink");
pad.ChainFunction = on_chain;
pad.EventFunction = on_event;
AddPad (pad);
}
static PadTemplate templ = new PadTemplate ("sink", Gst.PadDirection.Sink, Gst.PadPresence.Always, Caps.FromString ("my/dummy-data"));
public static bool Register () {
SetDetails ( (GType) typeof (MySink), "long", "klass", "desc", "author");
AddPadTemplate ( (GType) typeof (MySink), templ);
return ElementFactory.Register (null, "mysink", (uint) Gst.Rank.None, (GType) typeof (MySink));
}
}
private static bool BusCb (Bus bus, Message message) {
switch (message.Type) {
case MessageType.Error:
Enum err;
string msg;
message.ParseError (out err, out msg);
Assert.Fail (String.Format ("Error message: {0}", msg));
loop.Quit ();
break;
case MessageType.Eos:
loop.Quit ();
break;
}
return true;
}
public static void Run () {
MySrc.Register ();
MySink.Register ();
MySrc mysrc = Gst.ElementFactory.Make ("mysrc") as MySrc;
MySink mysink = Gst.ElementFactory.Make ("mysink") as MySink;
Gst.Pipeline pipeline = new Pipeline ("pipeline");
pipeline.Add (mysrc, mysink);
Assert.IsTrue (mysrc.Link (mysink));
loop = new MainLoop ();
pipeline.Bus.AddWatch (new BusFunc (BusCb));
pipeline.SetState (Gst.State.Playing);
loop.Run ();
pipeline.SetState (Gst.State.Null);
}
}
[Test]
public void TestSubclasses () {
TestSubclassesApp.Run ();
}
}

View file

@ -9,25 +9,22 @@ using System;
using NUnit.Framework;
using Gst;
public class MessageTest
{
[TestFixtureSetUp]
public void Init()
{
Application.Init();
}
public class MessageTest {
[TestFixtureSetUp]
public void Init() {
Application.Init();
}
[Test]
public void TestParsing()
{
Message message = Message.NewEos(null);
Assert.IsNotNull(message);
Assert.AreEqual(message.Type, MessageType.Eos);
Assert.IsNull(message.Src);
[Test]
public void TestParsing() {
Message message = Message.NewEos (null);
Assert.IsNotNull (message);
Assert.AreEqual (message.Type, MessageType.Eos);
Assert.IsNull (message.Src);
message = Message.NewError(null, CoreError.TooLazy);
Assert.IsNotNull(message);
Assert.AreEqual(message.Type, MessageType.Error);
Assert.IsNull(message.Src);
}
message = Message.NewError (null, CoreError.TooLazy);
Assert.IsNotNull (message);
Assert.AreEqual (message.Type, MessageType.Error);
Assert.IsNull (message.Src);
}
}

View file

@ -4,7 +4,7 @@
// Authors:
// Michael Dominic K. (michaldominik@gmail.com)
// Khaled Mohammed (khaled.mohammed@gmail.com)
//
//
// (C) 2006 Novell, Inc.
//
@ -13,156 +13,145 @@ using NUnit.Framework;
using Gst;
[TestFixture]
public class PadTest
{
[TestFixtureSetUp]
public void Init()
{
Application.Init();
}
public class PadTest {
[TestFixtureSetUp]
public void Init() {
Application.Init();
}
[Test]
public void TestPlainCreation()
{
Pad src = new Pad("src", PadDirection.Src);
Pad sink = new Pad("sink", PadDirection.Sink);
[Test]
public void TestPlainCreation() {
Pad src = new Pad ("src", PadDirection.Src);
Pad sink = new Pad ("sink", PadDirection.Sink);
Assert.IsNotNull(src);
Assert.IsNotNull(sink);
Assert.IsNotNull (src);
Assert.IsNotNull (sink);
Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
Assert.IsFalse (src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
Assert.IsFalse (sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
Assert.AreEqual(PadDirection.Src, src.Direction);
Assert.AreEqual(PadDirection.Sink, sink.Direction);
}
Assert.AreEqual (PadDirection.Src, src.Direction);
Assert.AreEqual (PadDirection.Sink, sink.Direction);
}
public static Caps PadGetCapsStub(Pad pad)
{
return Caps.FromString("video/x-raw-yuv");
}
public static Caps PadGetCapsStub (Pad pad) {
return Caps.FromString ("video/x-raw-yuv");
}
[Test]
public void TestFuncAssigning()
{
Pad src = new Pad("src", PadDirection.Src);
src.GetCapsFunction = new PadGetCapsFunction(PadGetCapsStub);
[Test]
public void TestFuncAssigning() {
Pad src = new Pad ("src", PadDirection.Src);
src.GetCapsFunction = new PadGetCapsFunction (PadGetCapsStub);
Caps caps = src.Caps;
Caps caps = src.Caps;
Assert.IsNotNull(caps, "Ooops, returned caps is null");
Assert.IsFalse(caps.IsEmpty == true, "Ooops, returned caps are empty");
Assert.AreEqual("video/x-raw-yuv", caps.ToString ());
}
Assert.IsNotNull (caps, "Ooops, returned caps is null");
Assert.IsFalse (caps.IsEmpty == true, "Ooops, returned caps are empty");
Assert.AreEqual ("video/x-raw-yuv", caps.ToString ());
}
[Test]
public void TestElementPadAccessByName()
{
Element element = ElementFactory.Make("identity");
Assert.IsNotNull(element);
Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
[Test]
public void TestElementPadAccessByName() {
Element element = ElementFactory.Make ("identity");
Assert.IsNotNull (element);
Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
Pad src = element.GetStaticPad("src");
Pad sink = element.GetStaticPad("sink");
Pad src = element.GetStaticPad ("src");
Pad sink = element.GetStaticPad ("sink");
Assert.IsNotNull(src, "Ooops, src pad is null");
Assert.IsNotNull(sink, "Ooops, sink pad is null");
Assert.IsNotNull (src, "Ooops, src pad is null");
Assert.IsNotNull (sink, "Ooops, sink pad is null");
Assert.IsFalse(src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
Assert.IsFalse(sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
Assert.IsFalse (src.Handle == IntPtr.Zero, "Ooops, src pad has null handle");
Assert.IsFalse (sink.Handle == IntPtr.Zero, "Ooops, sink pad has null handle");
Caps srccaps = src.Caps;
Assert.IsTrue(srccaps.IsAny, "How come src pad caps is not ANY?");
Caps srccaps = src.Caps;
Assert.IsTrue (srccaps.IsAny, "How come src pad caps is not ANY?");
Caps sinkcaps = sink.Caps;
Assert.IsTrue(sinkcaps.IsAny, "How come sink pad caps is not ANY?");
}
Caps sinkcaps = sink.Caps;
Assert.IsTrue (sinkcaps.IsAny, "How come sink pad caps is not ANY?");
}
[Test]
public void TestElementPadAccessByList()
{
Element element = ElementFactory.Make("identity");
Assert.IsNotNull(element);
Assert.IsFalse(element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
[Test]
public void TestElementPadAccessByList() {
Element element = ElementFactory.Make ("identity");
Assert.IsNotNull (element);
Assert.IsFalse (element.Handle == IntPtr.Zero, "Ooops, identity element has null handle");
bool hassink = false;
bool hassrc = false;
bool hassink = false;
bool hassrc = false;
foreach(Pad pad in element.Pads) {
if (pad.Name == "src")
hassrc = true;
else if (pad.Name == "sink")
hassink = true;
}
foreach (Pad pad in element.Pads) {
if (pad.Name == "src")
hassrc = true;
else if (pad.Name == "sink")
hassink = true;
}
Assert.IsTrue(hassink, "Sink pad not found in the list");
Assert.IsTrue(hassrc, "Src pad not found in the list");
}
Assert.IsTrue (hassink, "Sink pad not found in the list");
Assert.IsTrue (hassrc, "Src pad not found in the list");
}
[Test]
public void TestLink()
{
Pad src = new Pad("source", PadDirection.Src);
Assert.IsNotNull(src, "Pad could not be created");
[Test]
public void TestLink() {
Pad src = new Pad ("source", PadDirection.Src);
Assert.IsNotNull (src, "Pad could not be created");
string name = src.Name;
Assert.AreEqual(name, "source");
string name = src.Name;
Assert.AreEqual (name, "source");
Pad sink = new Pad("sink", PadDirection.Sink);
Assert.IsNotNull(sink, "Pad could not be created");
Pad sink = new Pad ("sink", PadDirection.Sink);
Assert.IsNotNull (sink, "Pad could not be created");
Assert.AreEqual(src.Link(sink), PadLinkReturn.Noformat);
}
Assert.AreEqual (src.Link (sink), PadLinkReturn.Noformat);
}
[Test]
public void TestGetAllowedCaps()
{
Caps caps;
[Test]
public void TestGetAllowedCaps() {
Caps caps;
Pad sink = new Pad("sink", PadDirection.Sink);
caps = sink.AllowedCaps;
Assert.IsNull(caps);
Pad sink = new Pad ("sink", PadDirection.Sink);
caps = sink.AllowedCaps;
Assert.IsNull (caps);
Pad src = new Pad("src", PadDirection.Src);
caps = src.AllowedCaps;
Assert.IsNull(caps);
Pad src = new Pad ("src", PadDirection.Src);
caps = src.AllowedCaps;
Assert.IsNull (caps);
caps = Caps.FromString("foo/bar");
caps = Caps.FromString ("foo/bar");
src.SetCaps(caps);
sink.SetCaps(caps);
src.SetCaps (caps);
sink.SetCaps (caps);
PadLinkReturn plr = src.Link(sink);
Assert.AreEqual(plr, PadLinkReturn.Ok);
PadLinkReturn plr = src.Link (sink);
Assert.AreEqual (plr, PadLinkReturn.Ok);
Caps gotcaps = src.AllowedCaps;
Assert.IsNotNull(gotcaps);
Assert.IsTrue(gotcaps.IsEqual(caps));
}
Caps gotcaps = src.AllowedCaps;
Assert.IsNotNull (gotcaps);
Assert.IsTrue (gotcaps.IsEqual (caps));
}
bool ProbeHandler(Pad pad, Gst.Buffer buffer)
{
//Console.WriteLine("event worked");
return false;
}
bool ProbeHandler (Pad pad, Gst.Buffer buffer) {
//Console.WriteLine("event worked");
return false;
}
[Test]
public void TestPushUnlinked()
{
Pad src = new Pad("src", PadDirection.Src);
Assert.IsNotNull(src, "Could not create src");
Caps caps = src.AllowedCaps;
Assert.IsNull(caps);
[Test]
public void TestPushUnlinked() {
Pad src = new Pad ("src", PadDirection.Src);
Assert.IsNotNull (src, "Could not create src");
Caps caps = src.AllowedCaps;
Assert.IsNull (caps);
caps = Caps.FromString("foo/bar");
src.SetCaps(caps);
caps = Caps.FromString ("foo/bar");
src.SetCaps (caps);
Gst.Buffer buffer = new Gst.Buffer();
Assert.AreEqual(src.Push(buffer), FlowReturn.NotLinked);
Gst.Buffer buffer = new Gst.Buffer();
Assert.AreEqual (src.Push (buffer), FlowReturn.NotLinked);
ulong handler_id = src.AddBufferProbe(new PadBufferProbeCallback(ProbeHandler));
buffer = new Gst.Buffer(new byte[] {0});
FlowReturn flowreturn = src.Push(buffer);
Assert.AreEqual(flowreturn, FlowReturn.Ok);
}
ulong handler_id = src.AddBufferProbe (new PadBufferProbeCallback (ProbeHandler));
buffer = new Gst.Buffer (new byte[] {0});
FlowReturn flowreturn = src.Push (buffer);
Assert.AreEqual (flowreturn, FlowReturn.Ok);
}
}

View file

@ -3,7 +3,7 @@
//
// Authors
// Khaled Mohammed < khaled.mohammed@gmail.com >
//
//
// (C) 2006
//
@ -13,160 +13,152 @@ using Gst;
using Gst.CorePlugins;
[TestFixture]
public class PipelineTest
{
public class PipelineTest {
[TestFixtureSetUp]
public void Init()
{
public void Init() {
Application.Init();
}
[Test]
public void TestPipeline()
{
Pipeline pipeline = new Pipeline();
Assert.IsNotNull(pipeline, "Could not create pipeline");
Assert.IsNotNull(pipeline.Bus, "Bus on pipeline is null");
Assert.IsNotNull(pipeline.Clock, "Clock on pipeline is null");
}
[Test]
public void TestAsyncStateChangeEmpty()
{
public void TestPipeline() {
Pipeline pipeline = new Pipeline();
Assert.IsNotNull(pipeline, "Could not create pipeline");
Assert.AreEqual(((Element)pipeline).SetState(State.Playing), StateChangeReturn.Success);
Assert.IsNotNull (pipeline, "Could not create pipeline");
Assert.IsNotNull (pipeline.Bus, "Bus on pipeline is null");
Assert.IsNotNull (pipeline.Clock, "Clock on pipeline is null");
}
[Test]
public void TestAsyncStateChangeFakeReady()
{
public void TestAsyncStateChangeEmpty() {
Pipeline pipeline = new Pipeline();
Element src = ElementFactory.Make("fakesrc");
Element sink = ElementFactory.Make("fakesink");
Assert.IsNotNull (pipeline, "Could not create pipeline");
Assert.AreEqual ( ( (Element) pipeline).SetState (State.Playing), StateChangeReturn.Success);
}
[Test]
public void TestAsyncStateChangeFakeReady() {
Pipeline pipeline = new Pipeline();
Element src = ElementFactory.Make ("fakesrc");
Element sink = ElementFactory.Make ("fakesink");
Bin bin = (Bin) pipeline;
bin.Add(src, sink);
src.Link(sink);
bin.Add (src, sink);
src.Link (sink);
Assert.AreEqual(((Element)pipeline).SetState(State.Ready), StateChangeReturn.Success);
Assert.AreEqual ( ( (Element) pipeline).SetState (State.Ready), StateChangeReturn.Success);
}
[Test]
public void TestAsyncStateChangeFake()
{
public void TestAsyncStateChangeFake() {
bool done = false;
Pipeline pipeline = new Pipeline();
Assert.IsNotNull(pipeline, "Could not create pipeline");
Assert.IsNotNull (pipeline, "Could not create pipeline");
Element src = ElementFactory.Make("fakesrc");
Element sink = ElementFactory.Make("fakesink");
Element src = ElementFactory.Make ("fakesrc");
Element sink = ElementFactory.Make ("fakesink");
Bin bin = (Bin) pipeline;
bin.Add(src, sink);
src.Link(sink);
bin.Add (src, sink);
src.Link (sink);
Bus bus = pipeline.Bus;
Assert.AreEqual(((Element) pipeline).SetState(State.Playing), StateChangeReturn.Async);
Assert.AreEqual ( ( (Element) pipeline).SetState (State.Playing), StateChangeReturn.Async);
while(!done) {
while (!done) {
State old, newState, pending;
Message message = bus.Poll(MessageType.StateChanged, -1);
if(message != null) {
message.ParseStateChanged(out old, out newState, out pending);
if(message.Src == (Gst.Object) pipeline && newState == State.Playing)
Message message = bus.Poll (MessageType.StateChanged, -1);
if (message != null) {
message.ParseStateChanged (out old, out newState, out pending);
if (message.Src == (Gst.Object) pipeline && newState == State.Playing)
done = true;
}
}
Assert.AreEqual(((Element)pipeline).SetState(State.Null), StateChangeReturn.Success);
Assert.AreEqual ( ( (Element) pipeline).SetState (State.Null), StateChangeReturn.Success);
}
Element pipeline;
Gst.GLib.MainLoop loop;
bool MessageReceived(Bus bus, Message message) {
bool MessageReceived (Bus bus, Message message) {
MessageType type = message.Type;
switch(type)
{
case MessageType.StateChanged:
{
State old, newState, pending;
message.ParseStateChanged(out old, out newState, out pending);
if(message.Src == (Gst.Object) pipeline && newState == State.Playing) {
loop.Quit();
}
break;
switch (type) {
case MessageType.StateChanged: {
State old, newState, pending;
message.ParseStateChanged (out old, out newState, out pending);
if (message.Src == (Gst.Object) pipeline && newState == State.Playing) {
loop.Quit();
}
break;
}
case MessageType.Error:
break;
default: break;
default:
break;
}
return true;
}
[Test]
public void TestBusAddWatch()
{
TestBusCallback(true);
public void TestBusAddWatch() {
TestBusCallback (true);
}
[Test]
public void TestBusAddSignalWatch()
{
TestBusCallback(false);
public void TestBusAddSignalWatch() {
TestBusCallback (false);
}
public void TestBusCallback(bool use_AddWatch)
{
public void TestBusCallback (bool use_AddWatch) {
pipeline = new Pipeline();
Assert.IsNotNull(pipeline, "Could not create pipeline");
Assert.IsNotNull (pipeline, "Could not create pipeline");
Element src = ElementFactory.Make("fakesrc");
Assert.IsNotNull(src, "Could not create fakesrc");
Element sink = ElementFactory.Make("fakesink");
Assert.IsNotNull(sink, "Could not create fakesink");
Element src = ElementFactory.Make ("fakesrc");
Assert.IsNotNull (src, "Could not create fakesrc");
Element sink = ElementFactory.Make ("fakesink");
Assert.IsNotNull (sink, "Could not create fakesink");
Bin bin = (Bin) pipeline;
bin.Add(src, sink);
Assert.IsTrue(src.Link(sink), "Could not link between src and sink");
bin.Add (src, sink);
Assert.IsTrue (src.Link (sink), "Could not link between src and sink");
if (use_AddWatch)
pipeline.Bus.AddWatch(new BusFunc(MessageReceived));
pipeline.Bus.AddWatch (new BusFunc (MessageReceived));
else {
pipeline.Bus.AddSignalWatch();
pipeline.Bus.Message += delegate (object o, MessageArgs args) {MessageReceived(null, args.Message);};
pipeline.Bus.Message += delegate (object o, MessageArgs args) {
MessageReceived (null, args.Message);
};
}
Assert.AreEqual(pipeline.SetState(State.Playing), StateChangeReturn.Async);
Assert.AreEqual (pipeline.SetState (State.Playing), StateChangeReturn.Async);
loop = new Gst.GLib.MainLoop();
loop.Run();
Assert.AreEqual(pipeline.SetState(State.Null), StateChangeReturn.Success);
Assert.AreEqual (pipeline.SetState (State.Null), StateChangeReturn.Success);
State current, pending;
Assert.AreEqual(pipeline.GetState(out current, out pending, Clock.TimeNone), StateChangeReturn.Success);
Assert.AreEqual(current, State.Null, "state is not NULL but " + current);
Assert.AreEqual (pipeline.GetState (out current, out pending, Clock.TimeNone), StateChangeReturn.Success);
Assert.AreEqual (current, State.Null, "state is not NULL but " + current);
}
[Test]
public void TestBaseTime() {
Element pipeline = ElementFactory.Make("pipeline", "pipeline");
FakeSrc fakesrc = FakeSrc.Make("fakesrc");
FakeSink fakesink = FakeSink.Make("fakesink");
Element pipeline = ElementFactory.Make ("pipeline", "pipeline");
FakeSrc fakesrc = FakeSrc.Make ("fakesrc");
FakeSink fakesink = FakeSink.Make ("fakesink");
Assert.IsNotNull(pipeline, "Could not create pipeline");
Assert.IsNotNull(fakesrc, "Could not create fakesrc");
Assert.IsNotNull(fakesink, "Could not create fakesink");
Assert.IsNotNull (pipeline, "Could not create pipeline");
Assert.IsNotNull (fakesrc, "Could not create fakesrc");
Assert.IsNotNull (fakesink, "Could not create fakesink");
fakesrc.IsLive = true;
Bin bin = (Bin) pipeline;
bin.Add(fakesrc, fakesink);
Assert.IsTrue(fakesrc.Link(fakesink));
bin.Add (fakesrc, fakesink);
Assert.IsTrue (fakesrc.Link (fakesink));
Pad sink = fakesink.GetStaticPad("sink");
Pad sink = fakesink.GetStaticPad ("sink");
}
}