mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Declare GstVideoOverlayComposition/Rectangle as opaque type and subclasses of Gst.MiniObject
This changes the API. Without this change all usage will cause memory corruption and simply does not work.
This commit is contained in:
parent
a7ac9ee4fb
commit
c5090bdd21
6 changed files with 57 additions and 91 deletions
|
@ -52,15 +52,13 @@ namespace Gst.Video {
|
||||||
static extern IntPtr gst_buffer_add_video_overlay_composition_meta(IntPtr buf, IntPtr comp);
|
static extern IntPtr gst_buffer_add_video_overlay_composition_meta(IntPtr buf, IntPtr comp);
|
||||||
|
|
||||||
public static Gst.Video.VideoOverlayCompositionMeta BufferAddVideoOverlayCompositionMeta(Gst.Buffer buf, Gst.Video.VideoOverlayComposition comp) {
|
public static Gst.Video.VideoOverlayCompositionMeta BufferAddVideoOverlayCompositionMeta(Gst.Buffer buf, Gst.Video.VideoOverlayComposition comp) {
|
||||||
IntPtr native_comp = GLib.Marshaller.StructureToPtrAlloc (comp);
|
IntPtr raw_ret = gst_buffer_add_video_overlay_composition_meta(buf == null ? IntPtr.Zero : buf.Handle, comp == null ? IntPtr.Zero : comp.Handle);
|
||||||
IntPtr raw_ret = gst_buffer_add_video_overlay_composition_meta(buf == null ? IntPtr.Zero : buf.Handle, native_comp);
|
|
||||||
Gst.Video.VideoOverlayCompositionMeta ret = Gst.Video.VideoOverlayCompositionMeta.New (raw_ret);
|
Gst.Video.VideoOverlayCompositionMeta ret = Gst.Video.VideoOverlayCompositionMeta.New (raw_ret);
|
||||||
Marshal.FreeHGlobal (native_comp);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Gst.Video.VideoOverlayCompositionMeta BufferAddVideoOverlayCompositionMeta(Gst.Buffer buf) {
|
public static Gst.Video.VideoOverlayCompositionMeta BufferAddVideoOverlayCompositionMeta(Gst.Buffer buf) {
|
||||||
return BufferAddVideoOverlayCompositionMeta (buf, Gst.Video.VideoOverlayComposition.Zero);
|
return BufferAddVideoOverlayCompositionMeta (buf, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
|
|
@ -9,26 +9,7 @@ namespace Gst.Video {
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
#region Autogenerated code
|
#region Autogenerated code
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
public partial class VideoOverlayComposition : Gst.MiniObject {
|
||||||
public partial struct VideoOverlayComposition : IEquatable<VideoOverlayComposition> {
|
|
||||||
|
|
||||||
|
|
||||||
public static Gst.Video.VideoOverlayComposition Zero = new Gst.Video.VideoOverlayComposition ();
|
|
||||||
|
|
||||||
public static Gst.Video.VideoOverlayComposition New(IntPtr raw) {
|
|
||||||
if (raw == IntPtr.Zero)
|
|
||||||
return Gst.Video.VideoOverlayComposition.Zero;
|
|
||||||
return (Gst.Video.VideoOverlayComposition) Marshal.PtrToStructure (raw, typeof (Gst.Video.VideoOverlayComposition));
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
static extern IntPtr gst_video_overlay_composition_new(IntPtr rectangle);
|
|
||||||
|
|
||||||
public static VideoOverlayComposition New(Gst.Video.VideoOverlayRectangle rectangle)
|
|
||||||
{
|
|
||||||
VideoOverlayComposition result = VideoOverlayComposition.New (gst_video_overlay_composition_new(rectangle == null ? IntPtr.Zero : rectangle.Handle));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern IntPtr gst_video_overlay_composition_get_type();
|
static extern IntPtr gst_video_overlay_composition_get_type();
|
||||||
|
@ -45,38 +26,35 @@ namespace Gst.Video {
|
||||||
static extern void gst_video_overlay_composition_add_rectangle(IntPtr raw, IntPtr rectangle);
|
static extern void gst_video_overlay_composition_add_rectangle(IntPtr raw, IntPtr rectangle);
|
||||||
|
|
||||||
public void AddRectangle(Gst.Video.VideoOverlayRectangle rectangle) {
|
public void AddRectangle(Gst.Video.VideoOverlayRectangle rectangle) {
|
||||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
gst_video_overlay_composition_add_rectangle(Handle, rectangle == null ? IntPtr.Zero : rectangle.Handle);
|
||||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
|
||||||
gst_video_overlay_composition_add_rectangle(this_as_native, rectangle == null ? IntPtr.Zero : rectangle.Handle);
|
|
||||||
ReadNative (this_as_native, ref this);
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern bool gst_video_overlay_composition_blend(IntPtr raw, IntPtr video_buf);
|
static extern bool gst_video_overlay_composition_blend(IntPtr raw, IntPtr video_buf);
|
||||||
|
|
||||||
public bool Blend(Gst.Video.VideoFrame video_buf) {
|
public bool Blend(Gst.Video.VideoFrame video_buf) {
|
||||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
|
||||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
|
||||||
IntPtr native_video_buf = GLib.Marshaller.StructureToPtrAlloc (video_buf);
|
IntPtr native_video_buf = GLib.Marshaller.StructureToPtrAlloc (video_buf);
|
||||||
bool raw_ret = gst_video_overlay_composition_blend(this_as_native, native_video_buf);
|
bool raw_ret = gst_video_overlay_composition_blend(Handle, native_video_buf);
|
||||||
bool ret = raw_ret;
|
bool ret = raw_ret;
|
||||||
ReadNative (this_as_native, ref this);
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
|
||||||
Marshal.FreeHGlobal (native_video_buf);
|
Marshal.FreeHGlobal (native_video_buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
static extern IntPtr gst_video_overlay_composition_copy(IntPtr raw);
|
||||||
|
|
||||||
|
public Gst.Video.VideoOverlayComposition Copy() {
|
||||||
|
IntPtr raw_ret = gst_video_overlay_composition_copy(Handle);
|
||||||
|
Gst.Video.VideoOverlayComposition ret = raw_ret == IntPtr.Zero ? null : (Gst.Video.VideoOverlayComposition) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Video.VideoOverlayComposition), true);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern IntPtr gst_video_overlay_composition_get_rectangle(IntPtr raw, uint n);
|
static extern IntPtr gst_video_overlay_composition_get_rectangle(IntPtr raw, uint n);
|
||||||
|
|
||||||
public Gst.Video.VideoOverlayRectangle GetRectangle(uint n) {
|
public Gst.Video.VideoOverlayRectangle GetRectangle(uint n) {
|
||||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
IntPtr raw_ret = gst_video_overlay_composition_get_rectangle(Handle, n);
|
||||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
|
||||||
IntPtr raw_ret = gst_video_overlay_composition_get_rectangle(this_as_native, n);
|
|
||||||
Gst.Video.VideoOverlayRectangle ret = raw_ret == IntPtr.Zero ? null : (Gst.Video.VideoOverlayRectangle) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Video.VideoOverlayRectangle), false);
|
Gst.Video.VideoOverlayRectangle ret = raw_ret == IntPtr.Zero ? null : (Gst.Video.VideoOverlayRectangle) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Video.VideoOverlayRectangle), false);
|
||||||
ReadNative (this_as_native, ref this);
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +63,8 @@ namespace Gst.Video {
|
||||||
|
|
||||||
public uint Seqnum {
|
public uint Seqnum {
|
||||||
get {
|
get {
|
||||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
uint raw_ret = gst_video_overlay_composition_get_seqnum(Handle);
|
||||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
|
||||||
uint raw_ret = gst_video_overlay_composition_get_seqnum(this_as_native);
|
|
||||||
uint ret = raw_ret;
|
uint ret = raw_ret;
|
||||||
ReadNative (this_as_native, ref this);
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,12 +73,8 @@ namespace Gst.Video {
|
||||||
static extern IntPtr gst_video_overlay_composition_make_writable(IntPtr raw);
|
static extern IntPtr gst_video_overlay_composition_make_writable(IntPtr raw);
|
||||||
|
|
||||||
public Gst.Video.VideoOverlayComposition MakeWritable() {
|
public Gst.Video.VideoOverlayComposition MakeWritable() {
|
||||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
IntPtr raw_ret = gst_video_overlay_composition_make_writable(Handle);
|
||||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
Gst.Video.VideoOverlayComposition ret = raw_ret == IntPtr.Zero ? null : (Gst.Video.VideoOverlayComposition) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Video.VideoOverlayComposition), true);
|
||||||
IntPtr raw_ret = gst_video_overlay_composition_make_writable(this_as_native);
|
|
||||||
Gst.Video.VideoOverlayComposition ret = Gst.Video.VideoOverlayComposition.New (raw_ret);
|
|
||||||
ReadNative (this_as_native, ref this);
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,47 +82,36 @@ namespace Gst.Video {
|
||||||
static extern uint gst_video_overlay_composition_n_rectangles(IntPtr raw);
|
static extern uint gst_video_overlay_composition_n_rectangles(IntPtr raw);
|
||||||
|
|
||||||
public uint NRectangles() {
|
public uint NRectangles() {
|
||||||
IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
|
uint raw_ret = gst_video_overlay_composition_n_rectangles(Handle);
|
||||||
System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
|
|
||||||
uint raw_ret = gst_video_overlay_composition_n_rectangles(this_as_native);
|
|
||||||
uint ret = raw_ret;
|
uint ret = raw_ret;
|
||||||
ReadNative (this_as_native, ref this);
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ReadNative (IntPtr native, ref Gst.Video.VideoOverlayComposition target)
|
public VideoOverlayComposition(IntPtr raw) : base(raw) {}
|
||||||
|
|
||||||
|
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
static extern IntPtr gst_video_overlay_composition_new(IntPtr rectangle);
|
||||||
|
|
||||||
|
public VideoOverlayComposition (Gst.Video.VideoOverlayRectangle rectangle)
|
||||||
{
|
{
|
||||||
target = New (native);
|
Raw = gst_video_overlay_composition_new(rectangle == null ? IntPtr.Zero : rectangle.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals (VideoOverlayComposition other)
|
|
||||||
{
|
// Internal representation of the wrapped structure ABI.
|
||||||
return true;
|
static GLib.AbiStruct _abi_info = null;
|
||||||
|
static public new GLib.AbiStruct abi_info {
|
||||||
|
get {
|
||||||
|
if (_abi_info == null)
|
||||||
|
_abi_info = new GLib.AbiStruct (Gst.MiniObject.abi_info.Fields);
|
||||||
|
|
||||||
|
return _abi_info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals (object other)
|
|
||||||
{
|
|
||||||
return other is VideoOverlayComposition && Equals ((VideoOverlayComposition) other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode ()
|
// End of the ABI representation.
|
||||||
{
|
|
||||||
return this.GetType ().FullName.GetHashCode ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static explicit operator GLib.Value (Gst.Video.VideoOverlayComposition boxed)
|
|
||||||
{
|
|
||||||
GLib.Value val = GLib.Value.Empty;
|
|
||||||
val.Init (Gst.Video.VideoOverlayComposition.GType);
|
|
||||||
val.Val = boxed;
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static explicit operator Gst.Video.VideoOverlayComposition (GLib.Value val)
|
|
||||||
{
|
|
||||||
return (Gst.Video.VideoOverlayComposition) val.Val;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,13 @@ namespace Gst.Video {
|
||||||
|
|
||||||
public Gst.Meta Meta;
|
public Gst.Meta Meta;
|
||||||
private IntPtr _overlay;
|
private IntPtr _overlay;
|
||||||
|
public Gst.Video.VideoOverlayComposition Overlay {
|
||||||
public Gst.Video.VideoOverlayComposition overlay {
|
get {
|
||||||
get { return Gst.Video.VideoOverlayComposition.New (_overlay); }
|
return _overlay == IntPtr.Zero ? null : (Gst.Video.VideoOverlayComposition) GLib.Opaque.GetOpaque (_overlay, typeof (Gst.Video.VideoOverlayComposition), false);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
_overlay = value == null ? IntPtr.Zero : value.Handle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Gst.Video.VideoOverlayCompositionMeta Zero = new Gst.Video.VideoOverlayCompositionMeta ();
|
public static Gst.Video.VideoOverlayCompositionMeta Zero = new Gst.Video.VideoOverlayCompositionMeta ();
|
||||||
|
@ -40,7 +44,7 @@ namespace Gst.Video {
|
||||||
|
|
||||||
public bool Equals (VideoOverlayCompositionMeta other)
|
public bool Equals (VideoOverlayCompositionMeta other)
|
||||||
{
|
{
|
||||||
return true && Meta.Equals (other.Meta) && overlay.Equals (other.overlay);
|
return true && Meta.Equals (other.Meta) && Overlay.Equals (other.Overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals (object other)
|
public override bool Equals (object other)
|
||||||
|
@ -50,7 +54,7 @@ namespace Gst.Video {
|
||||||
|
|
||||||
public override int GetHashCode ()
|
public override int GetHashCode ()
|
||||||
{
|
{
|
||||||
return this.GetType ().FullName.GetHashCode () ^ Meta.GetHashCode () ^ overlay.GetHashCode ();
|
return this.GetType ().FullName.GetHashCode () ^ Meta.GetHashCode () ^ Overlay.GetHashCode ();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GLib.GType GType {
|
private static GLib.GType GType {
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Gst.Video {
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
#region Autogenerated code
|
#region Autogenerated code
|
||||||
public partial class VideoOverlayRectangle : GLib.Opaque {
|
public partial class VideoOverlayRectangle : Gst.MiniObject {
|
||||||
|
|
||||||
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern IntPtr gst_video_overlay_rectangle_get_type();
|
static extern IntPtr gst_video_overlay_rectangle_get_type();
|
||||||
|
@ -153,11 +153,10 @@ namespace Gst.Video {
|
||||||
|
|
||||||
// Internal representation of the wrapped structure ABI.
|
// Internal representation of the wrapped structure ABI.
|
||||||
static GLib.AbiStruct _abi_info = null;
|
static GLib.AbiStruct _abi_info = null;
|
||||||
static public GLib.AbiStruct abi_info {
|
static public new GLib.AbiStruct abi_info {
|
||||||
get {
|
get {
|
||||||
if (_abi_info == null)
|
if (_abi_info == null)
|
||||||
_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{
|
_abi_info = new GLib.AbiStruct (Gst.MiniObject.abi_info.Fields);
|
||||||
});
|
|
||||||
|
|
||||||
return _abi_info;
|
return _abi_info;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28472,7 +28472,7 @@
|
||||||
<return-type type="guint32" />
|
<return-type type="guint32" />
|
||||||
</method>
|
</method>
|
||||||
</struct>
|
</struct>
|
||||||
<boxed name="VideoOverlayComposition" cname="GstVideoOverlayComposition" opaque="false" hidden="false">
|
<boxed name="VideoOverlayComposition" cname="GstVideoOverlayComposition" opaque="true" hidden="false" parent="GstMiniObject">
|
||||||
<method name="GetType" cname="gst_video_overlay_composition_get_type" shared="true">
|
<method name="GetType" cname="gst_video_overlay_composition_get_type" shared="true">
|
||||||
<return-type type="GType" />
|
<return-type type="GType" />
|
||||||
</method>
|
</method>
|
||||||
|
@ -28541,7 +28541,7 @@
|
||||||
</return-type>
|
</return-type>
|
||||||
</method>
|
</method>
|
||||||
</struct>
|
</struct>
|
||||||
<boxed name="VideoOverlayRectangle" cname="GstVideoOverlayRectangle" opaque="true" hidden="false">
|
<boxed name="VideoOverlayRectangle" cname="GstVideoOverlayRectangle" opaque="true" hidden="false" parent="GstMiniObject">
|
||||||
<method name="GetType" cname="gst_video_overlay_rectangle_get_type" shared="true">
|
<method name="GetType" cname="gst_video_overlay_rectangle_get_type" shared="true">
|
||||||
<return-type type="GType" />
|
<return-type type="GType" />
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -68,6 +68,12 @@ 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="opaque">true</attr>
|
||||||
<attr path="/api/namespace/boxed[@cname='GstSample']" name="parent">GstMiniObject</attr>
|
<attr path="/api/namespace/boxed[@cname='GstSample']" name="parent">GstMiniObject</attr>
|
||||||
|
|
||||||
|
<!-- GstVideoOverlayComposition fixes -->
|
||||||
|
<attr path="/api/namespace/boxed[@cname='GstVideoOverlayComposition']" name="opaque">true</attr>
|
||||||
|
<attr path="/api/namespace/boxed[@cname='GstVideoOverlayComposition']" name="parent">GstMiniObject</attr>
|
||||||
|
<attr path="/api/namespace/boxed[@cname='GstVideoOverlayRectangle']" name="opaque">true</attr>
|
||||||
|
<attr path="/api/namespace/boxed[@cname='GstVideoOverlayRectangle']" name="parent">GstMiniObject</attr>
|
||||||
|
|
||||||
<attr path="/api/namespace/boxed[@cname='GstAudioInfo']" name="opaque">true</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='GstVideoInfo']" name="opaque">true</attr>
|
||||||
<attr path="/api/namespace/boxed[@cname='GstAtomicQueue']" name="opaque">true</attr>
|
<attr path="/api/namespace/boxed[@cname='GstAtomicQueue']" name="opaque">true</attr>
|
||||||
|
|
Loading…
Reference in a new issue