private FrameData DeepClone(IntPtr data, int size)
        {
            FrameData clone = new FrameData();

            clone.Data = new IntPtr(MemoryHeap.Alloc(size));
            MemoryHeap.CopyMemory(clone.Data.ToPointer(), data.ToPointer(), size);
            clone.DataSize = size;
            return(clone);
        }
        private FrameData DeepClone(byte[] buffer)
        {
            FrameData clone = new FrameData();

            clone.Data = new IntPtr(MemoryHeap.Alloc(buffer.Length));
            Marshal.Copy(buffer, 0, clone.Data, buffer.Length);
            clone.DataSize = buffer.Length;
            return(clone);
        }
 public PlanarPixelData(int[] lineSizes)
 {
     Sizes = lineSizes;
     Data  = (byte **)MemoryHeap.Alloc(sizeof(byte *) * Sizes.Length);
     for (int i = 0; i < Sizes.Length; i++)
     {
         Data[i] = (byte *)MemoryHeap.Alloc(sizeof(byte) * Sizes[i]);
     }
 }
        public void SetFormat(BitmapFormat format)
        {
            m_format = format;

            LibVlcMethods.libvlc_video_set_format(m_hMediaPlayer, m_format.Chroma.ToUtf8(), m_format.Width, m_format.Height, m_format.Pitch);
            m_pBuffer = MemoryHeap.Alloc(m_format.ImageSize);

            m_pixelData    = new PixelData(m_format.ImageSize);
            m_pixelDataPtr = GCHandle.Alloc(m_pixelData, GCHandleType.Pinned);
            LibVlcMethods.libvlc_video_set_callbacks(m_hMediaPlayer, pLockCallback, pUnlockCallback, pDisplayCallback, m_pixelDataPtr.AddrOfPinnedObject());
        }
Beispiel #5
0
        public void SetFormat(BitmapFormat format)
        {
            if (!format.IsRGB)
            {
                string msg = "IMemoryRenderer supports RGB pixel formats only. For YUV and/or planar pixel formats use IMemoryRendererEx";
                throw new InvalidOperationException(msg);
            }

            m_format = format;

            LibVlcMethods.libvlc_video_set_format(m_hMediaPlayer, m_format.Chroma.ToUtf8(), m_format.Width, m_format.Height, m_format.Pitch);
            m_pBuffer = MemoryHeap.Alloc(m_format.ImageSize);

            m_pixelData    = new PixelData(m_format.ImageSize);
            m_pixelDataPtr = GCHandle.Alloc(m_pixelData, GCHandleType.Pinned);
            LibVlcMethods.libvlc_video_set_callbacks(m_hMediaPlayer, pLockCallback, pUnlockCallback, pDisplayCallback, m_pixelDataPtr.AddrOfPinnedObject());
        }
Beispiel #6
0
 public PixelData(int size)
 {
     this.size       = size;
     this.pPixelData = (byte *)MemoryHeap.Alloc(size);
 }