bool result = gst_init_check(ref argc, ref argv_ptr, out error_ptr);
if(error_ptr != IntPtr.Zero) {
- throw new ApplicationException("gst_init_check set error");
+ string message = GError.GetMessage (error_ptr);
+
+ if (message == String.Empty)
+ message = "Reason unknown";
+
+ GError.Free (error_ptr);
+
+ throw new ApplicationException(String.Format ("gst_init_check() failed: {0}", message));
} else if(!result) {
- throw new ApplicationException("gst_init_check failed, error not set");
+ throw new ApplicationException("gst_init_check() failed: Reason unknown");
}
} else {
gst_init(ref argc, ref argv_ptr);
}
if(argv_ptr != argv.Handle) {
- string init_call = check ? "gst_init_check" : "gst_init";
+ string init_call = check ? "gst_init_check()" : "gst_init()";
throw new ApplicationException(init_call + " returned a new argv handle");
}
Array.Copy(progargs, 1, args, 0, argc - 1);
}
}
-
+
[DllImport("gstreamer-0.10")]
private static extern void gst_init(ref int argc, ref IntPtr argv);
--- /dev/null
+//
+// Copyright (c) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+//
+// This class implements some helper functions to handle GError
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Gst {
+ internal static class GError
+ {
+ public static string GetMessage (IntPtr error)
+ {
+ if (error == IntPtr.Zero)
+ return String.Empty;
+
+ IntPtr message = gstsharp_g_error_get_message (error);
+ if (message == IntPtr.Zero)
+ return String.Empty;
+
+ return GLib.Marshaller.PtrToStringGFree (message);
+ }
+
+ public static void Free (IntPtr error)
+ {
+ if (error != IntPtr.Zero)
+ g_error_free (error);
+ }
+
+ [DllImport("gstreamersharpglue-0.10")]
+ static extern IntPtr gstsharp_g_error_get_message (IntPtr error);
+
+ [DllImport("glib-2.0.dll")]
+ static extern void g_error_free (IntPtr error);
+ }
+}
<attr path="/api/namespace/object[@name='GhostPad']" name="parent">GstPad</attr>
+ <remove-node path="/api/namespace/class[@name='Global']/method[@cname='gst_version_string']" />
+
<attr path="/api/namespace/object[@name='Index']/field[@cname='resolver']" name="hidden">1</attr>
<attr path="/api/namespace/object[@name='Index']/property[@cname='resolver']" name="hidden">1</attr>
<attr path="/api/namespace/enum[@name='IndexFlags']/member[@cname='GST_INDEX_READABLE']" name="value">ObjectFlags.Last << 1</attr>
<attr path="/api/namespace/enum[@name='IndexFlags']/member[@cname='GST_INDEX_FLAG_LAST']" name="value">ObjectFlags.Last << 8</attr>
+ <remove-node path="/api/namespace/class[@name='Init']" />
+
<attr path="/api/namespace/struct[@name='Iterator']/method[@name='Fold']/parameters/*[@name='ret']" name="name">ret_val</attr>
<attr path="/api/namespace/struct[@name='Iterator']/field[@name='Next']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@name='Iterator']/field[@name='Item']" name="hidden">1</attr>
<attr path="/api/namespace/enum[@name='PadTemplateFlags']/member[@cname='GST_PAD_TEMPLATE_FIXED']" name="value">ObjectFlags.Last << 0</attr>
<attr path="/api/namespace/enum[@name='PadTemplateFlags']/member[@cname='GST_PAD_TEMPLATE_FLAG_LAST']" name="value">ObjectFlags.Last << 4</attr>
- <attr path="/api/namespace/class[@name='Param']" name="hidden">1</attr>
+ <remove-node path="/api/namespace/class[@name='Param']" name="hidden">1</attr>
<attr path="/api/namespace/object[@name='ParamSpecFraction']" name="hidden">1</attr>
<attr path="/api/namespace/object[@name='ParamSpecMiniObject']" name="hidden">1</attr>
Version.cs \
AssemblyInfo.cs \
CommonTags.cs \
+ GError.cs \
plugins-base/PlayBin.cs \
plugins-base/DecodeBin.cs \
plugins-base/TypeFindElement.cs
message.c \
miniobject.c \
bin.c \
- dynamicsignal.c
+ dynamicsignal.c \
+ gerror.c
nodist_libgstreamersharpglue_0_10_la_SOURCES = generated.c
--- /dev/null
+#include <glib.h>
+
+gchar *
+gstsharp_g_error_get_message (GError * error)
+{
+ if (error->message)
+ return g_strdup (error->message);
+
+ return NULL;
+}
+