csharp: fix GstAudioRingBuffer structure size and field offset mismatches

.. which caused the gstreamer_sharp_abi unit test to fail.

GstAudioRingBuffer has segdone and segbase as struct fields and
a get/set API with the same name but different types. The fields
have been deprecated and are no longer used now, and they need to
be hidden and we also need to rename them so that the generator
does not mix types (the setter/getters use guint64 but the fields
have gint types, which caused some type confusion in the generator).

Co-authored by: Andoni Morales Alastruey <ylatuya@gmail.com>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8541>
This commit is contained in:
Tim-Philipp Müller 2025-02-27 14:44:11 +00:00
parent 458494c8e5
commit 3523ba76ae
4 changed files with 41 additions and 33 deletions

View File

@ -4538,4 +4538,4 @@
<constant value="1" ctype="gint" gtype="gint" name="VERSION_NANO" /> <constant value="1" ctype="gint" gtype="gint" name="VERSION_NANO" />
</object> </object>
</namespace> </namespace>
</api> </api>

View File

@ -99,34 +99,6 @@ namespace Gst.Audio {
} }
} }
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern ulong gst_audio_ring_buffer_get_segdone(IntPtr raw);
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_audio_ring_buffer_set_segdone(IntPtr raw, ulong segdone);
public ulong Segdone {
get {
ulong raw_ret = gst_audio_ring_buffer_get_segdone(Handle);
ulong ret = raw_ret;
return ret;
}
set {
gst_audio_ring_buffer_set_segdone(Handle, value);
}
}
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern ulong gst_audio_ring_buffer_get_segbase(IntPtr raw);
public ulong Segbase {
get {
ulong raw_ret = gst_audio_ring_buffer_get_segbase(Handle);
ulong ret = raw_ret;
return ret;
}
}
public int Waiting { public int Waiting {
get { get {
unsafe { unsafe {
@ -1076,6 +1048,34 @@ namespace Gst.Audio {
return ret; return ret;
} }
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern ulong gst_audio_ring_buffer_get_segbase(IntPtr raw);
public ulong Segbase {
get {
ulong raw_ret = gst_audio_ring_buffer_get_segbase(Handle);
ulong ret = raw_ret;
return ret;
}
}
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern ulong gst_audio_ring_buffer_get_segdone(IntPtr raw);
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_audio_ring_buffer_set_segdone(IntPtr raw, ulong segdone);
public ulong Segdone {
get {
ulong raw_ret = gst_audio_ring_buffer_get_segdone(Handle);
ulong ret = raw_ret;
return ret;
}
set {
gst_audio_ring_buffer_set_segdone(Handle, value);
}
}
[DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gst_audio_ring_buffer_is_acquired(IntPtr raw); static extern bool gst_audio_ring_buffer_is_acquired(IntPtr raw);
@ -1497,14 +1497,14 @@ namespace Gst.Audio {
public struct GstAudioRingBuffer_segdoneAlign public struct GstAudioRingBuffer_segdoneAlign
{ {
sbyte f1; sbyte f1;
private ulong segdone; private int segdone;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct GstAudioRingBuffer_segbaseAlign public struct GstAudioRingBuffer_segbaseAlign
{ {
sbyte f1; sbyte f1;
private ulong segbase; private int segbase;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]

View File

@ -16780,8 +16780,8 @@
<field cname="samples_per_seg" access="public" writeable="false" readable="true" is_callback="false" name="SamplesPerSeg" type="gint" /> <field cname="samples_per_seg" access="public" writeable="false" readable="true" is_callback="false" name="SamplesPerSeg" type="gint" />
<field cname="empty_seg" access="public" writeable="false" readable="true" is_callback="false" name="EmptySeg" type="guint8*" /> <field cname="empty_seg" access="public" writeable="false" readable="true" is_callback="false" name="EmptySeg" type="guint8*" />
<field cname="state" access="public" writeable="false" readable="true" is_callback="false" name="State" type="gint" /> <field cname="state" access="public" writeable="false" readable="true" is_callback="false" name="State" type="gint" />
<field cname="segdone" access="public" writeable="false" readable="true" is_callback="false" name="Segdone" type="gint" /> <field cname="segdone" access="public" writeable="false" readable="true" is_callback="false" name="SegdoneField" type="gint" hidden="true" />
<field cname="segbase" access="public" writeable="false" readable="true" is_callback="false" name="Segbase" type="gint" /> <field cname="segbase" access="public" writeable="false" readable="true" is_callback="false" name="SegbaseField" type="gint" hidden="true" />
<field cname="waiting" access="public" writeable="false" readable="true" is_callback="false" name="Waiting" type="gint" /> <field cname="waiting" access="public" writeable="false" readable="true" is_callback="false" name="Waiting" type="gint" />
<field cname="callback" access="private" writeable="false" readable="false" is_callback="false" name="Callback" type="GstAudioRingBufferCallback" /> <field cname="callback" access="private" writeable="false" readable="false" is_callback="false" name="Callback" type="GstAudioRingBufferCallback" />
<field cname="cb_data" access="private" writeable="false" readable="false" is_callback="false" name="CbData" type="gpointer" /> <field cname="cb_data" access="private" writeable="false" readable="false" is_callback="false" name="CbData" type="gpointer" />

View File

@ -341,6 +341,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
<attr path="//callback[@cname='GstAudioFormatUnpack']/parameters/parameter[@name='length']" name="name">n_length</attr> <attr path="//callback[@cname='GstAudioFormatUnpack']/parameters/parameter[@name='length']" name="name">n_length</attr>
<attr path="/api/namespace/object[@cname='GstObject']/field[@cname='flags']" name="writeable">true</attr> <attr path="/api/namespace/object[@cname='GstObject']/field[@cname='flags']" name="writeable">true</attr>
<attr path="/api/namespace/object[@cname='GstAudioRingBuffer']/field[@cname='empty_seg']" name="type">guint8*</attr> <attr path="/api/namespace/object[@cname='GstAudioRingBuffer']/field[@cname='empty_seg']" name="type">guint8*</attr>
<!-- GstAudioRingBuffer has segdone and segbase as struct fields and a get/set API with the same name but different types.
The fields have been deprecated and they need to be hidden and we also need to rename them so that the generator does not mix types. -->
<attr path="//object[@cname='GstAudioRingBuffer']/field[@cname='segdone']" name="name">SegdoneField</attr>
<attr path="//object[@cname='GstAudioRingBuffer']/field[@cname='segdone']" name="hidden">true</attr>
<attr path="//object[@cname='GstAudioRingBuffer']/field[@cname='segbase']" name="name">SegbaseField</attr>
<attr path="//object[@cname='GstAudioRingBuffer']/field[@cname='segbase']" name="hidden">true</attr>
<attr path="/api/namespace/struct[@cname='GstMIKEYPayloadKeyData']/field[@cname='key_data']" name="type">guint8*</attr> <attr path="/api/namespace/struct[@cname='GstMIKEYPayloadKeyData']/field[@cname='key_data']" name="type">guint8*</attr>
<attr path="/api/namespace/struct[@cname='GstMIKEYPayloadKeyData']/field[@cname='salt_data']" name="type">guint8*</attr> <attr path="/api/namespace/struct[@cname='GstMIKEYPayloadKeyData']/field[@cname='salt_data']" name="type">guint8*</attr>
<attr path="/api/namespace/struct[@cname='GstMIKEYPayloadKeyData']/field[@cname='kv_data']" name="type">guint8*</attr> <attr path="/api/namespace/struct[@cname='GstMIKEYPayloadKeyData']/field[@cname='kv_data']" name="type">guint8*</attr>