예제 #1
0
        private uint VideoSetFormat(ref IntPtr opaque, ref uint chroma, ref uint width, ref uint height, ref uint pitches, ref uint lines)
        {
            var context = new VlcControlWpfRendererContext(width, height);

            chroma  = BitConverter.ToUInt32(new[] { (byte)'R', (byte)'V', (byte)'3', (byte)'2' }, 0);
            width   = (uint)context.Width;
            height  = (uint)context.Height;
            pitches = (uint)context.Stride;
            lines   = (uint)context.Height;

            myBitmapSectionPointer = Win32Interop.CreateFileMapping(new IntPtr(-1), IntPtr.Zero, Win32Interop.PageAccess.ReadWrite, 0, context.Size, null);
            opaque = Win32Interop.MapViewOfFile(myBitmapSectionPointer, Win32Interop.FileMapAccess.AllAccess, 0, 0, (uint)context.Size);

            Dispatcher.BeginInvoke((Action)(() =>
            {
                myBitmap = new WriteableBitmap(context.Width, context.Height);
                VideoSource = myBitmap;
                VideoBrush.ImageSource = myBitmap;
            }));

            return(1);
        }
예제 #2
0
파일: VlcControl.cs 프로젝트: ch4/vlcdotnet
        private uint VideoSetFormat(ref IntPtr opaque, ref uint chroma, ref uint width, ref uint height, ref uint pitches, ref uint lines)
        {
            var context = new VlcControlWpfRendererContext(width, height);

            chroma = BitConverter.ToUInt32(new[] { (byte)'R', (byte)'V', (byte)'3', (byte)'2' }, 0);
            width = (uint)context.Width;
            height = (uint)context.Height;
            pitches = (uint)context.Stride;
            lines = (uint)context.Height;

            myBitmapSectionPointer = Win32Interop.CreateFileMapping(new IntPtr(-1), IntPtr.Zero, Win32Interop.PageAccess.ReadWrite, 0, context.Size, null);
            opaque = Win32Interop.MapViewOfFile(myBitmapSectionPointer, Win32Interop.FileMapAccess.AllAccess, 0, 0, (uint)context.Size);

            Dispatcher.BeginInvoke((Action)(() =>
            {
                myBitmap = new WriteableBitmap(context.Width, context.Height);
                VideoSource = myBitmap;
                VideoBrush.ImageSource = myBitmap;
            }));

            return 1;
        }