csharp: Gst: add LogContext 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 15:13:27 +01:00 committed by GStreamer Marge Bot
parent b2daa4400d
commit 83351aed41
8 changed files with 293 additions and 0 deletions

View File

@ -198,6 +198,25 @@ namespace Gst {
LogIdLiteral (category, level, file, function, line, null, message_string);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_debug_log_id_literal_with_context(IntPtr ctx, int level, IntPtr file, IntPtr function, int line, IntPtr id, IntPtr message);
public static void LogIdLiteralWithContext(Gst.LogContext ctx, Gst.DebugLevel level, string file, string function, int line, string id, string message) {
IntPtr native_file = GLib.Marshaller.StringToPtrGStrdup (file);
IntPtr native_function = GLib.Marshaller.StringToPtrGStrdup (function);
IntPtr native_id = GLib.Marshaller.StringToPtrGStrdup (id);
IntPtr native_message = GLib.Marshaller.StringToPtrGStrdup (message);
gst_debug_log_id_literal_with_context(ctx == null ? IntPtr.Zero : ctx.Handle, (int) level, native_file, native_function, line, native_id, native_message);
GLib.Marshaller.Free (native_file);
GLib.Marshaller.Free (native_function);
GLib.Marshaller.Free (native_id);
GLib.Marshaller.Free (native_message);
}
public static void LogIdLiteralWithContext(Gst.LogContext ctx, Gst.DebugLevel level, string file, string function, int line, string message) {
LogIdLiteralWithContext (ctx, level, file, function, line, null, message);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_debug_log_literal(IntPtr category, int level, IntPtr file, IntPtr function, int line, IntPtr _object, IntPtr message_string);
@ -217,6 +236,23 @@ namespace Gst {
LogLiteral (category, level, file, function, line, null, message_string);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_debug_log_literal_with_context(IntPtr ctx, int level, IntPtr file, IntPtr function, int line, IntPtr _object, IntPtr message);
public static void LogLiteralWithContext(Gst.LogContext ctx, Gst.DebugLevel level, string file, string function, int line, GLib.Object _object, string message) {
IntPtr native_file = GLib.Marshaller.StringToPtrGStrdup (file);
IntPtr native_function = GLib.Marshaller.StringToPtrGStrdup (function);
IntPtr native_message = GLib.Marshaller.StringToPtrGStrdup (message);
gst_debug_log_literal_with_context(ctx == null ? IntPtr.Zero : ctx.Handle, (int) level, native_file, native_function, line, _object == null ? IntPtr.Zero : _object.Handle, native_message);
GLib.Marshaller.Free (native_file);
GLib.Marshaller.Free (native_function);
GLib.Marshaller.Free (native_message);
}
public static void LogLiteralWithContext(Gst.LogContext ctx, Gst.DebugLevel level, string file, string function, int line, string message) {
LogLiteralWithContext (ctx, level, file, function, line, null, message);
}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_debug_print_object(IntPtr ptr);

View File

@ -0,0 +1,55 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#region Autogenerated code
public partial class LogContext : GLib.Opaque {
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_log_context_reset(IntPtr raw);
public void Reset() {
gst_log_context_reset(Handle);
}
public LogContext(IntPtr raw) : base(raw) {}
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_log_context_free(IntPtr raw);
protected override void Free (IntPtr raw)
{
gst_log_context_free (raw);
}
protected override Action<IntPtr> DisposeUnmanagedFunc {
get {
return gst_log_context_free;
}
}
// Internal representation of the wrapped structure ABI.
static GLib.AbiStruct _abi_info = null;
static public GLib.AbiStruct abi_info {
get {
if (_abi_info == null)
_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{
});
return _abi_info;
}
}
// End of the ABI representation.
#endregion
}
}

View File

@ -0,0 +1,34 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#region Autogenerated code
public partial class LogContextBuilder : GLib.Opaque {
public LogContextBuilder(IntPtr raw) : base(raw) {}
// Internal representation of the wrapped structure ABI.
static GLib.AbiStruct _abi_info = null;
static public GLib.AbiStruct abi_info {
get {
if (_abi_info == null)
_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{
});
return _abi_info;
}
}
// End of the ABI representation.
#endregion
}
}

View File

