public MemoryRenderer(IntPtr hMediaPlayer)
        {
            m_hMediaPlayer = hMediaPlayer;

            LockEventHandler    leh = OnpLock;
            UnlockEventHandler  ueh = OnpUnlock;
            DisplayEventHandler deh = OnpDisplay;

            pLockCallback    = Marshal.GetFunctionPointerForDelegate(leh);
            pUnlockCallback  = Marshal.GetFunctionPointerForDelegate(ueh);
            pDisplayCallback = Marshal.GetFunctionPointerForDelegate(deh);

            m_callbacks.Add(leh);
            m_callbacks.Add(deh);
            m_callbacks.Add(ueh);

            m_timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            m_timer.Interval = 1000;
        }
Esempio n. 2
0
        /// <summary>
        /// Main Window
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            _stdIn         = new StdioMessageEventHandler(OnStdIoInput);
            _stdOut        = new StdioMessageEventHandler(OnStdIoOutput);
            _stdErr        = new StdioMessageEventHandler(OnStdIoError);
            _displayHandle = new DisplayEventHandler(GsInteractive_displayEvent);
            _gsInteractive = new GSInteractive();
            if (!_gsInteractive.GSInitialise(_stdIn, _stdOut, _stdErr, _displayHandle))
            {
                MessageBox.Show("Ghostscript DLL not found or not of the right version. Make sure latest version of Ghostscript is installed.\nExiting the Application");
                this.Close();
                return;
            }
            _gsVersion     = _gsInteractive.GetRevisionInfo();
            tbkStatus.Text = string.Format("Ghostscript Version Found: {0} Dated: {1}", _gsVersion.revision, _gsVersion.revisiondate);

            SetDevelopPanel(Settings.Default.DevelopPanel);
        }
Esempio n. 3
0
        /// <summary>
        /// 是否开启视频帧解析
        /// </summary>
        /// <param name="isoncallback"></param>
        public VlcPlayerCore(bool isoncallback = false)
        {
            this.isoncallback = isoncallback;
            string[] args = new string[]
            {
                "-I",
                "dumy",
                "--ignore-config",
                "--no-osd",
                "--disable-screensaver",
                "--ffmpeg-hw",
                "--plugin-path=./plugins"
            };

            dMediaPlaying        = MediaPlaying;
            dMediaPaused         = MediaPaused;
            dMediaPos            = MediaPos;
            dMediaStoped         = MediaStoped;
            dMediaEndReached     = MediaEndReached;
            dlockEventHandler    = mLockEventHandler;
            dunlockEventHandler  = mUnlockEventHandler;
            ddisplayEventHandler = mDisplayEventHandler;

            m_hMediaLib     = LibVlcMethods.libvlc_new(args.Length, args);
            m_hMediaPlayer  = LibVlcMethods.libvlc_media_player_new(m_hMediaLib);
            m_hEventManager = LibVlcMethods.libvlc_media_player_event_manager(m_hMediaPlayer);

            EventManager.Attach(m_hEventManager, libvlc_event_e.libvlc_MediaPlayerPlaying, dMediaPlaying);
            EventManager.Attach(m_hEventManager, libvlc_event_e.libvlc_MediaPlayerPaused, dMediaPaused);
            EventManager.Attach(m_hEventManager, libvlc_event_e.libvlc_MediaPlayerPositionChanged, dMediaPos);
            EventManager.Attach(m_hEventManager, libvlc_event_e.libvlc_MediaPlayerStopped, dMediaStoped);
            EventManager.Attach(m_hEventManager, libvlc_event_e.libvlc_MediaPlayerEndReached, dMediaEndReached);

            if (isoncallback)
            {
                //LibVlcMethods.libvlc_video_set_format(m_hMediaPlayer, new char[] { 'R', 'V', '3', '2' }, frameWidth, height, frameWidth * framePixelBits);
                LibVlcMethods.libvlc_video_set_callbacks(m_hMediaPlayer, dlockEventHandler, dunlockEventHandler, ddisplayEventHandler, IntPtr.Zero);
            }
        }
        public MemoryRendererEx(IntPtr hMediaPlayer)
        {
            m_hMediaPlayer = hMediaPlayer;

            LockEventHandler    leh            = OnpLock;
            DisplayEventHandler deh            = OnpDisplay;
            VideoFormatCallback formatCallback = OnFormatCallback;

            pFormatCallback  = Marshal.GetFunctionPointerForDelegate(formatCallback);
            pLockCallback    = Marshal.GetFunctionPointerForDelegate(leh);
            pDisplayCallback = Marshal.GetFunctionPointerForDelegate(deh);

            m_callbacks.Add(leh);
            m_callbacks.Add(deh);
            m_callbacks.Add(formatCallback);

            m_timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            m_timer.Interval = 1000;
            SAR = AspectRatio.Default;
            LibVlcMethods.libvlc_video_set_format_callbacks(m_hMediaPlayer, pFormatCallback, IntPtr.Zero);
            LibVlcMethods.libvlc_video_set_callbacks(m_hMediaPlayer, pLockCallback, IntPtr.Zero, pDisplayCallback, IntPtr.Zero);
        }
Esempio n. 5
0
 public static extern void libvlc_video_set_callbacks(IntPtr mp, LockEventHandler @lock, UnlockEventHandler unlock, DisplayEventHandler display, IntPtr opaque);
Esempio n. 6
0
 /// <summary>
 /// Sets the remote Event pointer that handles the raised display event. When an event is raised
 /// it is passed to this pointer.
 /// </summary>
 /// <param name="dh"></param>
 public void SetDisplayEventHandler(DisplayEventHandler dh)
 {
     DisplayCallbackEventHandler = dh;
 }
Esempio n. 7
0
 /// <summary>
 /// Simplified instantiation of the class. Message event handler and GSDisplay event handler
 /// can be passed as parameter which are properly handled. Any of this pointer can be null
 /// if there is no need to handle them
 /// </summary>
 /// <param name="stdIn">Callback StdioMessageEventHandler function pointer for StdIo-Input</param>
 /// <param name="stdOut">Callback StdioMessageEventHandler function pointer for StdIo-Output</param>
 /// <param name="stdErr">Callback StdioMessageEventHandler function pointer for StdIo-Error</param>
 /// <param name="dh">Callback DisplayEventHandler function pointer for GSDisplay Event</param>
 /// <returns>True if successful</returns>
 public bool GSInitialise(StdioMessageEventHandler stdIn, StdioMessageEventHandler stdOut, StdioMessageEventHandler stdErr, DisplayEventHandler dh)
 {
     if (InitialiseDLL())
     {
         SetStdIOHandlers(stdIn, stdOut, stdErr);
         SetConsole();
         _gsDisplay.SetDisplayEventHandler(dh);
         return(true);
     }
     return(false);
 }
Esempio n. 8
0
 /// <summary>
 /// Sets the Callback DisplayEventHander function pointer passed by calling program
 /// </summary>
 /// <param name="dh">DisplayEventHandler function pointer</param>
 public void SetDisplayEventHandler(DisplayEventHandler dh)
 {
     _gsDisplay.SetDisplayEventHandler(dh);
 }