Skip to content

Update to the new GtkSharp bindings and regenerate existing bindings

Andoni Morales Alastruey requested to merge ylatuya/gstreamer:csharp_update into main

Fix #1718 (closed)

This MR updates the GStreamer sharp bindings to latest API making use of the recent fixes in GtkSharp that brings many fixes in the generated API:

  • Support for more API use cases not supported before, extending the binded API coverage.
  • Most of the array parameters API's are now correctly generated, and the generated API is functional.
  • It requires almost no API fixup maintenance

Notes:

These changes bring slight API changes in the C# API. They fall into 2 categories:

  1. Fixes in the API that were incorrectly generated (eg: out parameters not marked as such)
  2. Changes in array parameters to make the API more idiomatic (Incorrect marshaling of fixed size array parameters or unneeded length parameters in the C# API).

An example of the first case is:

- public bool GetNaturalFramerate(int framerate_n, int framerate_d) 
+ public bool GetNaturalFramerate(out int framerate_n, outint framerate_d) 

An example of the second case is:

- [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
- static extern uint gst_audio_ring_buffer_read(IntPtr raw, ulong sample, byte[] data, uint len, out ulong timestamp);
- public uint Read(ulong sample, byte[] data, uint len, out ulong timestamp)

+ [DllImport("gstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern uint gst_audio_ring_buffer_read(IntPtr raw, ulong sample, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=3)]byte[] data, uint len, out ulong timestamp);
+ public uint Read(ulong sample, byte[] data, out ulong timestamp)
Edited by Andoni Morales Alastruey

Merge request reports