当前位置: 首页>>代码示例>>C#>>正文


C# IMediaEventEx类代码示例

本文整理汇总了C#中IMediaEventEx的典型用法代码示例。如果您正苦于以下问题:C# IMediaEventEx类的具体用法?C# IMediaEventEx怎么用?C# IMediaEventEx使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IMediaEventEx类属于命名空间,在下文中一共展示了IMediaEventEx类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlayCinematic

        // Starts playing a new cinematic
        public void PlayCinematic(string file, int x, int y, int w, int h)
        {
            // Lame bugfix: DirectShow and Fullscreen doesnt like eachother
            if (CVars.Instance.Get("r_fs", "0", CVarFlags.ARCHIVE).Integer == 1)
            {
                if (AlterGameState)
                {
                    playing = true;
                    StopCinematic();
                }
                return;
            }

            // Check if file exists
            if (FileCache.Instance.Contains(file))
                file = FileCache.Instance.GetFile(file).FullName;
            else
            {
                if (AlterGameState)
                {
                    playing = true;
                    StopCinematic();
                }
                Common.Instance.WriteLine("PlayCinematic: Could not find video: {0}", file);
                return;
            }

            // Have the graph builder construct its the appropriate graph automatically
            this.graphBuilder = (IGraphBuilder)new FilterGraph();
            int hr = graphBuilder.RenderFile(file, null);
            DsError.ThrowExceptionForHR(hr);

            mediaControl = (IMediaControl)this.graphBuilder;
            mediaEventEx = (IMediaEventEx)this.graphBuilder;
            videoWindow = this.graphBuilder as IVideoWindow;
            basicVideo = this.graphBuilder as IBasicVideo;

            // Setup the video window
            hr = this.videoWindow.put_Owner(Renderer.Instance.form.Handle);
            DsError.ThrowExceptionForHR(hr);
            hr = this.videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
            DsError.ThrowExceptionForHR(hr);

            // Set the video size
            //int lWidth, lHeight;
            //hr = this.basicVideo.GetVideoSize(out lWidth, out lHeight);
            hr = this.videoWindow.SetWindowPosition(x, y, w, h);
            videoWindow.put_FullScreenMode((CVars.Instance.Get("r_fs", "0", CVarFlags.ARCHIVE).Integer == 1) ? OABool.True : OABool.False);
            DsError.ThrowExceptionForHR(hr);

            // Run the graph to play the media file
            hr = this.mediaControl.Run();
            DsError.ThrowExceptionForHR(hr);
            playing = true;
            if (AlterGameState)
                Client.Instance.state = CubeHags.common.ConnectState.CINEMATIC;
            Common.Instance.WriteLine("Playing cinematic: {0}", file);

            EventCode code;
        }
开发者ID:maesse,项目名称:CubeHags,代码行数:61,代码来源:Cinematic.cs

示例2: CaptureForm

        public CaptureForm()
        {
            InitializeComponent();

            graph_builder = (IGraphBuilder)new FilterGraph();
            media_control = (IMediaControl)graph_builder;
            events = (IMediaEventEx)graph_builder;
            grabber = (ISampleGrabber)new SampleGrabber();

            AMMediaType media_type = new AMMediaType();
            media_type.majorType = MediaType.Video;
            media_type.subType = MediaSubType.RGB24;
            grabber.SetMediaType( media_type );
            grabber.SetCallback( this, 1 );

            cbDevices.Items.AddRange( GetDevices( FilterCategory.VideoInputDevice ) );
        }
开发者ID:pbalint,项目名称:Playground,代码行数:17,代码来源:CaptureForm.cs

