示例#1
0
        /// <summary>
        /// Called by the GSSF to determine whether we support seeking
        /// </summary>
        /// <param name="sc">What seek operations we support</param>
        /// <param name="lDuration">Total duration</param>
        /// <returns>HRESULT</returns>
        virtual public int Startup(out AMSeekingSeekingCapabilities sc, out long lDuration)
        {
            sc        = AMSeekingSeekingCapabilities.None; // By default, say we support nothing
            lDuration = 0;                                 // have no duration

            return(E_NotImplemented);                      // and don't support seeking
        }
示例#2
0
        // Seeking
        public bool CanSeek()
        {
            const AMSeekingSeekingCapabilities caps =
                AMSeekingSeekingCapabilities.CanSeekAbsolute |
                AMSeekingSeekingCapabilities.CanGetDuration;

            return((m_seekCaps & caps) == caps);
        }
示例#3
0
        private void TearDownGraph()
        {
#if DEBUG
            if (m_rot != null)
            {
                m_rot.Dispose();
                m_rot = null;
            }
#endif

            // Stop sending event messages
            if (m_pEvent != null)
            {
                m_pEvent.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
                m_pEvent = null;
            }

            if (m_pControl != null)
            {
                m_pControl.Stop();
                m_pControl = null;
            }

            if (m_pDisplay != null)
            {
                //Marshal.ReleaseComObject(m_pDisplay);
                m_pDisplay = null;
            }

            if (m_pMapper != null)
            {
                Marshal.ReleaseComObject(m_pMapper);
                m_pMapper = null;
            }

            if (m_pMixer != null)
            {
                Marshal.ReleaseComObject(m_pMixer);
                m_pMixer = null;
            }

            if (m_pEVR != null)
            {
                Marshal.ReleaseComObject(m_pEVR);
                m_pEVR = null;
            }

            if (m_pGraph != null)
            {
                Marshal.ReleaseComObject(m_pGraph);
                m_pGraph = null;
            }

            m_state    = PlaybackState.Closed;
            m_seekCaps = 0;
            m_pSeek    = null;
        }
示例#4
0
        /// <summary>
        /// Called by the GSSF to determine whether we support seeking
        /// </summary>
        /// <param name="sc">What seek operations we support</param>
        /// <param name="lDuration">Total duration</param>
        /// <returns>HRESULT</returns>
        public override int Startup(out AMSeekingSeekingCapabilities sc, out long lDuration)
        {
            sc = AMSeekingSeekingCapabilities.CanGetCurrentPos |
                 AMSeekingSeekingCapabilities.CanGetDuration |
                 AMSeekingSeekingCapabilities.CanSeekAbsolute |
                 AMSeekingSeekingCapabilities.CanSeekBackwards |
                 AMSeekingSeekingCapabilities.CanSeekForwards;

            lDuration = MAXFRAMES * (UNIT / m_Fps);

            return(S_Ok);
        }
示例#5
0
        public DShowPlayer(Control hwndVideo, IntPtr hwnd, int msg)
        {
            m_state     = PlaybackState.Closed;
            m_hwndVideo = hwndVideo;
            m_hwndEvent = hwnd;
            m_EventMsg  = msg;

            m_pGraph         = null;
            m_pControl       = null;
            m_pEvent         = null;
            m_pSeek          = null;
            m_pDisplay       = null;
            m_pEVR           = null;
            m_pMapper        = null;
            m_seekCaps       = 0;
            m_clsidPresenter = Guid.Empty;
        }
示例#6
0
        public int CheckCapabilities(ref AMSeekingSeekingCapabilities pCapabilities)
        {
            if (m_pUnknown == IntPtr.Zero) return E_NOINTERFACE;

            CheckCapabilitiesProc _Proc = GetProcDelegate<CheckCapabilitiesProc>(4);

            if (_Proc == null) return E_UNEXPECTED;

            return (HRESULT)_Proc(
                        m_pUnknown,
                        ref pCapabilities
                        );
        }
