Exemple #1
0
        public void SetNthAllocationParam(uint index, Gst.Allocator allocator, Gst.AllocationParams parms)
        {
            IntPtr native_parms = GLib.Marshaller.StructureToPtrAlloc(parms);

            gst_query_set_nth_allocation_param(Handle, index, allocator == null ? IntPtr.Zero : allocator.Handle, native_parms);
            Marshal.FreeHGlobal(native_parms);
        }
Exemple #2
0
        public Buffer(Gst.Allocator allocator, ulong size, Gst.AllocationParams parms)
        {
            IntPtr native_parms = GLib.Marshaller.StructureToPtrAlloc(parms);

            Raw = gst_buffer_new_allocate(allocator == null ? IntPtr.Zero : allocator.Handle, new UIntPtr(size), native_parms);
            Marshal.FreeHGlobal(native_parms);
        }
Exemple #3
0
        public void AddAllocationParam(Gst.Allocator allocator, Gst.AllocationParams parms)
        {
            IntPtr native_parms = GLib.Marshaller.StructureToPtrAlloc(parms);

            gst_query_add_allocation_param(Handle, allocator == null ? IntPtr.Zero : allocator.Handle, native_parms);
            Marshal.FreeHGlobal(native_parms);
        }
        public Gst.Memory Alloc(ulong size, Gst.AllocationParams parms)
        {
            IntPtr native_parms = GLib.Marshaller.StructureToPtrAlloc(parms);
            IntPtr raw_ret      = gst_allocator_alloc(Handle, new UIntPtr(size), native_parms);

            Gst.Memory ret = raw_ret == IntPtr.Zero ? null : (Gst.Memory)GLib.Opaque.GetOpaque(raw_ret, typeof(Gst.Memory), true);
            Marshal.FreeHGlobal(native_parms);
            return(ret);
        }
Exemple #5
0
        public void ParseNthAllocationParam(uint index, out Gst.Allocator allocator, out Gst.AllocationParams parms)
        {
            IntPtr native_allocator;
            IntPtr native_parms = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Gst.AllocationParams)));

            gst_query_parse_nth_allocation_param(Handle, index, out native_allocator, native_parms);
            allocator = GLib.Object.GetObject(native_allocator, true) as Gst.Allocator;
            parms     = Gst.AllocationParams.New(native_parms);
            Marshal.FreeHGlobal(native_parms);
        }
        private Gst.Memory InternalAlloc(ulong size, Gst.AllocationParams parms)
        {
            AllocNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("alloc"));
                unmanaged = (AllocNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AllocNativeDelegate));
            }
            if (unmanaged == null)
            {
                return(null);
            }

            IntPtr native_parms = GLib.Marshaller.StructureToPtrAlloc(parms);
            IntPtr __result     = unmanaged(this.Handle, new UIntPtr(size), native_parms);

            Marshal.FreeHGlobal(native_parms);
            return(__result == IntPtr.Zero ? null : (Gst.Memory)GLib.Opaque.GetOpaque(__result, typeof(Gst.Memory), true));
        }
Exemple #7
0
        public static void ConfigSetAllocator(Gst.Structure config, Gst.Allocator allocator, Gst.AllocationParams parms)
        {
            IntPtr native_parms = GLib.Marshaller.StructureToPtrAlloc(parms);

            gst_buffer_pool_config_set_allocator(config == null ? IntPtr.Zero : config.Handle, allocator == null ? IntPtr.Zero : allocator.Handle, native_parms);
            Marshal.FreeHGlobal(native_parms);
        }
Exemple #8
0
        public static bool ConfigGetAllocator(Gst.Structure config, out Gst.Allocator allocator, out Gst.AllocationParams parms)
        {
            IntPtr native_allocator;
            IntPtr native_parms = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Gst.AllocationParams)));
            bool   raw_ret      = gst_buffer_pool_config_get_allocator(config == null ? IntPtr.Zero : config.Handle, out native_allocator, native_parms);
            bool   ret          = raw_ret;

            allocator = GLib.Object.GetObject(native_allocator) as Gst.Allocator;
            parms     = Gst.AllocationParams.New(native_parms);
            Marshal.FreeHGlobal(native_parms);
            return(ret);
        }
Exemple #9
0
 static void ReadNative(IntPtr native, ref Gst.AllocationParams target)
 {
     target = New(native);
 }
 protected virtual Gst.Memory OnAlloc(ulong size, Gst.AllocationParams parms)
 {
     return(InternalAlloc(size, parms));
 }