Ejemplo n.º 1
0
 private void HoldLastBlock(IntPtr pBlockHandle, LibVLCAccess.block_t block, int offset)
 {
     if (IntPtr.Zero != pBlockHandle)
     {
         if (offset < block.i_buffer)
         {
             _LastBlockHandle = pBlockHandle;
             _LastBlock = block;
             _LastBlockOffset = offset;
         }
         else
         {
             ReleaseBlock(pBlockHandle, block);
         }
     }
 }
Ejemplo n.º 2
0
            private void Init(byte[] data, int length)
            {
                _ptrBlock = Marshal.AllocHGlobal(BlockStructSize);
                _handle = GCHandle.Alloc(data, GCHandleType.Pinned);
                IntPtr ptrBuffer = _handle.AddrOfPinnedObject();
                //Marshal.WriteInt32(ptr + 5 * 8, Length);
                //Marshal.WriteIntPtr(ptr + 5 * 8 + 4, ptrBuffer);

                LibVLCAccess.block_t vlcblock = new LibVLCAccess.block_t();
                vlcblock.i_buffer = data.Length;
                vlcblock.p_buffer = ptrBuffer;
                Marshal.StructureToPtr(vlcblock, _ptrBlock, false);
                //Marshal.WriteInt32(ptr + 6 * 8 + 4, GetAllocSize());
            }
Ejemplo n.º 3
0
        protected IntPtr ReadBlock(out LibVLCAccess.block_t block)
        {
            if (IntPtr.Zero == _AccessVLCObject)
            {
                throw new ObjectDisposedException("AccessVLCObject");
            }

            IntPtr pBlock = InvokeImport.InvokeFunc(_funcReadBlock, _AccessVLCObject);

            if (IntPtr.Zero != pBlock)
            {
                block = (LibVLCAccess.block_t)Marshal.PtrToStructure(pBlock, typeof(LibVLCAccess.block_t));
            }
            else
            {
                block = new LibVLCAccess.block_t();
            }

            return pBlock;
        }
Ejemplo n.º 4
0
 private void ReleaseLastBuffer(bool disposing)
 {
     if (IntPtr.Zero != _LastBlockHandle)
     {
         ReleaseBlock(_LastBlockHandle, _LastBlock);
         _LastBlockHandle = IntPtr.Zero;
         if (disposing)
         {
             _LastBlock = new LibVLCAccess.block_t();
         }
         _LastBlockOffset = 0;
     }
 }