gstreamer/subprojects/gstreamer-sharp/sources/generated/Gst.Video/Gst.VideoSharp.VideoFormatPackNative.cs

94 lines
2.8 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst.VideoSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void VideoFormatPackNative(IntPtr info, int flags, IntPtr src, int sstride, IntPtr data, int stride, int chroma_site, int y, int width);
internal class VideoFormatPackInvoker {
VideoFormatPackNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~VideoFormatPackInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal VideoFormatPackInvoker (VideoFormatPackNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal VideoFormatPackInvoker (VideoFormatPackNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal VideoFormatPackInvoker (VideoFormatPackNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.Video.VideoFormatPack Handler {
get {
return new Gst.Video.VideoFormatPack(InvokeNative);
}
}
void InvokeNative (Gst.Video.VideoFormatInfo info, Gst.Video.VideoPackFlags flags, IntPtr src, int sstride, IntPtr data, int stride, Gst.Video.VideoChromaSite chroma_site, int y, int width)
{
IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc (info);
native_cb (native_info, (int) flags, src, sstride, __data, stride, (int) chroma_site, y, width);
Marshal.FreeHGlobal (native_info);
}
}
internal class VideoFormatPackWrapper {
public void NativeCallback (IntPtr info, int flags, IntPtr src, int sstride, IntPtr data, int stride, int chroma_site, int y, int width)
{
try {
managed (Gst.Video.VideoFormatInfo.New (info), (Gst.Video.VideoPackFlags) flags, src, sstride, data, stride, (Gst.Video.VideoChromaSite) chroma_site, y, width);
if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled ()
{
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal VideoFormatPackNative NativeDelegate;
Gst.Video.VideoFormatPack managed;
public VideoFormatPackWrapper (Gst.Video.VideoFormatPack managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new VideoFormatPackNative (NativeCallback);
}
public static Gst.Video.VideoFormatPack GetManagedDelegate (VideoFormatPackNative native)
{
if (native == null)
return null;
VideoFormatPackWrapper wrapper = (VideoFormatPackWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}