示例#7
0
        public int GetCapabilities(out AMSeekingSeekingCapabilities pCapabilities)
        {
            pCapabilities = AMSeekingSeekingCapabilities.None;
            if (m_pUnknown == IntPtr.Zero) return E_NOINTERFACE;

            GetCapabilitiesProc _Proc = GetProcDelegate<GetCapabilitiesProc>(3);

            if (_Proc == null) return E_UNEXPECTED;

            return (HRESULT)_Proc(
                        m_pUnknown,
                        out pCapabilities
                        );
        }
        private void CloseInterfaces()
        {
            int hr;

            if (m_adecOut != null)
            {
                CleanUpInterface(m_adecOut);
                m_adecOut = null;
            }

            if (_defaultAudioRenderer != null)
            {
                m_graph.RemoveFilter(_defaultAudioRenderer as DirectShowLib.IBaseFilter);

                CleanUpInterface(_defaultAudioRenderer);
                _defaultAudioRenderer = null;
            }

            if (_reclockAudioRenderer != null)
            {
                m_graph.RemoveFilter(_reclockAudioRenderer as DirectShowLib.IBaseFilter);

                CleanUpInterface(_reclockAudioRenderer);
                _reclockAudioRenderer = null;
            }

            if (_wasapiAR != null)
            {
                m_graph.RemoveFilter(_wasapiAR as DirectShowLib.IBaseFilter);

                CleanUpInterface(_wasapiAR);
                _wasapiAR = null;
            }

            if (_lavaudio != null)
            {
                m_graph.RemoveFilter(_lavaudio as DirectShowLib.IBaseFilter);

                CleanUpInterface(_lavaudio);
                _lavaudio = null;
            }

            if (_xyVsFilter != null)
            {
                m_graph.RemoveFilter(_xyVsFilter as DirectShowLib.IBaseFilter);

                CleanUpInterface(_xyVsFilter);
                _xyVsFilter = null;
            }

            if (_xySubFilter != null)
            {
                m_graph.RemoveFilter(_xySubFilter as DirectShowLib.IBaseFilter);

                CleanUpInterface(_xySubFilter);
                _xySubFilter = null;
            }

            if (_lavvideo != null)
            {
                m_graph.RemoveFilter(_lavvideo as DirectShowLib.IBaseFilter);

                CleanUpInterface(_lavvideo);
                _lavvideo = null;
            }

            if (_madvr != null)
            {
                m_graph.RemoveFilter(_madvr as DirectShowLib.IBaseFilter);

                CleanUpInterface(_madvr);
                _madvr = null;
            }

            if (_videoWindow != null)
            {
                // Relinquish ownership (IMPORTANT!) after hiding video window
                hr = _videoWindow.put_Visible(OABool.False);

                hr = _videoWindow.put_Owner(IntPtr.Zero);
            }

            if (_mediaEventEx != null)
            {
                hr = _mediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
                //Marshal.ReleaseComObject(_mediaEventEx);
                //_mediaEventEx = null;
            }

            //if (_dvdNav != null)
            //{
            //    Marshal.ReleaseComObject(_dvdNav);
            //    _dvdNav = null;
            //}
            /* //this will double release the source filter
            if (dvdInfo != null)
            {
                Marshal.ReleaseComObject(dvdInfo);
                dvdInfo = null;
            }

            if (_mDvdControl != null)
            {
                Marshal.ReleaseComObject(_mDvdControl);                
            }
            */
            _mDvdControl = null;

            CleanUpInterface(_mPDisplay);
            _mPDisplay = null;
            CleanUpInterface(_sourceFilter);
            _sourceFilter = null;
            CleanUpInterface(_mPEvr);
            _mPEvr = null;
            CleanUpInterface(m_filterGraph);
            m_filterGraph = null;

            m_filterGraph = null;
            _mediaEventEx = null;
            _mediaSeeking = null;
            _mediaPosition = null;
            _mediaControl = null;
            _basicAudio = null;
            _basicVideo = null;
            m_graph = null;
            _videoWindow = null;
            _filterGraph = null;

            if (m_dsRot != null)
                m_dsRot.Dispose();
            m_dsRot = null;

            _mSeekCaps = 0;

            _streams = null;

            GC.Collect();
        }
示例#9
0
        /// <summary>
        /// Called by the GSSF to determine whether we support seeking
        /// </summary>
        /// <param name="sc">What seek operations we support</param>
        /// <param name="lDuration">Total duration</param>
        /// <returns>HRESULT</returns>
        public override int Startup(out AMSeekingSeekingCapabilities sc, out long lDuration)
        {
            sc = AMSeekingSeekingCapabilities.CanGetCurrentPos |
                    AMSeekingSeekingCapabilities.CanGetDuration |
                    AMSeekingSeekingCapabilities.CanSeekAbsolute |
                    AMSeekingSeekingCapabilities.CanSeekBackwards |
                    AMSeekingSeekingCapabilities.CanSeekForwards;

            lDuration = MAXFRAMES * (UNIT / m_Fps);

            return S_Ok;
        }
示例#10
0
        /// <summary>
        /// Called by the GSSF to determine whether we support seeking
        /// </summary>
        /// <param name="sc">What seek operations we support</param>
        /// <param name="lDuration">Total duration</param>
        /// <returns>HRESULT</returns>
        public virtual int Startup(out AMSeekingSeekingCapabilities sc, out long lDuration)
        {
            sc = AMSeekingSeekingCapabilities.None; // By default, say we support nothing
            lDuration = 0;                          // have no duration

            return E_NotImplemented;                // and don't support seeking
        }
