コード例 #1
0
        public void Unmap(Gst.MapInfo info)
        {
            IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc(info);

            gst_memory_unmap(Handle, native_info);
            Marshal.FreeHGlobal(native_info);
        }
        void InvokeNative(Gst.Memory mem, Gst.MapInfo info)
        {
            IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc(info);

            native_cb(mem == null ? IntPtr.Zero : mem.Handle, native_info);
            Marshal.FreeHGlobal(native_info);
        }
コード例 #3
0
        IntPtr InvokeNative(Gst.Memory mem, Gst.MapInfo info, ulong maxsize)
        {
            IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc(info);
            IntPtr __result    = native_cb(mem == null ? IntPtr.Zero : mem.Handle, native_info, new UIntPtr(maxsize));

            Marshal.FreeHGlobal(native_info);
            return(__result);
        }
コード例 #4
0
        public bool Map(out Gst.MapInfo info, Gst.MapFlags flags)
        {
            IntPtr native_info = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Gst.MapInfo)));
            bool   raw_ret     = gst_memory_map(Handle, native_info, (int)flags);
            bool   ret         = raw_ret;

            info = Gst.MapInfo.New(native_info);
            Marshal.FreeHGlobal(native_info);
            return(ret);
        }
コード例 #5
0
        public Gst.Memory MakeMapped(out Gst.MapInfo info, Gst.MapFlags flags)
        {
            IntPtr native_info = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Gst.MapInfo)));
            IntPtr raw_ret     = gst_memory_make_mapped(Handle, native_info, (int)flags);

            Gst.Memory ret = raw_ret == IntPtr.Zero ? null : (Gst.Memory)GLib.Opaque.GetOpaque(raw_ret, typeof(Gst.Memory), true);
            info = Gst.MapInfo.New(native_info);
            Marshal.FreeHGlobal(native_info);
            return(ret);
        }
コード例 #6
0
ファイル: Buffer.cs プロジェクト: thiblahute/gstreamer-sharp
        public bool MapRange(uint idx, int length, out Gst.MapInfo info, Gst.MapFlags flags)
        {
            IntPtr native_info = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Gst.MapInfo)));
            bool   raw_ret     = gst_buffer_map_range(Handle, idx, length, native_info, (int)flags);
            bool   ret         = raw_ret;

            info = Gst.MapInfo.New(native_info);
            Marshal.FreeHGlobal(native_info);
            return(ret);
        }
コード例 #7
0
        public bool Unmap(uint plane, Gst.MapInfo info)
        {
            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_info = GLib.Marshaller.StructureToPtrAlloc(info);
            bool   raw_ret     = gst_video_meta_unmap(this_as_native, plane, native_info);
            bool   ret         = raw_ret;

            ReadNative(this_as_native, ref this);
            System.Runtime.InteropServices.Marshal.FreeHGlobal(this_as_native);
            Marshal.FreeHGlobal(native_info);
            return(ret);
        }
コード例 #8
0
        public void UpdateImage(ref Gst.MapInfo map, int width, int height)
        {
            if (Bitmap == null || Bitmap.PixelSize.Width != width || Bitmap.PixelSize.Height != height)
            {
                var oldBitmap = Bitmap;
                Bitmap = new Avalonia.Media.Imaging.WriteableBitmap(new PixelSize(width, height), new Vector(96, 96), Avalonia.Platform.PixelFormat.Rgba8888);
                oldBitmap?.Dispose();
            }

            using (var l = Bitmap.Lock())
            {
                map.CopyTo(l.Address, l.RowBytes * l.Size.Height);
            }
            VisualRoot?.Renderer.AddDirty(this);
        }