示例3: ShowMedia

        /// <summary>
        /// Plays the given mediafile in the internal mediaplayer
        /// </summary>
        /// <param name="FilePath">File to play</param>
        public void ShowMedia(string FilePath)
        {
            StopMedia();
            Lbl_CurrentMedia.Text = Path.GetFileName(FilePath);
            m_objFilterGraph = new FilgraphManager();
            m_objFilterGraph.RenderFile(FilePath);

            m_objBasicAudio = m_objFilterGraph as IBasicAudio;

            try
            {
                m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                m_objVideoWindow.Owner = (int)panel2.Handle;
                //m_objVideoWindow.Owner = (int)panel1.Handle;

                m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                m_objVideoWindow.SetWindowPosition(panel2.ClientRectangle.Left,
                   panel2.ClientRectangle.Top,
                    panel2.ClientRectangle.Width,
                    panel2.ClientRectangle.Height);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                m_objVideoWindow = null;
            }

            m_objMediaEvent = m_objFilterGraph as IMediaEvent;

            m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
            m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

            m_objMediaPosition = m_objFilterGraph as IMediaPosition;

            m_objMediaControl = m_objFilterGraph as IMediaControl;

            m_objMediaControl.Run();
            m_CurrentStatus = MediaStatus.Running;
            UpdateMediaButtons();

            //UpdateStatusBar();
            //UpdateToolBar();
        }
开发者ID:szopenfx,项目名称:code,代码行数:47,代码来源:GraphicalInterface2.cs

示例4: SetMediaEventExInterface

        /// <summary>
        /// Sets the MediaEventEx interface
        /// </summary>
        private void SetMediaEventExInterface(IMediaEventEx mediaEventEx)
        {
            m_mediaEvent = mediaEventEx;

            m_mediaEvent.SetNotifyWindow(HwndHelper.Handle, WM_GRAPH_NOTIFY, (IntPtr)GraphInstanceId);
        }
开发者ID:fivesixty,项目名称:StandaloneMB,代码行数:9,代码来源:BaseClasses.cs

示例5: openMedia

        private void openMedia()
        {
            openFileDialog1.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*";
            if (DialogResult.OK == openFileDialog1.ShowDialog()) {
                CleanUp();
                m_objFilterGraph = new FilgraphManager();
                m_objFilterGraph.RenderFile(openFileDialog1.FileName);
                m_objBasicAudio = m_objFilterGraph as IBasicAudio;

                try
                {
                    m_objVideoWindow = m_objFilterGraph as IVideoWindow;
                    m_objVideoWindow.Owner = (int)panel1.Handle;
                    m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                    m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
                        panel1.ClientRectangle.Top,
                        panel1.ClientRectangle.Width,
                        panel1.ClientRectangle.Height);
                }
                catch(Exception) {
                    m_objVideoWindow = null;
                }

                m_objMediaEvent = m_objFilterGraph as IMediaEvent;
                m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
                m_objMediaEventEx.SetNotifyWindow((int) this.Handle, WM_GRAPHNOTIFY, 0);
                m_objMediaPosition = m_objFilterGraph as IMediaPosition;
                m_objMediaControl = m_objFilterGraph as IMediaControl;
                this.Text = "Whistle- " + openFileDialog1.FileName + "]";
                m_objMediaControl.Run();
                m_CurrentStatus = MediaStatus.Running;

            }
        }
开发者ID:RoseySoft,项目名称:Whistle,代码行数:34,代码来源:Form1.cs

示例6: GetInterfaces