示例#11
0
        public DShowPlayer(Control hwndVideo, IntPtr hwnd, int msg)
        {
            m_state = PlaybackState.Closed;
            m_hwndVideo = hwndVideo;
            m_hwndEvent = hwnd;
            m_EventMsg = msg;

            m_pGraph = null;
            m_pControl = null;
            m_pEvent = null;
            m_pSeek = null;
            m_pDisplay = null;
            m_pEVR = null;
            m_pMapper = null;
            m_seekCaps = 0;
            m_clsidPresenter = Guid.Empty;
        }
示例#12
0
        private void TearDownGraph()
        {
            #if DEBUG
            if (m_rot != null)
            {
                m_rot.Dispose();
                m_rot = null;
            }
            #endif

            // Stop sending event messages
            if (m_pEvent != null)
            {
                m_pEvent.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
                m_pEvent = null;
            }

            if (m_pControl != null)
            {
                m_pControl.Stop();
                m_pControl = null;
            }

            if (m_pDisplay != null)
            {
                //Marshal.ReleaseComObject(m_pDisplay);
                m_pDisplay = null;
            }

            if (m_pMapper != null)
            {
                Marshal.ReleaseComObject(m_pMapper);
                m_pMapper = null;
            }

            if (m_pMixer != null)
            {
                Marshal.ReleaseComObject(m_pMixer);
                m_pMixer = null;
            }

            if (m_pEVR != null)
            {
                Marshal.ReleaseComObject(m_pEVR);
                m_pEVR = null;
            }

            if (m_pGraph != null)
            {
                Marshal.ReleaseComObject(m_pGraph);
                m_pGraph = null;
            }

            m_state = PlaybackState.Closed;
            m_seekCaps = 0;
            m_pSeek = null;
        }
        private void CloseInterfaces()
        {
            _hiddenWindow.SizeChanged -= _hiddenWindow_SizeChanged;

            int hr;

            if (_defaultAudioRenderer != null)
            {
                m_graph.RemoveFilter(_defaultAudioRenderer as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_defaultAudioRenderer);
                _defaultAudioRenderer = null;
            }

            if (_reclockAudioRenderer != null)
            {
                m_graph.RemoveFilter(_reclockAudioRenderer as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_reclockAudioRenderer);
                _reclockAudioRenderer = null;
            }

            if (_lavaudio != null)
            {
                m_graph.RemoveFilter(_lavaudio as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_lavaudio);
                _lavaudio = null;
            }

            if (_xyVsFilter != null)
            {
                m_graph.RemoveFilter(_xyVsFilter as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_xyVsFilter);
                _xyVsFilter = null;
            }

            if (_xySubFilter != null)
            {
                m_graph.RemoveFilter(_xySubFilter as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_xySubFilter);
                _xySubFilter = null;
            }

            if (_lavvideo != null)
            {
                m_graph.RemoveFilter(_lavvideo as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_lavvideo);
                _lavvideo = null;
            }

            if (_madvr != null)
            {
                m_graph.RemoveFilter(_madvr as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_madvr);
                _madvr = null;
            }

            if (_videoWindow != null)
            {
                // Relinquish ownership (IMPORTANT!) after hiding video window
                hr = _videoWindow.put_Visible(OABool.False);

                hr = _videoWindow.put_Owner(IntPtr.Zero);
            }

            if (_mediaEventEx != null)
            {
                hr = _mediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
                Marshal.ReleaseComObject(_mediaEventEx);
                _mediaEventEx = null;
            }

            if (_dvdNav != null)
            {
                Marshal.ReleaseComObject(_dvdNav);
                _dvdNav = null;
            }

            if (_mDvdInfo != null)
            {
                Marshal.ReleaseComObject(_mDvdInfo);
                _mDvdInfo = null;
            }

            if (_mDvdControl != null)
            {
                Marshal.ReleaseComObject(_mDvdControl);
                _mDvdControl = null;
            }

            if (_mPDisplay != null)
            {
                Marshal.ReleaseComObject(_mPDisplay);
                _mPDisplay = null;
            }

            if (_filterGraph != null)
            {
                Marshal.ReleaseComObject(_filterGraph);
                _filterGraph = null;
            }

            if (_mPEvr != null)
            {
                Marshal.ReleaseComObject(_mPEvr);
                _mPEvr = null;
            }

            if (_mediaEventEx != null)
            {
                Marshal.ReleaseComObject(_mediaEventEx);
                _mediaEventEx = null;
            }

            if (_mediaSeeking != null)
            {
                Marshal.ReleaseComObject(_mediaSeeking);
                _mediaSeeking = null;
            }

            if (_mediaPosition != null)
            {
                Marshal.ReleaseComObject(_mediaPosition);
                _mediaPosition = null;
            }

            if (_mediaControl != null)
            {
                Marshal.ReleaseComObject(_mediaControl);
                _mediaControl = null;
            }

            if (_basicAudio != null)
            {
                Marshal.ReleaseComObject(_basicAudio);
                _basicAudio = null;
            }

            if (_basicVideo != null)
            {
                Marshal.ReleaseComObject(_basicVideo);
                _basicVideo = null;
            }

            if (_sourceFilter != null)
            {
                Marshal.ReleaseComObject(_sourceFilter);
                _sourceFilter = null;
            }

            if (m_graph != null)
            {
                Marshal.ReleaseComObject(m_graph);
                m_graph = null;
            }

            if (_videoWindow != null)
            {
                Marshal.ReleaseComObject(_videoWindow);
                _videoWindow = null;
            }

            _mSeekCaps = 0;

            _streams = null;

            GC.Collect();
        }
