2009-04-07 09:02:08 +00:00
|
|
|
//
|
|
|
|
// 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 {
|
|
|
|
|
2009-04-16 20:19:59 +00:00
|
|
|
[StructLayout (LayoutKind.Sequential) ]
|
|
|
|
internal struct GError {
|
|
|
|
uint domain_quark;
|
|
|
|
int code;
|
|
|
|
IntPtr message;
|
2009-04-07 09:02:08 +00:00
|
|
|
|
2009-04-16 20:19:59 +00:00
|
|
|
public uint Domain {
|
|
|
|
get {
|
|
|
|
return domain_quark;
|
2009-09-20 08:19:49 +00:00
|
|
|
} set {
|
2009-04-16 20:19:59 +00:00
|
|
|
domain_quark = value;
|
|
|
|
}
|
2009-04-07 09:27:20 +00:00
|
|
|
}
|
2009-04-07 09:02:08 +00:00
|
|
|
|
2009-04-16 20:19:59 +00:00
|
|
|
public int Code {
|
|
|
|
get {
|
|
|
|
return code;
|
2009-09-20 08:19:49 +00:00
|
|
|
} set {
|
2009-04-16 20:19:59 +00:00
|
|
|
code = value;
|
|
|
|
}
|
2009-04-07 09:02:08 +00:00
|
|
|
}
|
2009-04-07 09:27:20 +00:00
|
|
|
|
2009-04-16 20:19:59 +00:00
|
|
|
public string Message {
|
|
|
|
get {
|
|
|
|
if (message == IntPtr.Zero)
|
|
|
|
return null;
|
2009-08-05 14:57:20 +00:00
|
|
|
return Gst.GLib.Marshaller.Utf8PtrToString (message);
|
2009-09-20 08:19:49 +00:00
|
|
|
} set {
|
2009-04-16 20:19:59 +00:00
|
|
|
if (message != IntPtr.Zero)
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Marshaller.Free (message);
|
|
|
|
message = Gst.GLib.Marshaller.StringToPtrGStrdup (value);
|
2009-04-16 20:19:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Unset () {
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Marshaller.Free (message);
|
2009-04-16 20:19:59 +00:00
|
|
|
message = IntPtr.Zero;
|
|
|
|
code = 0;
|
|
|
|
domain_quark = 0;
|
|
|
|
}
|
2009-04-07 09:27:20 +00:00
|
|
|
}
|
2009-04-07 09:02:08 +00:00
|
|
|
}
|