@ -0,0 +1,29 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[Flags]
[GLib.GType (typeof (Gst.LogContextFlagsGType))]
public enum LogContextFlags : uint {
None = 0,
Throttle = 1,
}
internal class LogContextFlagsGType {
[DllImport ("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_log_context_flags_get_type ();
public static GLib.GType GType {
get {
return new GLib.GType (gst_log_context_flags_get_type ());
}
}
}
#endregion
}

View File

@ -0,0 +1,33 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[Flags]
[GLib.GType (typeof (Gst.LogContextHashFlagsGType))]
public enum LogContextHashFlags : uint {
Default = 0,
IgnoreObject = 1,
IgnoreFormat = 2,
IgnoreFile = 4,
UseLineNumber = 8,
UseStringArgs = 16,
}
internal class LogContextHashFlagsGType {
[DllImport ("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_log_context_hash_flags_get_type ();
public static GLib.GType GType {
get {
return new GLib.GType (gst_log_context_hash_flags_get_type ());
}
}
}
#endregion
}

View File

@ -505,6 +505,18 @@
<member cname="GST_LOCK_FLAG_EXCLUSIVE" name="Exclusive" value="4" />
<member cname="GST_LOCK_FLAG_LAST" name="Last" value="256" />
</enum>
<enum name="LogContextFlags" cname="GstLogContextFlags" type="flags" gtype="gst_log_context_flags_get_type" version="1.28">
<member cname="GST_LOG_CONTEXT_FLAG_NONE" name="None" value="0" />
<member cname="GST_LOG_CONTEXT_FLAG_THROTTLE" name="Throttle" value="1" />
</enum>
<enum name="LogContextHashFlags" cname="GstLogContextHashFlags" type="flags" gtype="gst_log_context_hash_flags_get_type" version="1.28">
<member cname="GST_LOG_CONTEXT_DEFAULT" name="Default" value="0" />
<member cname="GST_LOG_CONTEXT_IGNORE_OBJECT" name="IgnoreObject" value="1" />
<member cname="GST_LOG_CONTEXT_IGNORE_FORMAT" name="IgnoreFormat" value="2" />
<member cname="GST_LOG_CONTEXT_IGNORE_FILE" name="IgnoreFile" value="4" />
<member cname="GST_LOG_CONTEXT_USE_LINE_NUMBER" name="UseLineNumber" value="8" />
<member cname="GST_LOG_CONTEXT_USE_STRING_ARGS" name="UseStringArgs" value="16" />
</enum>
<enum name="MapFlags" cname="GstMapFlags" type="flags" gtype="gst_map_flags_get_type">
<member cname="GST_MAP_READ" name="Read" value="1" />
<member cname="GST_MAP_WRITE" name="Write" value="2" />
@ -8533,6 +8545,17 @@
<interface name="IEnumerable" doc="https://docs.microsoft.com/fr-fr/dotnet/api/system.collections.ienumerable" />
</implements>
</boxed>
<struct name="LogContext" cname="GstLogContext" opaque="true" hidden="false" version="1.28">
<method name="Free" cname="gst_log_context_free" version="1.28">
<return-type type="void" />
<parameters />
</method>
<method name="Reset" cname="gst_log_context_reset" version="1.28">
<return-type type="void" />
<parameters />
</method>
</struct>
<struct name="LogContextBuilder" cname="GstLogContextBuilder" opaque="true" hidden="false" version="1.28" />
<struct name="MapInfo" cname="GstMapInfo" opaque="false" hidden="false">
<field cname="memory" access="public" writeable="true" readable="true" is_callback="false" name="Memory" type="GstMemory*">
<warning>missing glib:type-name</warning>
@ -13239,6 +13262,20 @@
<parameter name="message_string" type="const-gchar*" />
</parameters>
</method>
<method name="DebugLogIdLiteralWithContext" cname="gst_debug_log_id_literal_with_context" shared="true" version="1.28">
<return-type type="void" />
<parameters>
<parameter name="ctx" type="GstLogContext*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="level" type="GstDebugLevel" />
<parameter name="file" type="const-gchar*" />
<parameter name="function" type="const-gchar*" />
<parameter name="line" type="gint" />
<parameter allow-none="1" name="id" type="const-gchar*" />
<parameter name="message" type="const-gchar*" />
</parameters>
</method>
<method name="DebugLogLiteral" cname="gst_debug_log_literal" shared="true" version="1.20">
<return-type type="void" />
<parameters>
@ -13253,6 +13290,20 @@
<parameter name="message_string" type="const-gchar*" />
</parameters>
</method>
<method name="DebugLogLiteralWithContext" cname="gst_debug_log_literal_with_context" shared="true" version="1.28">
<return-type type="void" />
<parameters>
<parameter name="ctx" type="GstLogContext*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="level" type="GstDebugLevel" />
<parameter name="file" type="const-gchar*" />
<parameter name="function" type="const-gchar*" />
<parameter name="line" type="gint" />
<parameter allow-none="1" name="_object" type="GObject*" />
<parameter name="message" type="const-gchar*" />
</parameters>
</method>
<method name="DebugPrintObject" cname="gst_debug_print_object" shared="true" version="1.26">
<return-type type="gchar*" owned="true" />
<parameters>

View File

@ -761,6 +761,10 @@ generated_sources = [
'Gst/LinkedHandler.cs',
'Gst/LockFlags.cs',
'Gst/LogFunction.cs',
'Gst/LogContext.cs',
'Gst/LogContextBuilder.cs',
'Gst/LogContextFlags.cs',
'Gst/LogContextHashFlags.cs',
'Gst/MapFlags.cs',
'Gst/MapInfo.cs',
'Gst/Memory.cs',

View File

@ -505,6 +505,18 @@
<member cname="GST_LOCK_FLAG_EXCLUSIVE" name="Exclusive" value="4"/>
<member cname="GST_LOCK_FLAG_LAST" name="Last" value="256"/>
</enum>
<enum name="LogContextFlags" cname="GstLogContextFlags" type="flags" gtype="gst_log_context_flags_get_type" version="1.28">
<member cname="GST_LOG_CONTEXT_FLAG_NONE" name="None" value="0"/>
<member cname="GST_LOG_CONTEXT_FLAG_THROTTLE" name="Throttle" value="1"/>
</enum>
<enum name="LogContextHashFlags" cname="GstLogContextHashFlags" type="flags" gtype="gst_log_context_hash_flags_get_type" version="1.28">
<member cname="GST_LOG_CONTEXT_DEFAULT" name="Default" value="0"/>
<member cname="GST_LOG_CONTEXT_IGNORE_OBJECT" name="IgnoreObject" value="1"/>
<member cname="GST_LOG_CONTEXT_IGNORE_FORMAT" name="IgnoreFormat" value="2"/>
<member cname="GST_LOG_CONTEXT_IGNORE_FILE" name="IgnoreFile" value="4"/>
<member cname="GST_LOG_CONTEXT_USE_LINE_NUMBER" name="UseLineNumber" value="8"/>
<member cname="GST_LOG_CONTEXT_USE_STRING_ARGS" name="UseStringArgs" value="16"/>
</enum>
<enum name="MapFlags" cname="GstMapFlags" type="flags" gtype="gst_map_flags_get_type">
<member cname="GST_MAP_READ" name="Read" value="1"/>
<member cname="GST_MAP_WRITE" name="Write" value="2"/>
@ -8525,6 +8537,17 @@
<parameters/>
</method>
</boxed>
<struct name="LogContext" cname="GstLogContext" opaque="true" hidden="false" version="1.28">
<method name="Free" cname="gst_log_context_free" version="1.28">
<return-type type="void"/>
<parameters/>
</method>
<method name="Reset" cname="gst_log_context_reset" version="1.28">
<return-type type="void"/>
<parameters/>
</method>
</struct>
<struct name="LogContextBuilder" cname="GstLogContextBuilder" opaque="true" hidden="false" version="1.28"/>
<struct name="MapInfo" cname="GstMapInfo" opaque="false" hidden="false">
<field cname="memory" access="public" writeable="true" readable="true" is_callback="false" name="Memory" type="GstMemory*">
<warning>missing glib:type-name</warning>
@ -12583,6 +12606,20 @@
<parameter name="message_string" type="const-gchar*"/>
</parameters>
</method>
<method name="DebugLogIdLiteralWithContext" cname="gst_debug_log_id_literal_with_context" shared="true" version="1.28">
<return-type type="void"/>
<parameters>
<parameter name="ctx" type="GstLogContext*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="level" type="GstDebugLevel"/>
<parameter name="file" type="const-gchar*"/>
<parameter name="function" type="const-gchar*"/>
<parameter name="line" type="gint"/>
<parameter allow-none="1" name="id" type="const-gchar*"/>
<parameter name="message" type="const-gchar*"/>
</parameters>
</method>
<method name="DebugLogLiteral" cname="gst_debug_log_literal" shared="true" version="1.20">
<return-type type="void"/>
<parameters>
@ -12597,6 +12634,20 @@
<parameter name="message_string" type="const-gchar*"/>
</parameters>
</method>
<method name="DebugLogLiteralWithContext" cname="gst_debug_log_literal_with_context" shared="true" version="1.28">
<return-type type="void"/>
<parameters>
<parameter name="ctx" type="GstLogContext*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="level" type="GstDebugLevel"/>
<parameter name="file" type="const-gchar*"/>
<parameter name="function" type="const-gchar*"/>
<parameter name="line" type="gint"/>
<parameter allow-none="1" name="_object" type="GObject*"/>
<parameter name="message" type="const-gchar*"/>
</parameters>
</method>
<method name="DebugPrintObject" cname="gst_debug_print_object" shared="true" version="1.26">
<return-type type="gchar*" owned="true"/>
<parameters>