csharp: Gst: add new value hash API new in 1.28

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9620>
This commit is contained in:
Tim-Philipp Müller 2025-08-29 14:15:06 +01:00 committed by GStreamer Marge Bot
parent c7c5f0e1d5
commit 3765169973
7 changed files with 170 additions and 5 deletions

View File

@ -0,0 +1,98 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace GstSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool ValueHashFuncNative(IntPtr value, out uint res);
internal class ValueHashFuncInvoker {
ValueHashFuncNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~ValueHashFuncInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal ValueHashFuncInvoker (ValueHashFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal ValueHashFuncInvoker (ValueHashFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal ValueHashFuncInvoker (ValueHashFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.ValueHashFunc Handler {
get {
return new Gst.ValueHashFunc(InvokeNative);
}
}
bool InvokeNative (GLib.Value value, out uint res)
{
IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
bool __result = native_cb (native_value, out res);
Marshal.FreeHGlobal (native_value);
return __result;
}
}
internal class ValueHashFuncWrapper {
public bool NativeCallback (IntPtr value, out uint res)
{
try {
bool __ret = managed ((GLib.Value) Marshal.PtrToStructure (value, typeof (GLib.Value)), out res);
if (release_on_call)
gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: Above call does not return.
throw e;
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled ()
{
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal ValueHashFuncNative NativeDelegate;
Gst.ValueHashFunc managed;
public ValueHashFuncWrapper (Gst.ValueHashFunc managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new ValueHashFuncNative (NativeCallback);
}
public static Gst.ValueHashFunc GetManagedDelegate (ValueHashFuncNative native)
{
if (native == null)
return null;
ValueHashFuncWrapper wrapper = (ValueHashFuncWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}

View File

@ -347,6 +347,17 @@ namespace Gst {
return ret;
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gst_value_hash(IntPtr value, out uint res);
public static bool Hash(GLib.Value value, out uint res) {
IntPtr native_value = GLib.Marshaller.StructureToPtrAlloc (value);
bool raw_ret = gst_value_hash(native_value, out res);
bool ret = raw_ret;
Marshal.FreeHGlobal (native_value);
return ret;
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_value_init_and_copy(IntPtr dest, IntPtr src);

View File

@ -0,0 +1,10 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst {
using System;
public delegate bool ValueHashFunc(GLib.Value value, out uint res);
}

View File

@ -37,7 +37,13 @@ namespace Gst {
return GstSharp.ValueDeserializeWithPSpecFuncWrapper.GetManagedDelegate (_deserialize_with_pspec);
}
}
[MarshalAs (UnmanagedType.ByValArray, SizeConst=3)]
private GstSharp.ValueHashFuncNative _hash;
public Gst.ValueHashFunc Hash {
get {
return GstSharp.ValueHashFuncWrapper.GetManagedDelegate (_hash);
}
}
[MarshalAs (UnmanagedType.ByValArray, SizeConst=2)]
private IntPtr[] _gstGstReserved;
public static Gst.ValueTable Zero = new Gst.ValueTable ();
@ -50,7 +56,7 @@ namespace Gst {
public bool Equals (ValueTable other)
{
return true && Type.Equals (other.Type) && Compare.Equals (other.Compare) && Serialize.Equals (other.Serialize) && Deserialize.Equals (other.Deserialize) && DeserializeWithPspec.Equals (other.DeserializeWithPspec);
return true && Type.Equals (other.Type) && Compare.Equals (other.Compare) && Serialize.Equals (other.Serialize) && Deserialize.Equals (other.Deserialize) && DeserializeWithPspec.Equals (other.DeserializeWithPspec) && Hash.Equals (other.Hash);
}
public override bool Equals (object other)
@ -60,7 +66,7 @@ namespace Gst {
public override int GetHashCode ()
{
return this.GetType ().FullName.GetHashCode () ^ Type.GetHashCode () ^ Compare.GetHashCode () ^ Serialize.GetHashCode () ^ Deserialize.GetHashCode () ^ DeserializeWithPspec.GetHashCode ();
return this.GetType ().FullName.GetHashCode () ^ Type.GetHashCode () ^ Compare.GetHashCode () ^ Serialize.GetHashCode () ^ Deserialize.GetHashCode () ^ DeserializeWithPspec.GetHashCode () ^ Hash.GetHashCode ();
}
private static GLib.GType GType {

View File

@ -1474,6 +1474,15 @@
<parameter name="pspec" type="GParamSpec*" />
</parameters>
</callback>
<callback name="ValueHashFunc" cname="GstValueHashFunc" version="1.28">
<return-type type="gboolean" />
<parameters>
<parameter name="value" type="GValue*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="res" type="guint*" owned="true" pass_as="out" />
</parameters>
</callback>
<callback name="ValueSerializeFunc" cname="GstValueSerializeFunc">
<return-type type="gchar*" owned="true" />
<parameters>
@ -12396,7 +12405,8 @@
<field cname="serialize" access="public" writeable="true" readable="true" is_callback="false" name="Serialize" type="GstValueSerializeFunc" />
<field cname="deserialize" access="public" writeable="true" readable="true" is_callback="false" name="Deserialize" type="GstValueDeserializeFunc" />
<field cname="deserialize_with_pspec" access="public" writeable="true" readable="true" is_callback="false" name="DeserializeWithPspec" type="GstValueDeserializeWithPSpecFunc" />
<field cname="_gst_reserved" access="private" writeable="false" readable="false" is_callback="false" name="_gstGstReserved" type="gpointer" array="true" array_len="3" element_type="gpointer" padding="true" />
<field cname="hash" access="public" writeable="true" readable="true" is_callback="false" name="Hash" type="GstValueHashFunc" />
<field cname="_gst_reserved" access="private" writeable="false" readable="false" is_callback="false" name="_gstGstReserved" type="gpointer" array="true" array_len="2" element_type="gpointer" padding="true" />
</struct>
<struct name="VecDeque" cname="GstVecDeque" opaque="true" hidden="false" version="1.26" />
<object name="Global" cname="GstGlobal" opaque="true">
@ -13626,6 +13636,15 @@
</parameter>
</parameters>
</method>
<method name="ValueHash" cname="gst_value_hash" shared="true" version="1.28">
<return-type type="gboolean" />
<parameters>
<parameter name="value" type="GValue*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="res" type="guint*" owned="true" pass_as="out" />
</parameters>
</method>
<method name="ValueInitAndCopy" cname="gst_value_init_and_copy" shared="true">
<return-type type="void" />
<parameters>

View File

@ -738,6 +738,7 @@ generated_sources = [
'Gst/GstSharp.ValueCompareFuncNative.cs',
'Gst/GstSharp.ValueDeserializeFuncNative.cs',
'Gst/GstSharp.ValueDeserializeWithPSpecFuncNative.cs',
'Gst/GstSharp.ValueHashFuncNative.cs',
'Gst/GstSharp.ValueSerializeFuncNative.cs',
'Gst/IChildProxy.cs',
'Gst/IPreset.cs',
@ -935,6 +936,7 @@ generated_sources = [
'Gst/ValueCompareFunc.cs',
'Gst/ValueDeserializeFunc.cs',
'Gst/ValueDeserializeWithPSpecFunc.cs',
'Gst/ValueHashFunc.cs',
'Gst/ValueList.cs',
'Gst/ValueSerializeFunc.cs',
'Gst/ValueTable.cs',

View File

@ -1474,6 +1474,15 @@
<parameter name="pspec" type="GParamSpec*"/>
</parameters>
</callback>
<callback name="ValueHashFunc" cname="GstValueHashFunc" version="1.28">
<return-type type="gboolean"/>
<parameters>
<parameter name="value" type="GValue*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="res" type="guint*" owned="true" pass_as="out"/>
</parameters>
</callback>
<callback name="ValueSerializeFunc" cname="GstValueSerializeFunc">
<return-type type="gchar*" owned="true"/>
<parameters>
@ -12388,7 +12397,8 @@
<field cname="serialize" access="public" writeable="true" readable="true" is_callback="false" name="Serialize" type="GstValueSerializeFunc"/>
<field cname="deserialize" access="public" writeable="true" readable="true" is_callback="false" name="Deserialize" type="GstValueDeserializeFunc"/>
<field cname="deserialize_with_pspec" access="public" writeable="true" readable="true" is_callback="false" name="DeserializeWithPspec" type="GstValueDeserializeWithPSpecFunc"/>
<field cname="_gst_reserved" access="private" writeable="false" readable="false" is_callback="false" name="_gstGstReserved" type="gpointer" array="true" array_len="3" element_type="gpointer"/>
<field cname="hash" access="public" writeable="true" readable="true" is_callback="false" name="Hash" type="GstValueHashFunc"/>
<field cname="_gst_reserved" access="private" writeable="false" readable="false" is_callback="false" name="_gstGstReserved" type="gpointer" array="true" array_len="2" element_type="gpointer"/>
</struct>
<struct name="VecDeque" cname="GstVecDeque" opaque="true" hidden="false" version="1.26"/>
<object name="Global" cname="GstGlobal" opaque="true">
@ -13868,6 +13878,15 @@
</parameter>
</parameters>
</method>
<method name="ValueHash" cname="gst_value_hash" shared="true" version="1.28">
<return-type type="gboolean"/>
<parameters>
<parameter name="value" type="GValue*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="res" type="guint*" owned="true" pass_as="out"/>
</parameters>
</method>
<method name="ValueInitAndCopy" cname="gst_value_init_and_copy" shared="true">
<return-type type="void"/>
<parameters>