Skip to content
Snippets Groups Projects
Commit 11215be9 authored by Thibault Saunier's avatar Thibault Saunier :cactus:
Browse files

Make GstSDPMessage an opaque structure

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=794483
parent 067f13fc
No related branches found
Tags mesa-18.0.0-rc3
No related merge requests found
......@@ -100,7 +100,7 @@ namespace Gst.Rtsp {
try {
IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
Gst.Rtsp.RTSPResult __result;
__result = __obj.ParseSdp (Gst.Sdp.SDPMessage.New (sdp), s == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (s, typeof (Gst.Structure), false));
__result = __obj.ParseSdp (sdp == IntPtr.Zero ? null : (Gst.Sdp.SDPMessage) GLib.Opaque.GetOpaque (sdp, typeof (Gst.Sdp.SDPMessage), false), s == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (s, typeof (Gst.Structure), false));
return (int) __result;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
......@@ -357,10 +357,8 @@ namespace Gst.Rtsp {
static extern int gst_rtsp_extension_parse_sdp(IntPtr raw, IntPtr sdp, IntPtr s);
public Gst.Rtsp.RTSPResult ParseSdp(Gst.Sdp.SDPMessage sdp, Gst.Structure s) {
IntPtr native_sdp = GLib.Marshaller.StructureToPtrAlloc (sdp);
int raw_ret = gst_rtsp_extension_parse_sdp(Handle, native_sdp, s == null ? IntPtr.Zero : s.Handle);
int raw_ret = gst_rtsp_extension_parse_sdp(Handle, sdp == null ? IntPtr.Zero : sdp.Handle, s == null ? IntPtr.Zero : s.Handle);
Gst.Rtsp.RTSPResult ret = (Gst.Rtsp.RTSPResult) raw_ret;
Marshal.FreeHGlobal (native_sdp);
return ret;
}
......
......@@ -67,23 +67,20 @@ namespace Gst.Sdp {
public static string SdpMessageAsUri(string scheme, Gst.Sdp.SDPMessage msg) {
IntPtr native_scheme = GLib.Marshaller.StringToPtrGStrdup (scheme);
IntPtr native_msg = GLib.Marshaller.StructureToPtrAlloc (msg);
IntPtr raw_ret = gst_sdp_message_as_uri(native_scheme, native_msg);
IntPtr raw_ret = gst_sdp_message_as_uri(native_scheme, msg == null ? IntPtr.Zero : msg.Handle);
string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
GLib.Marshaller.Free (native_scheme);
Marshal.FreeHGlobal (native_msg);
return ret;
}
[DllImport("libgstsdp-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int gst_sdp_message_new(IntPtr msg);
static extern int gst_sdp_message_new(out IntPtr msg);
public static Gst.Sdp.SDPResult SdpMessageNew(out Gst.Sdp.SDPMessage msg) {
IntPtr native_msg = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.Sdp.SDPMessage)));
int raw_ret = gst_sdp_message_new(native_msg);
IntPtr native_msg;
int raw_ret = gst_sdp_message_new(out native_msg);
Gst.Sdp.SDPResult ret = (Gst.Sdp.SDPResult) raw_ret;
msg = Gst.Sdp.SDPMessage.New (native_msg);
Marshal.FreeHGlobal (native_msg);
msg = native_msg == IntPtr.Zero ? null : (Gst.Sdp.SDPMessage) GLib.Opaque.GetOpaque (native_msg, typeof (Gst.Sdp.SDPMessage), true);
return ret;
}
......@@ -91,10 +88,8 @@ namespace Gst.Sdp {
static extern int gst_sdp_message_parse_buffer(byte[] data, uint size, IntPtr msg);
public static Gst.Sdp.SDPResult SdpMessageParseBuffer(byte[] data, uint size, Gst.Sdp.SDPMessage msg) {
IntPtr native_msg = GLib.Marshaller.StructureToPtrAlloc (msg);
int raw_ret = gst_sdp_message_parse_buffer(data, size, native_msg);
int raw_ret = gst_sdp_message_parse_buffer(data, size, msg == null ? IntPtr.Zero : msg.Handle);
Gst.Sdp.SDPResult ret = (Gst.Sdp.SDPResult) raw_ret;
Marshal.FreeHGlobal (native_msg);
return ret;
}
......@@ -103,11 +98,9 @@ namespace Gst.Sdp {
public static Gst.Sdp.SDPResult SdpMessageParseUri(string uri, Gst.Sdp.SDPMessage msg) {
IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
IntPtr native_msg = GLib.Marshaller.StructureToPtrAlloc (msg);
int raw_ret = gst_sdp_message_parse_uri(native_uri, native_msg);
int raw_ret = gst_sdp_message_parse_uri(native_uri, msg == null ? IntPtr.Zero : msg.Handle);
Gst.Sdp.SDPResult ret = (Gst.Sdp.SDPResult) raw_ret;
GLib.Marshaller.Free (native_uri);
Marshal.FreeHGlobal (native_msg);
return ret;
}
......
This diff is collapsed.
......@@ -821,6 +821,21 @@ int main (int argc, char *argv[]) {
g_print("\"sizeof(GstMIKEYPayload)\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) sizeof(GstMIKEYPayload));
g_print("\"GstMIKEYPayload.type\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstMIKEYPayload, type));
g_print("\"GstMIKEYPayload.len\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstMIKEYPayload, len));
g_print("\"sizeof(GstSDPMessage)\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) sizeof(GstSDPMessage));
g_print("\"GstSDPMessage.version\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, version));
g_print("\"GstSDPMessage.origin\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, origin));
g_print("\"GstSDPMessage.session_name\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, session_name));
g_print("\"GstSDPMessage.information\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, information));
g_print("\"GstSDPMessage.uri\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, uri));
g_print("\"GstSDPMessage.emails\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, emails));
g_print("\"GstSDPMessage.phones\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, phones));
g_print("\"GstSDPMessage.connection\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, connection));
g_print("\"GstSDPMessage.bandwidths\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, bandwidths));
g_print("\"GstSDPMessage.times\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, times));
g_print("\"GstSDPMessage.zones\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, zones));
g_print("\"GstSDPMessage.key\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, key));
g_print("\"GstSDPMessage.attributes\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, attributes));
g_print("\"GstSDPMessage.medias\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstSDPMessage, medias));
g_print("\"sizeof(GstTagDemuxClass)\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) sizeof(GstTagDemuxClass));
g_print("\"GstTagDemuxClass.min_start_size\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstTagDemuxClass, min_start_size));
g_print("\"GstTagDemuxClass.min_end_size\": \"%" G_GUINT64_FORMAT "\"\n", (guint64) G_STRUCT_OFFSET(GstTagDemuxClass, min_end_size));
......
......@@ -816,6 +816,21 @@ namespace AbiTester {
Console.WriteLine("\"sizeof(GstMIKEYPayload)\": \"" + Gst.Sdp.MIKEYPayload.abi_info.Size + "\"");
Console.WriteLine("\"GstMIKEYPayload.type\": \"" + Gst.Sdp.MIKEYPayload.abi_info.GetFieldOffset("type") + "\"");
Console.WriteLine("\"GstMIKEYPayload.len\": \"" + Gst.Sdp.MIKEYPayload.abi_info.GetFieldOffset("len") + "\"");
Console.WriteLine("\"sizeof(GstSDPMessage)\": \"" + Gst.Sdp.SDPMessage.abi_info.Size + "\"");
Console.WriteLine("\"GstSDPMessage.version\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("version") + "\"");
Console.WriteLine("\"GstSDPMessage.origin\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("origin") + "\"");
Console.WriteLine("\"GstSDPMessage.session_name\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("session_name") + "\"");
Console.WriteLine("\"GstSDPMessage.information\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("information") + "\"");
Console.WriteLine("\"GstSDPMessage.uri\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("uri") + "\"");
Console.WriteLine("\"GstSDPMessage.emails\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("emails") + "\"");
Console.WriteLine("\"GstSDPMessage.phones\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("phones") + "\"");
Console.WriteLine("\"GstSDPMessage.connection\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("connection") + "\"");
Console.WriteLine("\"GstSDPMessage.bandwidths\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("bandwidths") + "\"");
Console.WriteLine("\"GstSDPMessage.times\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("times") + "\"");
Console.WriteLine("\"GstSDPMessage.zones\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("zones") + "\"");
Console.WriteLine("\"GstSDPMessage.key\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("key") + "\"");
Console.WriteLine("\"GstSDPMessage.attributes\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("attributes") + "\"");
Console.WriteLine("\"GstSDPMessage.medias\": \"" + Gst.Sdp.SDPMessage.abi_info.GetFieldOffset("medias") + "\"");
Console.WriteLine("\"sizeof(GstTagDemuxClass)\": \"" + Gst.Tags.TagDemux.class_abi.Size + "\"");
Console.WriteLine("\"GstTagDemuxClass.min_start_size\": \"" + Gst.Tags.TagDemux.class_abi.GetFieldOffset("min_start_size") + "\"");
Console.WriteLine("\"GstTagDemuxClass.min_end_size\": \"" + Gst.Tags.TagDemux.class_abi.GetFieldOffset("min_end_size") + "\"");
......
......@@ -24394,7 +24394,7 @@
</parameters>
</method>
</struct>
<boxed name="SDPMessage" cname="GstSDPMessage" opaque="false" hidden="false">
<boxed name="SDPMessage" cname="GstSDPMessage" opaque="true" hidden="false">
<method name="GetType" cname="gst_sdp_message_get_type" shared="true">
<return-type type="GType" />
</method>
......@@ -371,4 +371,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
<attr path="//*[contains(@cname, 'gst_reserved_p')]" name="padding">true</attr>
<attr path="//*[contains(@cname, 'gst_reserved_i')]" name="padding">true</attr>
<attr path="//*[contains(@cname, 'gst_reserved')]" name="padding">true</attr>
<attr path="/api/namespace/boxed[@cname='GstSDPMessage']" name="opaque">true</attr>
</metadata>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment