mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
Add/fix complete bindings of Gst.Message
This commit is contained in:
parent
21704d8efe
commit
cdb05eac31
4 changed files with 773 additions and 12 deletions
|
@ -224,9 +224,16 @@
|
||||||
|
|
||||||
<change-node-type path="/api/namespace/object[@name='Message']">boxed</change-node-type>
|
<change-node-type path="/api/namespace/object[@name='Message']">boxed</change-node-type>
|
||||||
<attr path="/api/namespace/boxed[@name='Message']" name="opaque">true</attr>
|
<attr path="/api/namespace/boxed[@name='Message']" name="opaque">true</attr>
|
||||||
<attr path="/api/namespace/boxed[@name='Message']/method[@name='ParseWarning']" name="hidden">1</attr>
|
<attr path="/api/namespace/boxed[@name='Message']/method[@cname='gst_message_get_type']" name="new_flag">1</attr>
|
||||||
<attr path="/api/namespace/boxed[@name='Message']/method[@name='ParseError']" name="hidden">1</attr>
|
<attr path="/api/namespace/boxed[@name='Message']/field[@name='Timestamp']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/boxed[@name='Message']/method[@name='ParseInfo']" name="hidden">1</attr>
|
<attr path="/api/namespace/boxed[@name='Message']/field[@name='Src']" name="hidden">1</attr>
|
||||||
|
<attr path="/api/namespace/boxed[@name='Message']/method[@cname='gst_message_type_to_quark']" name="hidden">1</attr>
|
||||||
|
<attr path="/api/namespace/boxed[@name='Message']/method[@cname='gst_message_type_get_name']" name="hidden">1</attr>
|
||||||
|
<attr path="/api/namespace/boxed[@name='Message']/constructor" name="hidden">1</attr>
|
||||||
|
<attr path="/api/namespace/boxed[@name='Message']/method" name="hidden">1</attr>
|
||||||
|
<remove-attr path="/api/namespace/boxed[@name='Message']/method[@cname='gst_message_get_structure']" name="hidden" />
|
||||||
|
<attr path="/api/namespace/boxed[@name='Message']/method[@cname='gst_message_get_structure']/return-type" name="owned">true</attr>
|
||||||
|
<remove-attr path="/api/namespace/boxed[@name='Message']/method[@cname='gst_message_get_type']" name="hidden" />
|
||||||
|
|
||||||
<attr path="/api/namespace/enum[@name='MessageType']" name="parent">uint</attr>
|
<attr path="/api/namespace/enum[@name='MessageType']" name="parent">uint</attr>
|
||||||
<attr path="/api/namespace/enum[@name='MessageType']/member[@name='Unknown']" name="value">0U</attr>
|
<attr path="/api/namespace/enum[@name='MessageType']/member[@name='Unknown']" name="value">0U</attr>
|
||||||
|
|
|
@ -1,16 +1,758 @@
|
||||||
|
protected Message () : base () { }
|
||||||
|
|
||||||
|
public Message (GLib.Value val) : base (val) { }
|
||||||
|
|
||||||
[DllImport ("gstreamersharpglue-0.10") ]
|
[DllImport ("gstreamersharpglue-0.10") ]
|
||||||
private extern static IntPtr gstsharp_message_parse_error (IntPtr raw);
|
extern static uint gstsharp_gst_message_get_timestamp_offset ();
|
||||||
|
|
||||||
public void ParseError (out string error) {
|
static uint timestamp_offset = gstsharp_gst_message_get_timestamp_offset ();
|
||||||
IntPtr err = gstsharp_message_parse_error (Handle);
|
public ulong Timestamp {
|
||||||
error = GLib.Marshaller.PtrToStringGFree (err);
|
get {
|
||||||
|
unsafe {
|
||||||
|
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
|
||||||
|
return (*raw_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if (!IsWritable)
|
||||||
|
throw new ApplicationException ();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
ulong* raw_ptr = (ulong*) ( ( (byte*) Handle) + timestamp_offset);
|
||||||
|
*raw_ptr = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport ("gstreamersharpglue-0.10") ]
|
[DllImport ("gstreamersharpglue-0.10") ]
|
||||||
private extern static IntPtr gstsharp_message_error_new();
|
extern static uint gstsharp_gst_message_get_src_offset ();
|
||||||
|
|
||||||
public Message (Gst.Object src, string debug) {
|
static uint src_offset = gstsharp_gst_message_get_src_offset ();
|
||||||
IntPtr error = gstsharp_message_error_new();
|
public Gst.Object Src {
|
||||||
Raw = gst_message_new_error (src == null ? IntPtr.Zero : src.Handle, error, GLib.Marshaller.StringToPtrGStrdup (debug));
|
get {
|
||||||
|
unsafe {
|
||||||
|
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
|
||||||
|
return GLib.Object.GetObject ( (*raw_ptr)) as Gst.Object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if (!IsWritable)
|
||||||
|
throw new ApplicationException ();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
|
||||||
|
*raw_ptr = value == null ? IntPtr.Zero : value.Handle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern uint gst_message_get_seqnum (IntPtr raw);
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_set_seqnum (IntPtr raw, uint seqnum);
|
||||||
|
|
||||||
|
public uint Seqnum {
|
||||||
|
get {
|
||||||
|
uint raw_ret = gst_message_get_seqnum (Handle);
|
||||||
|
uint ret = raw_ret;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if (!IsWritable)
|
||||||
|
throw new ApplicationException ();
|
||||||
|
|
||||||
|
gst_message_set_seqnum (Handle, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_eos (IntPtr src);
|
||||||
|
|
||||||
|
public static Message NewEos (Gst.Object src) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_eos (src.Handle), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_error_get_message (uint domain, int code);
|
||||||
|
|
||||||
|
static string GetMessage (uint domain, int code) {
|
||||||
|
IntPtr raw_ret = gst_error_get_message (domain, code);
|
||||||
|
if (raw_ret == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return GLib.Marshaller.PtrToStringGFree (raw_ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern uint gst_core_error_quark ();
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern uint gst_library_error_quark ();
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern uint gst_stream_error_quark ();
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern uint gst_resource_error_quark ();
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_core_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_error (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewError (Gst.Object src, Gst.StreamError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_stream_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_error (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewError (Gst.Object src, Gst.LibraryError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_library_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_error (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewError (Gst.Object src, Gst.ResourceError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_resource_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_error (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_error (IntPtr msg, out IntPtr err, out IntPtr debug);
|
||||||
|
|
||||||
|
public Enum ParseError (out string message, out string debug) {
|
||||||
|
if (Type != MessageType.Error)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr err;
|
||||||
|
IntPtr dbg;
|
||||||
|
|
||||||
|
gst_message_parse_error (Handle, out err, out dbg);
|
||||||
|
|
||||||
|
if (dbg != IntPtr.Zero)
|
||||||
|
debug = GLib.Marshaller.Utf8PtrToString (dbg);
|
||||||
|
else
|
||||||
|
debug = null;
|
||||||
|
|
||||||
|
message = null;
|
||||||
|
|
||||||
|
if (err == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
GError error = (Gst.GError) Marshal.PtrToStructure (err, typeof (Gst.GError));
|
||||||
|
|
||||||
|
message = error.Message;
|
||||||
|
|
||||||
|
if (error.Domain == gst_core_error_quark ())
|
||||||
|
return (Gst.CoreError) error.Code;
|
||||||
|
else if (error.Domain == gst_library_error_quark ())
|
||||||
|
return (Gst.LibraryError) error.Code;
|
||||||
|
else if (error.Domain == gst_resource_error_quark ())
|
||||||
|
return (Gst.ResourceError) error.Code;
|
||||||
|
else if (error.Domain == gst_stream_error_quark ())
|
||||||
|
return (Gst.StreamError) error.Code;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum ParseError (out string message) {
|
||||||
|
string tmp;
|
||||||
|
|
||||||
|
return ParseError (out message, out tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum ParseError () {
|
||||||
|
string tmp, tmp2;
|
||||||
|
|
||||||
|
return ParseError (out tmp, out tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_core_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_warning (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewWarning (Gst.Object src, Gst.StreamError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_stream_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_warning (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewWarning (Gst.Object src, Gst.LibraryError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_library_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_warning (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewWarning (Gst.Object src, Gst.ResourceError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_resource_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_warning (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_warning (IntPtr msg, out IntPtr err, out IntPtr debug);
|
||||||
|
|
||||||
|
public Enum ParseWarning (out string message, out string debug) {
|
||||||
|
if (Type != MessageType.Warning)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr err;
|
||||||
|
IntPtr dbg;
|
||||||
|
|
||||||
|
gst_message_parse_warning (Handle, out err, out dbg);
|
||||||
|
|
||||||
|
if (dbg != IntPtr.Zero)
|
||||||
|
debug = GLib.Marshaller.Utf8PtrToString (dbg);
|
||||||
|
else
|
||||||
|
debug = null;
|
||||||
|
|
||||||
|
message = null;
|
||||||
|
|
||||||
|
if (err == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
GError error = (Gst.GError) Marshal.PtrToStructure (err, typeof (Gst.GError));
|
||||||
|
|
||||||
|
message = error.Message;
|
||||||
|
|
||||||
|
if (error.Domain == gst_core_error_quark ())
|
||||||
|
return (Gst.CoreError) error.Code;
|
||||||
|
else if (error.Domain == gst_library_error_quark ())
|
||||||
|
return (Gst.LibraryError) error.Code;
|
||||||
|
else if (error.Domain == gst_resource_error_quark ())
|
||||||
|
return (Gst.ResourceError) error.Code;
|
||||||
|
else if (error.Domain == gst_stream_error_quark ())
|
||||||
|
return (Gst.StreamError) error.Code;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum ParseWarning (out string message) {
|
||||||
|
string tmp;
|
||||||
|
|
||||||
|
return ParseWarning (out message, out tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum ParseWarning () {
|
||||||
|
string tmp, tmp2;
|
||||||
|
|
||||||
|
return ParseWarning (out tmp, out tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_core_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_info (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewInfo (Gst.Object src, Gst.StreamError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_stream_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_info (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewInfo (Gst.Object src, Gst.LibraryError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_library_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_info (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Message NewInfo (Gst.Object src, Gst.ResourceError error, string message, string debug) {
|
||||||
|
Gst.GError err = new Gst.GError ();
|
||||||
|
err.Code = (int) error;
|
||||||
|
err.Domain = gst_resource_error_quark ();
|
||||||
|
err.Message = (message != null) ? message : GetMessage (err.Domain, err.Code);
|
||||||
|
|
||||||
|
IntPtr raw_ptr = (debug == null) ? IntPtr.Zero : GLib.Marshaller.StringToPtrGStrdup (debug);
|
||||||
|
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_info (src.Handle, ref err, raw_ptr), typeof (Message), true);
|
||||||
|
|
||||||
|
GLib.Marshaller.Free (raw_ptr);
|
||||||
|
err.Unset ();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_info (IntPtr msg, out IntPtr err, out IntPtr debug);
|
||||||
|
|
||||||
|
public Enum ParseInfo (out string message, out string debug) {
|
||||||
|
if (Type != MessageType.Info)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr err;
|
||||||
|
IntPtr dbg;
|
||||||
|
|
||||||
|
gst_message_parse_info (Handle, out err, out dbg);
|
||||||
|
|
||||||
|
if (dbg != IntPtr.Zero)
|
||||||
|
debug = GLib.Marshaller.Utf8PtrToString (dbg);
|
||||||
|
else
|
||||||
|
debug = null;
|
||||||
|
|
||||||
|
message = null;
|
||||||
|
|
||||||
|
if (err == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
GError error = (Gst.GError) Marshal.PtrToStructure (err, typeof (Gst.GError));
|
||||||
|
|
||||||
|
message = error.Message;
|
||||||
|
|
||||||
|
if (error.Domain == gst_core_error_quark ())
|
||||||
|
return (Gst.CoreError) error.Code;
|
||||||
|
else if (error.Domain == gst_library_error_quark ())
|
||||||
|
return (Gst.LibraryError) error.Code;
|
||||||
|
else if (error.Domain == gst_resource_error_quark ())
|
||||||
|
return (Gst.ResourceError) error.Code;
|
||||||
|
else if (error.Domain == gst_stream_error_quark ())
|
||||||
|
return (Gst.StreamError) error.Code;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum ParseInfo (out string message) {
|
||||||
|
string tmp;
|
||||||
|
|
||||||
|
return ParseInfo (out message, out tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Enum ParseInfo () {
|
||||||
|
string tmp, tmp2;
|
||||||
|
|
||||||
|
return ParseInfo (out tmp, out tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_tag (IntPtr src, IntPtr tags);
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_tag_list_copy (IntPtr handle);
|
||||||
|
|
||||||
|
public static Message NewTag (Gst.Object src, TagList tags) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_tag (src.Handle, gst_tag_list_copy (tags.Handle)), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_tag (IntPtr msg, out IntPtr tags);
|
||||||
|
|
||||||
|
public TagList ParseTag () {
|
||||||
|
if (Type != MessageType.Tag)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr raw_ptr;
|
||||||
|
|
||||||
|
gst_message_parse_tag (Handle, out raw_ptr);
|
||||||
|
if (raw_ptr == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
TagList tags = (TagList) GLib.Opaque.GetOpaque (raw_ptr, typeof (TagList), true);
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_buffering (IntPtr src, int percent);
|
||||||
|
|
||||||
|
public static Message NewBuffering (Gst.Object src, int percent) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_buffering (src.Handle, percent), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_buffering (IntPtr msg, out int percent);
|
||||||
|
|
||||||
|
public int ParseBuffering () {
|
||||||
|
int percent;
|
||||||
|
|
||||||
|
if (Type != MessageType.Buffering)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
gst_message_parse_buffering (Handle, out percent);
|
||||||
|
|
||||||
|
return percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
if (Type != MessageType.Buffering)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
if (!IsWritable)
|
||||||
|
throw new ApplicationException ();
|
||||||
|
|
||||||
|
gst_message_set_buffering_stats (Handle, mode, avg_in, avg_out, buffering_left);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
if (Type != MessageType.Buffering)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
gst_message_parse_buffering_stats (Handle, out mode, out avg_in, out avg_out, out buffering_left);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_state_changed (src.Handle, oldstate, newstate, pendingstate), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
if (Type != MessageType.StateChanged)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
gst_message_parse_state_changed (Handle, out oldstate, out newstate, out pendingstate);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_state_dirty (IntPtr src);
|
||||||
|
|
||||||
|
public static Message NewStateDirty (Gst.Object src) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_state_dirty (src.Handle), typeof (Message), true);
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_clock_provide (src.Handle, clock.Handle, ready), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_clock_provide (IntPtr msg, out IntPtr clock, out bool ready);
|
||||||
|
|
||||||
|
public Gst.Clock ParseClockProvide (out bool ready) {
|
||||||
|
if (Type != MessageType.ClockProvide)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr raw;
|
||||||
|
|
||||||
|
gst_message_parse_clock_provide (Handle, out raw, out ready);
|
||||||
|
|
||||||
|
return GLib.Object.GetObject (raw, false) as Gst.Clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_clock_lost (src.Handle, clock.Handle), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_clock_lost (IntPtr msg, out IntPtr clock);
|
||||||
|
|
||||||
|
public Gst.Clock ParseClockLost () {
|
||||||
|
if (Type != MessageType.ClockLost)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr raw;
|
||||||
|
|
||||||
|
gst_message_parse_clock_lost (Handle, out raw);
|
||||||
|
|
||||||
|
return GLib.Object.GetObject (raw, true) as Gst.Clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_new_clock (src.Handle, clock.Handle), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_new_clock (IntPtr msg, out IntPtr clock);
|
||||||
|
|
||||||
|
public Gst.Clock ParseNewClock () {
|
||||||
|
if (Type != MessageType.NewClock)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr raw;
|
||||||
|
|
||||||
|
gst_message_parse_new_clock (Handle, out raw);
|
||||||
|
|
||||||
|
return GLib.Object.GetObject (raw, true) as Gst.Clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_application (IntPtr src, IntPtr structure);
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_structure_copy (IntPtr handle);
|
||||||
|
|
||||||
|
public static Message NewApplication (Gst.Object src, Gst.Structure structure) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_application (src.Handle, (structure != null) ? gst_structure_copy (structure.Handle) : IntPtr.Zero), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_element (IntPtr src, IntPtr structure);
|
||||||
|
|
||||||
|
public static Message NewElement (Gst.Object src, Gst.Structure structure) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_element (src.Handle, (structure != null) ? gst_structure_copy (structure.Handle) : IntPtr.Zero), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_custom (type, src.Handle, (structure != null) ? gst_structure_copy (structure.Handle) : IntPtr.Zero), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_segment_start (src.Handle, format, position), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
if (Type != MessageType.SegmentStart)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
gst_message_parse_segment_start (Handle, out format, out position);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_segment_done (src.Handle, format, position), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
if (Type != MessageType.SegmentDone)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
gst_message_parse_segment_done (Handle, out format, out position);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_duration (src.Handle, format, duration), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
if (Type != MessageType.Duration)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
gst_message_parse_duration (Handle, out format, out duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_latency (IntPtr src);
|
||||||
|
|
||||||
|
public static Message NewLatency (Gst.Object src) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_latency (src.Handle), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_async_start (src.Handle, new_base_time), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern void gst_message_parse_async_start (IntPtr msg, out bool new_base_time);
|
||||||
|
|
||||||
|
public bool ParseAsyncStart () {
|
||||||
|
if (Type != MessageType.AsyncStart)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
bool new_base_time;
|
||||||
|
|
||||||
|
gst_message_parse_async_start (Handle, out new_base_time);
|
||||||
|
return new_base_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-0.10.dll") ]
|
||||||
|
static extern IntPtr gst_message_new_async_done (IntPtr src);
|
||||||
|
|
||||||
|
public static Message NewAsyncDone (Gst.Object src) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_async_done (src.Handle), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
Message msg = (Message) GLib.Opaque.GetOpaque (gst_message_new_structure_change (src.Handle, type, owner.Handle, busy), typeof (Message), true);
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport ("gstreamer-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) {
|
||||||
|
if (Type != MessageType.StructureChange)
|
||||||
|
throw new ArgumentException ();
|
||||||
|
|
||||||
|
IntPtr raw_ptr;
|
||||||
|
|
||||||
|
gst_message_parse_structure_change (Handle, out type, out raw_ptr, out busy);
|
||||||
|
owner = GLib.Object.GetObject (raw_ptr, false) as Gst.Element;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Message () {
|
||||||
|
GLib.GType.Register (Message.GType, typeof (Message));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,3 @@ gstsharp_g_type_from_instance (GTypeInstance * instance)
|
||||||
{
|
{
|
||||||
return G_TYPE_FROM_INSTANCE (instance);
|
return G_TYPE_FROM_INSTANCE (instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
guint
|
||||||
|
gstsharp_gst_message_get_timestamp_offset (void)
|
||||||
|
{
|
||||||
|
return (guint) G_STRUCT_OFFSET (GstMessage, timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gstsharp_gst_message_get_src_offset (void)
|
||||||
|
{
|
||||||
|
return (guint) G_STRUCT_OFFSET (GstMessage, src);
|
||||||
|
}
|
Loading…
Reference in a new issue