//.........这里部分代码省略.........
            graphBuilder.Render(pins[0]);
          }
        }

        #endregion

        // Connect DVB subtitle filter pins in the graph
        if (_mpegDemux != null && enableDvbSubtitles == true)
        {
          IMpeg2Demultiplexer demuxer = _mpegDemux as IMpeg2Demultiplexer;
          hr = demuxer.CreateOutputPin(GetTSMedia(), "Pcr", out _pinPcr);

          if (hr == 0)
          {
            Log.Info("RTSPPlayer:_pinPcr OK");

            IPin pDemuxerPcr = DsFindPin.ByName(_mpegDemux, "Pcr");
            IPin pSubtitlePcr = DsFindPin.ByName(_subtitleFilter, "Pcr");
            hr = graphBuilder.Connect(pDemuxerPcr, pSubtitlePcr);
          }
          else
          {
            Log.Info("RTSPPlayer:Failed to create _pinPcr in demuxer:{0:X}", hr);
          }

          hr = demuxer.CreateOutputPin(GetTSMedia(), "Subtitle", out _pinSubtitle);
          if (hr == 0)
          {
            Log.Info("RTSPPlayer:_pinSubtitle OK");

            IPin pDemuxerSubtitle = DsFindPin.ByName(_mpegDemux, "Subtitle");
            IPin pSubtitle = DsFindPin.ByName(_subtitleFilter, "In");
            hr = graphBuilder.Connect(pDemuxerSubtitle, pSubtitle);
          }
          else
          {
            Log.Info("RTSPPlayer:Failed to create _pinSubtitle in demuxer:{0:X}", hr);
          }

          hr = demuxer.CreateOutputPin(GetTSMedia(), "PMT", out _pinPMT);
          if (hr == 0)
          {
            Log.Info("RTSPPlayer:_pinPMT OK");

            IPin pDemuxerSubtitle = DsFindPin.ByName(_mpegDemux, "PMT");
            IPin pSubtitle = DsFindPin.ByName(_subtitleFilter, "PMT");
            hr = graphBuilder.Connect(pDemuxerSubtitle, pSubtitle);
          }
          else
          {
            Log.Info("RTSPPlayer:Failed to create _pinPMT in demuxer:{0:X}", hr);
          }
        }


        if (IsRadio == false)
        {
          if (!VMR9Util.g_vmr9.IsVMR9Connected)
          {
            //VMR9 is not supported, switch to overlay
            Log.Info("RTSPPlayer: vmr9 not connected");
            _mediaCtrl = null;
            Cleanup();
            return false;
          }
          VMR9Util.g_vmr9.SetDeinterlaceMode();
        }

        _mediaCtrl = (IMediaControl)graphBuilder;
        mediaEvt = (IMediaEventEx)graphBuilder;
        _mediaSeeking = (IMediaSeeking)graphBuilder;
        mediaPos = (IMediaPosition)graphBuilder;
        basicAudio = graphBuilder as IBasicAudio;
        //DirectShowUtil.SetARMode(graphBuilder,AspectRatioMode.Stretched);
        DirectShowUtil.EnableDeInterlace(graphBuilder);
        if (VMR9Util.g_vmr9 != null)
        {
          m_iVideoWidth = VMR9Util.g_vmr9.VideoWidth;
          m_iVideoHeight = VMR9Util.g_vmr9.VideoHeight;
        }
        if (audioRendererFilter != null)
        {
          Log.Info("RTSPPlayer9:set reference clock");
          IMediaFilter mp = graphBuilder as IMediaFilter;
          IReferenceClock clock = audioRendererFilter as IReferenceClock;
          hr = mp.SetSyncSource(null);
          hr = mp.SetSyncSource(clock);
          Log.Info("RTSPPlayer9:set reference clock:{0:X}", hr);
        }
        Log.Info("RTSPPlayer: graph build successfull");
        return true;
      }
      catch (Exception ex)
      {
        Error.SetError("Unable to play movie", "Unable build graph for VMR9");
        Log.Error("RTSPPlayer:exception while creating DShow graph {0} {1}", ex.Message, ex.StackTrace);
        CloseInterfaces();
        return false;
      }
    }
开发者ID:MediaPortal,项目名称:MediaPortal-1,代码行数:101,代码来源:RTSPPlayer.cs

示例7: PlayMovieInWindow


