Ejemplo n.º 1
0
        public void TakeSnapshot(string filePath, int width, int height)
        {
            VerifyObjectIsNotDisposed();
            //
            IntPtr filePathPtr = Marshal.StringToHGlobalAnsi(filePath);
            //
            uint uwidth  = Convert.ToUInt32(width);
            uint uheight = Convert.ToUInt32(height);

            //
            try {
                int res = LibVlcInterop.libvlc_video_take_snapshot(descriptor, 0, filePathPtr, uwidth, uheight);
                if (-1 == res)
                {
                    throw new VlcInternalException(LibVlcInterop.libvlc_errmsg());
                }
            } finally {
                Marshal.FreeHGlobal(filePathPtr);
            }
        }
Ejemplo n.º 2
0
        public void TakeSnapshot(string filePath, int width, int height)
        {
            VerifyObjectIsNotDisposed();
            //
            libvlc_exception_t exc = new libvlc_exception_t();

            LibVlcInterop.libvlc_exception_init(ref exc);
            IntPtr filePathPtr = Marshal.StringToHGlobalAnsi(filePath);
            //
            uint uwidth  = Convert.ToUInt32(width);
            uint uheight = Convert.ToUInt32(height);

            //
            try {
                LibVlcInterop.libvlc_video_take_snapshot(descriptor, filePathPtr, uwidth, uheight, ref exc);
            } finally {
                Marshal.FreeHGlobal(filePathPtr);
            }
            //
            if (exc.b_raised != 0)
            {
                throw new VlcInternalException(exc.Message);
            }
        }