示例#14
0
        private void CloseInterfaces()
        {
            _hiddenWindow.SizeChanged -= _hiddenWindow_SizeChanged;

            int hr;

            if (_defaultAudioRenderer != null)
            {
                m_graph.RemoveFilter(_defaultAudioRenderer as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_defaultAudioRenderer);
                _defaultAudioRenderer = null;
            }

            if (_reclockAudioRenderer != null)
            {
                m_graph.RemoveFilter(_reclockAudioRenderer as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_reclockAudioRenderer);
                _reclockAudioRenderer = null;
            }

            if (_lavaudio != null)
            {
                m_graph.RemoveFilter(_lavaudio as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_lavaudio);
                _lavaudio = null;
            }

            if (_xyVsFilter != null)
            {
                m_graph.RemoveFilter(_xyVsFilter as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_xyVsFilter);
                _xyVsFilter = null;
            }

            if (_xySubFilter != null)
            {
                m_graph.RemoveFilter(_xySubFilter as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_xySubFilter);
                _xySubFilter = null;
            }

            if (_lavvideo != null)
            {
                m_graph.RemoveFilter(_lavvideo as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_lavvideo);
                _lavvideo = null;
            }

            if (_madvr != null)
            {
                m_graph.RemoveFilter(_madvr as DirectShowLib.IBaseFilter);

                Marshal.ReleaseComObject(_madvr);
                _madvr = null;
            }

            if (_videoWindow != null)
            {
                // Relinquish ownership (IMPORTANT!) after hiding video window
                hr = _videoWindow.put_Visible(OABool.False);

                hr = _videoWindow.put_Owner(IntPtr.Zero);
            }

            if (_mediaEventEx != null)
            {
                hr = _mediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
                Marshal.ReleaseComObject(_mediaEventEx);
                _mediaEventEx = null;
            }

            if (_dvdNav != null)
            {
                Marshal.ReleaseComObject(_dvdNav);
                _dvdNav = null;
            }

            if (_mDvdInfo != null)
            {
                Marshal.ReleaseComObject(_mDvdInfo);
                _mDvdInfo = null;
            }

            if (_mDvdControl != null)
            {
                Marshal.ReleaseComObject(_mDvdControl);
                _mDvdControl = null;
            }

            if (_mPDisplay != null)
            {
                Marshal.ReleaseComObject(_mPDisplay);
                _mPDisplay = null;
            }

            if (_filterGraph != null)
            {
                Marshal.ReleaseComObject(_filterGraph);
                _filterGraph = null;
            }

            if (_mPEvr != null)
            {
                Marshal.ReleaseComObject(_mPEvr);
                _mPEvr = null;
            }

            if (_mediaEventEx != null)
            {
                Marshal.ReleaseComObject(_mediaEventEx);
                _mediaEventEx = null;
            }

            if (_mediaSeeking != null)
            {
                Marshal.ReleaseComObject(_mediaSeeking);
                _mediaSeeking = null;
            }

            if (_mediaPosition != null)
            {
                Marshal.ReleaseComObject(_mediaPosition);
                _mediaPosition = null;
            }

            if (_mediaControl != null)
            {
                Marshal.ReleaseComObject(_mediaControl);
                _mediaControl = null;
            }

            if (_basicAudio != null)
            {
                Marshal.ReleaseComObject(_basicAudio);
                _basicAudio = null;
            }

            if (_basicVideo != null)
            {
                Marshal.ReleaseComObject(_basicVideo);
                _basicVideo = null;
            }

            if (_sourceFilter != null)
            {
                Marshal.ReleaseComObject(_sourceFilter);
                _sourceFilter = null;
            }

            if (m_graph != null)
            {
                Marshal.ReleaseComObject(m_graph);
                m_graph = null;
            }

            if (_videoWindow != null)
            {
                Marshal.ReleaseComObject(_videoWindow);
                _videoWindow = null;
            }

            _mSeekCaps = 0;

            _streams = null;

            GC.Collect();
        }