//.........这里部分代码省略.........
            if (EVRControl == null)
            {
                //Ищем рендерер и ВКЛЮЧАЕМ соблюдение аспекта (рендерер сам подгонит картинку под размер окна, с учетом аспекта)
                IsRendererARFixed = false;
                IBaseFilter filter = null;
                graphBuilder.FindFilterByName("Video Renderer", out filter);
                if (filter != null)
                {
                    IVMRAspectRatioControl vmr = filter as IVMRAspectRatioControl;
                    if (vmr != null)
                    {
                        DsError.ThrowExceptionForHR(vmr.SetAspectRatioMode(VMRAspectRatioMode.LetterBox));
                        IsRendererARFixed = true;
                    }
                }
                else
                {
                    graphBuilder.FindFilterByName("Video Mixing Renderer 9", out filter);
                    if (filter != null)
                    {
                        IVMRAspectRatioControl9 vmr9 = filter as IVMRAspectRatioControl9;
                        if (vmr9 != null)
                        {
                            DsError.ThrowExceptionForHR(vmr9.SetAspectRatioMode(VMRAspectRatioMode.LetterBox));
                            IsRendererARFixed = true;
                        }
                    }
                }
            }
            else
                IsRendererARFixed = true;

            this.mediaControl = (IMediaControl)this.graphBuilder;
            this.mediaEventEx = (IMediaEventEx)this.graphBuilder;
            this.mediaSeeking = (IMediaSeeking)this.graphBuilder;
            this.mediaPosition = (IMediaPosition)this.graphBuilder;
            this.videoWindow = (EVRControl == null) ? this.graphBuilder as IVideoWindow : null;
            this.basicVideo = (EVRControl == null) ? this.graphBuilder as IBasicVideo : null;
            this.basicAudio = this.graphBuilder as IBasicAudio;
            this.basicAudio.put_Volume(VolumeSet);
            this.CheckIsAudioOnly();
            if (!this.isAudioOnly)
            {
                if (videoWindow != null)
                {
                    hr = this.videoWindow.put_Owner(this.source.Handle);
                    DsError.ThrowExceptionForHR(hr);

                    hr = this.videoWindow.put_MessageDrain(this.source.Handle);
                    DsError.ThrowExceptionForHR(hr);

                    hr = this.videoWindow.put_WindowStyle(DirectShowLib.WindowStyle.Child | DirectShowLib.WindowStyle.ClipSiblings | DirectShowLib.WindowStyle.ClipChildren);
                    DsError.ThrowExceptionForHR(hr);
                }

                this.MoveVideoWindow();
            }
            else
            {
                if (VHost != null)
                {
                    VHost.Dispose();
                    VHost = null;
                    VHandle = IntPtr.Zero;
                    VHostElement.Child = null;
                    VHostElement.Visibility = Visibility.Collapsed;
开发者ID:MaksHDR,项目名称:xvid4psp,代码行数:67,代码来源:MainWindow.xaml.cs

示例8: CloseInterfaces

 public void CloseInterfaces()
 {
     if (mediaEvent != null)
     {
         hresult = mediaControl.Stop();
         Marshal.ThrowExceptionForHR(hresult);
     }
     mediaControl = null;
     mediaEvent = null;
     graphBuilder = null;
     if (filterGraph != null) Marshal.ReleaseComObject(filterGraph);
     filterGraph = null;
 }
开发者ID:YaStark,项目名称:ShazamO,代码行数:13,代码来源:DSConverter.cs

示例9: CleanUp

        //Метод CleanUp (Зачистка графов)
        public void CleanUp()
        {
            if (mediaControl != null) mediaControl.Stop();
            CurrentStatus = mStatus.Stop;

            if (videoWindow != null)
            {
                videoWindow.put_Visible(0);
                videoWindow.put_Owner(new IntPtr(0));
            }
            if (mediaControl != null)  mediaControl  = null;
            if (mediaPosition != null) mediaPosition = null;
            if (mediaEventEx != null)  mediaEventEx  = null;
            if (mediaEvent != null)    mediaEvent    = null;
            if (videoWindow != null)   videoWindow   = null;
            if (basicAudio != null)    basicAudio    = null;
            if (graphBuilder != null)  graphBuilder  = null;
        }
开发者ID:NVZver,项目名称:DirectShow,代码行数:19,代码来源:Media.cs

示例10: AudioAnimate

 // Methods
 internal AudioAnimate(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.m_objFilterGraph = null;
     this.m_objBasicAudio = null;
     this.m_objMediaEvent = null;
     this.m_objMediaEventEx = null;
     this.m_objMediaPosition = null;
     this.m_objMediaControl = null;
     this.fillColor = Color.Khaki;
     this.fileName = string.Empty;
     this.m_CurrentStatus = MediaStatus.None;
     this.timer = new Timer();
     this.oldtime = 0f;
     this.timertime = 0f;
     this.timer.Interval = 100;
     this.timer.Tick += new EventHandler(this.TimerTick);
 }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:19,代码来源:AudioAnimate.cs

示例11: CleanUp

        /**
         * To clean up the FilterGraph and other Objects
         * */
        public void CleanUp()
        {
            if (m_objMediaControl != null)
                m_objMediaControl.Stop();

            if (m_objMediaEventEx != null)
                m_objMediaEventEx.SetNotifyWindow(0, 0, 0);

            if (m_objVideoWindow != null)
            {
                m_objVideoWindow.Visible = 0;
                m_objVideoWindow.Owner = 0;
            }

            if (m_objMediaControl != null) m_objMediaControl = null;
            if (m_objMediaPosition != null) m_objMediaPosition = null;
            if (m_objMediaEventEx != null) m_objMediaEventEx = null;
            if (m_objMediaEvent != null) m_objMediaEvent = null;
            if (m_objVideoWindow != null) m_objVideoWindow = null;
            if (m_objBasicAudio != null) m_objBasicAudio = null;
            if (m_objFilterGraph != null) m_objFilterGraph = null;
        }
开发者ID:krgaurav,项目名称:GRSMediaPLayer,代码行数:25,代码来源:functions.cs

示例12: CloseInterfaces

        private void CloseInterfaces()
        {
            int hr = 0;

              try
              {
            lock(this)
            {
              // Relinquish ownership (IMPORTANT!) after hiding video window
              if (!this.isAudioOnly)
              {
            hr = this.videoWindow.put_Visible(OABool.False);
            DsError.ThrowExceptionForHR(hr);
            hr = this.videoWindow.put_Owner(IntPtr.Zero);
            DsError.ThrowExceptionForHR(hr);
              }

              if (this.mediaEventEx != null)
              {
            hr = this.mediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
            DsError.ThrowExceptionForHR(hr);
              }

            #if DEBUG
              if (rot != null)
              {
            rot.Dispose();
            rot = null;
              }
            #endif
              // Release and zero DirectShow interfaces
              if (this.mediaEventEx != null)
            this.mediaEventEx = null;
              if (this.mediaSeeking != null)
            this.mediaSeeking = null;
              if (this.mediaPosition != null)
            this.mediaPosition = null;
              if (this.mediaControl != null)
            this.mediaControl = null;
              if (this.basicAudio != null)
            this.basicAudio = null;
              if (this.basicVideo != null)
            this.basicVideo = null;
              if (this.videoWindow != null)
            this.videoWindow = null;
              if (this.frameStep != null)
            this.frameStep = null;
              if (this.graphBuilder != null)
            Marshal.ReleaseComObject(this.graphBuilder); this.graphBuilder = null;

              GC.Collect();
            }
              }
              catch
              {
              }
        }
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:57,代码来源:MainForm.cs

示例13: Cleanup

    private void Cleanup()
    {
      Log.Info("DVR2MPG: cleanup");
      if (_rotEntry != null)
      {
        _rotEntry.SafeDispose();
      }
      _rotEntry = null;

      if (mediaControl != null)
      {
        mediaControl.Stop();
        mediaControl = null;
      }
      mediaSeeking = null;
      mediaEvt = null;
      mediaControl = null;

      if (powerDvdMuxer != null)
        DirectShowUtil.ReleaseComObject(powerDvdMuxer);
      powerDvdMuxer = null;

      if (fileWriterFilter != null)
        DirectShowUtil.ReleaseComObject(fileWriterFilter);
      fileWriterFilter = null;

      if (bufferSource != null)
        DirectShowUtil.ReleaseComObject(bufferSource);
      bufferSource = null;

      DirectShowUtil.RemoveFilters(graphBuilder);

      if (graphBuilder != null)
        DirectShowUtil.ReleaseComObject(graphBuilder);
      graphBuilder = null;
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:36,代码来源:Dvrms2Mpeg.cs

示例14: CloseInterfaces

    /// <summary> do cleanup and release DirectShow. </summary>
    protected void CloseInterfaces()
    {
      if (_graphBuilder == null)
      {
        return;
      }
      int hr;
      Log.Debug("BDPlayer: Cleanup DShow graph {0}", GUIGraphicsContext.InVmr9Render);
      try
      {
        BDOSDRenderer.Release();
        
        if (_mediaCtrl != null)
        {
          int counter = 0;
          FilterState state;
          hr = _mediaCtrl.Stop();
          hr = _mediaCtrl.GetState(10, out state);
          while (state != FilterState.Stopped || GUIGraphicsContext.InVmr9Render)
          {
            Thread.Sleep(100);
            hr = _mediaCtrl.GetState(10, out state);
            counter++;
            if (counter >= 30)
            {
              if (state != FilterState.Stopped)
                Log.Error("BDPlayer: graph still running");
              if (GUIGraphicsContext.InVmr9Render)
                Log.Error("BDPlayer: in renderer");
              break;
            }
          }
          _mediaCtrl = null;
        }

        if (_vmr9 != null)
        {
          _vmr9.Enable(false);
        }

        if (_mediaEvt != null)
        {
          hr = _mediaEvt.SetNotifyWindow(IntPtr.Zero, WM_GRAPHNOTIFY, IntPtr.Zero);
          _mediaEvt = null;
        }

        _videoWin = _graphBuilder as IVideoWindow;
        if (_videoWin != null)
        {
          hr = _videoWin.put_Visible(OABool.False);
          hr = _videoWin.put_Owner(IntPtr.Zero);
          _videoWin = null;
        }

        _mediaSeeking = null;
        _basicAudio = null;
        _basicVideo = null;
        _ireader = null;

        #region Cleanup Sebastiii

        if (VideoCodec != null)
        {
          DirectShowUtil.ReleaseComObject(VideoCodec, 5000);
          VideoCodec = null;
          Log.Info("BDPlayer: Cleanup VideoCodec");
        }

        if (AudioCodec != null)
        {
          DirectShowUtil.ReleaseComObject(AudioCodec, 5000);
          AudioCodec = null;
          Log.Info("BDPlayer: Cleanup AudioCodec");
        }

        if (_audioRendererFilter != null)
        {
          while (DirectShowUtil.ReleaseComObject(_audioRendererFilter) > 0) ;
          _audioRendererFilter = null;
          Log.Info("BDPlayer: Cleanup AudioRenderer");
        }

        //Test to ReleaseComObject from PostProcessFilter list objects.
        if (PostProcessFilterVideo.Count > 0)
        {
          foreach (var ppFilter in PostProcessFilterVideo)
          {
            if (ppFilter.Value != null) DirectShowUtil.ReleaseComObject(ppFilter.Value, 5000);
          }
          PostProcessFilterVideo.Clear();
          Log.Info("BDPlayer: Cleanup PostProcessVideo");
        }

        //Test to ReleaseComObject from PostProcessFilter list objects.
        if (PostProcessFilterAudio.Count > 0)
        {
          foreach (var ppFilter in PostProcessFilterAudio)
          {
            if (ppFilter.Value != null) DirectShowUtil.ReleaseComObject(ppFilter.Value, 5000);
//.........这里部分代码省略.........
开发者ID:Erls-Corporation,项目名称:MediaPortal-1,代码行数:101,代码来源:BDPlayer.cs

示例15: CloseInterfaces

        private void CloseInterfaces()
        {
            int hr = 0;
            try
            {
                lock (locker)
                {
                    // Relinquish ownership (IMPORTANT!) after hiding video window
                    if (!this.isAudioOnly && this.videoWindow != null)
                    {
                        hr = this.videoWindow.put_Visible(OABool.False);
                        DsError.ThrowExceptionForHR(hr);
                        hr = this.videoWindow.put_Owner(IntPtr.Zero);
                        DsError.ThrowExceptionForHR(hr);
                        hr = this.videoWindow.put_MessageDrain(IntPtr.Zero);
                        DsError.ThrowExceptionForHR(hr);
                    }

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

                    if (this.mediaEventEx != null)
                    {
                        hr = this.mediaEventEx.SetNotifyWindow(IntPtr.Zero, 0, IntPtr.Zero);
                        DsError.ThrowExceptionForHR(hr);
                        this.mediaEventEx = null;
                    }

                    if (this.mediaSeeking != null)
                        this.mediaSeeking = null;
                    if (this.mediaPosition != null)
                        this.mediaPosition = null;
                    if (this.mediaControl != null)
                        this.mediaControl = null;
                    if (this.basicAudio != null)
                        this.basicAudio = null;
                    if (this.basicVideo != null)
                        this.basicVideo = null;
                    if (this.videoWindow != null)
                        this.videoWindow = null;
                    if (this.graphBuilder != null)
                    {
                        while (Marshal.ReleaseComObject(this.graphBuilder) > 0) ;
                        this.graphBuilder = null;
                    }
                    GC.Collect();
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("CloseInterfaces: " + ex.Message, Languages.Translate("Error"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
开发者ID:MaksHDR,项目名称:xvid4psp,代码行数:56,代码来源:MainWindow.xaml.cs


注:本文中的IMediaEventEx类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。