Make GstVideo/AudioInfo GLib.Opaque structures

So that we generate a ABI compatible structure and make it working.
Also this is the way we do it for almost all other structures of this
kind.

I first tried to keep having a managed structure that properly matches
the C structure ABI generating in the gtk-sharp generator Explicit structure
for the union as we do with non managed structures but this is not
possible and leads to the following assertion in mono:

    Type Gst.Video.VideoInfo/__ABI which has an [ExplicitLayout] attribute cannot have a reference field at the same offset as another field.

This sensibly changes the API but I bet noone will even notice.

https://bugzilla.gnome.org/show_bug.cgi?id=788133
This commit is contained in:
Thibault Saunier 2017-09-25 18:40:29 -03:00
parent 78b259e358
commit b5beac1217
3 changed files with 4 additions and 2 deletions

View file

@ -125,7 +125,7 @@ namespace GstreamerSharp
{
b = 1;
d = 1;
Gst.Audio.AudioInfo info = Gst.Audio.AudioInfo.Zero;
Gst.Audio.AudioInfo info = new Gst.Audio.AudioInfo();
// Initialize Gstreamer
Gst.Application.Init(ref args);

View file

@ -93,7 +93,7 @@ namespace GstreamerSharp
// This function is called when playbin has created the appsrc element, so we have a chance to configure it.
static void SourceSetup (object sender, GLib.SignalArgs args) {
var info = Gst.Audio.AudioInfo.Zero;
var info = new Gst.Audio.AudioInfo();
var source = new Gst.App.AppSrc(((Element)args.Args [0]).Handle);
Console.WriteLine ("Source has been created. Configuring.");
AppSource = source;

View file

@ -38,6 +38,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
<attr path="/api/namespace/boxed[@cname='GstSample']" name="opaque">true</attr>
<attr path="/api/namespace/boxed[@cname='GstSample']" name="parent">GstMiniObject</attr>
<attr path="/api/namespace/boxed[@cname='GstAudioInfo']" name="opaque">true</attr>
<attr path="/api/namespace/boxed[@cname='GstVideoInfo']" name="opaque">true</attr>
<attr path="/api/namespace/boxed[@cname='GstAtomicQueue']" name="opaque">true</attr>
<attr path="/api/namespace/boxed[@cname='GstParseContext']" name="opaque">true</attr>
<attr path="/api/namespace/object[@cname='GstElementFactory']" name="opaque">true</attr>