Пример #1
0
        public bool InitializeAndStartFrameGrabbing(string videoFileName,
                                                    UInt32 width, UInt32 height,
                                                    LockCallbackDelegate @lock,
                                                    UnlockCallbackDelegate unlock,
                                                    DisplayCallbackDelegate display,
                                                    IntPtr opaque)
        {
            string dllFile = GetVlcPath("libvlc.dll");

            if (!File.Exists(dllFile) || string.IsNullOrEmpty(videoFileName))
            {
                return(false);
            }

            Directory.SetCurrentDirectory(Path.GetDirectoryName(dllFile));
            _libVlcDLL = NativeMethods.LoadLibrary(dllFile);
            LoadLibVlcDynamic();
            string[] initParameters = { "--no-skip-frames" };
            _libVlc = _libvlc_new(initParameters.Length, initParameters);
            IntPtr media = _libvlc_media_new_path(_libVlc, Encoding.UTF8.GetBytes(videoFileName + "\0"));

            _mediaPlayer = _libvlc_media_player_new_from_media(media);
            _libvlc_media_release(media);

            _libvlc_video_set_format(_mediaPlayer, "RV24", width, height, 3 * width);
            //            _libvlc_video_set_format(_mediaPlayer,"RV32", width, height, 4 * width);

            //_libvlc_video_set_callbacks(_mediaPlayer, @lock, unlock, display, opaque);
            _libvlc_video_set_callbacks(_mediaPlayer, @lock, unlock, display, opaque);
            _libvlc_audio_set_volume(_mediaPlayer, 0);
            _libvlc_media_player_set_rate(_mediaPlayer, 9f);
            //_libvlc_media_player_play(_mediaPlayer);
            return(true);
        }
Пример #2
0
        public bool InitializeAndStartFrameGrabbing(string videoFileName,
            UInt32 width, UInt32 height,
            LockCallbackDelegate @lock,
            UnlockCallbackDelegate unlock,
            DisplayCallbackDelegate display,
            IntPtr opaque)
        {
            string dllFile = GetVlcPath("libvlc.dll");
            if (!File.Exists(dllFile) || string.IsNullOrEmpty(videoFileName))
                return false;

            Directory.SetCurrentDirectory(Path.GetDirectoryName(dllFile));
            _libVlcDLL = NativeMethods.LoadLibrary(dllFile);
            LoadLibVlcDynamic();
            string[] initParameters = { "--no-skip-frames" };
            _libVlc = _libvlc_new(initParameters.Length, initParameters);
            IntPtr media = _libvlc_media_new_path(_libVlc, Encoding.UTF8.GetBytes(videoFileName + "\0"));
            _mediaPlayer = _libvlc_media_player_new_from_media(media);
            _libvlc_media_release(media);

            _libvlc_video_set_format(_mediaPlayer, "RV24", width, height, 3 * width);
            //            _libvlc_video_set_format(_mediaPlayer,"RV32", width, height, 4 * width);

            //_libvlc_video_set_callbacks(_mediaPlayer, @lock, unlock, display, opaque);
            _libvlc_video_set_callbacks(_mediaPlayer, @lock, unlock, display, opaque);
            _libvlc_audio_set_volume(_mediaPlayer, 0);
            _libvlc_media_player_set_rate(_mediaPlayer, 9f);
            //_libvlc_media_player_play(_mediaPlayer);
            return true;
        }
        public bool InitializeAndStartFrameGrabbing(string videoFileName,
                                                    UInt32 width, UInt32 height,
                                                    LockCallbackDelegate @lock,
                                                    UnlockCallbackDelegate unlock,
                                                    DisplayCallbackDelegate display,
                                                    IntPtr opaque)
        {
            string dllFile = GetVlcPath("libvlc.dll");
            if (!File.Exists(dllFile) || string.IsNullOrEmpty(videoFileName))
            {
                return false;
            }

            if (dllFile != null)
            {
                Directory.SetCurrentDirectory(Path.GetDirectoryName(dllFile));
                libVlcDll = NativeMethods.LoadLibrary(dllFile);
            }

            LoadLibVlcDynamic();
            string[] initParameters = { "--no-skip-frames" };
            libVlc = libvlcNew(initParameters.Length, initParameters);
            IntPtr media = libvlcMediaNewPath(libVlc, Encoding.UTF8.GetBytes(videoFileName + "\0"));
            mediaPlayer = libvlcMediaPlayerNewFromMedia(media);
            libvlcMediaRelease(media);

            libvlcVideoSetFormat(mediaPlayer, "RV24", width, height, 3 * width);
            //            _libvlc_video_set_format(_mediaPlayer,"RV32", width, height, 4 * width);

            //_libvlc_video_set_callbacks(_mediaPlayer, @lock, unlock, display, opaque);
            libvlcVideoSetCallbacks(mediaPlayer, @lock, unlock, display, opaque);
            libvlcAudioSetVolume(mediaPlayer, 0);
            libvlcMediaPlayerSetRate(mediaPlayer, 9f);
            //_libvlc_media_player_play(_mediaPlayer);
            return true;
        }