• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMediaEventEx类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IMediaEventEx类属于命名空间,在下文中一共展示了IMediaEventEx类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: GetInterfaces


//.........这里部分代码省略.........
        Log.Info("BDPlayer: Adding filters");

        _vmr9 = new VMR9Util();
        _vmr9.AddVMR9(_graphBuilder);
        _vmr9.Enable(false);

        // Set VideoDecoder and VC1Override before adding filter in graph
        SetVideoDecoder();
        SetVC1Override();

        // Add preferred video filters
        UpdateFilters("Video");

        // Add preferred audio filters
        UpdateFilters("Audio");

        // Let the subtitle engine handle the proper filters
        try
        {
          SubtitleRenderer.GetInstance().AddSubtitleFilter(_graphBuilder);
        }
        catch (Exception e)
        {
          Log.Error(e);
        }
        
        #endregion

        #region PostProcessingEngine Detection

        IPostProcessingEngine postengine = PostProcessingEngine.GetInstance(true);
        if (!postengine.LoadPostProcessing(_graphBuilder))
        {
          PostProcessingEngine.engine = new PostProcessingEngine.DummyEngine();
        }

        #endregion

        #region render BDReader output pins

        Log.Info("BDPlayer: Render BDReader outputs");

        if (_interfaceBDReader != null)
        {
          DirectShowUtil.RenderGraphBuilderOutputPins(_graphBuilder, _interfaceBDReader);
        }
        
        //remove InternalScriptRenderer as it takes subtitle pin
        disableISR();

        //disable Closed Captions!
        disableCC();

        //RemoveAudioR();

        DirectShowUtil.RemoveUnusedFiltersFromGraph(_graphBuilder);

        #endregion

        _mediaCtrl = (IMediaControl)_graphBuilder;
        _mediaEvt = (IMediaEventEx)_graphBuilder;
        _mediaSeeking = (IMediaSeeking)_graphBuilder;

        try
        {
          SubtitleRenderer.GetInstance().SetPlayer(this);
          _dvbSubRenderer = SubtitleRenderer.GetInstance();
        }
        catch (Exception e)
        {
          Log.Error(e);
        }

        _subtitleStream = (Player.TSReaderPlayer.ISubtitleStream)_interfaceBDReader;
        if (_subtitleStream == null)
        {
          Log.Error("BDPlayer: Unable to get ISubtitleStream interface");
        }

        // if only dvb subs are enabled, pass null for ttxtDecoder
        _subSelector = new SubtitleSelector(_subtitleStream, _dvbSubRenderer, null);
        EnableSubtitle = _subtitlesEnabled;

        //Sync Audio Renderer
        SyncAudioRenderer();

        if (!_vmr9.IsVMR9Connected)
        {
          Log.Error("BDPlayer: Failed vmr9 not connected");
          return false;
        }
        _vmr9.SetDeinterlaceMode();
        return true;
      }
      catch (Exception ex)
      {
        Log.Error("BDPlayer: Exception while creating DShow graph {0}", ex.Message);
        return false;
      }
    }
开发者ID:Erls-Corporation,项目名称:MediaPortal-1,代码行数:101,代码来源:BDPlayer.cs


示例9: Run

        private void Run()
        {
            if (this.fmc == null)
                return;

            IGraphBuilder igb = (IGraphBuilder)this.fmc;

            try
            {
                // tell the graph builder about the filter graph
                this.icgb.SetFiltergraph(igb);

                igb.AddFilter(this.sf, "Video Capture");
                igb.AddFilter(this.sgf, "Sample Grabber");

                this.icgb.RenderStream(ref PIN_CATEGORY_CAPTURE, ref MEDIATYPE_Video, this.sf, this.sgf, null);

                // access different interfaces, ask runtime to notify this window
                this.ime = (IMediaEventEx)this.fmc;
                this.ime.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

                // sets the video owner and style of this window
                this.ivw = (IVideoWindow)this.fmc;
                this.ivw.Owner = (int)this.Handle;
                this.ivw.WindowStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;

                ivw.SetWindowPosition(this.ClientRectangle.Left, this.ClientRectangle.Top, this.ClientRectangle.Width, this.ClientSize.Height - this.btnCapture.Height - vertical_space);

                // get the ball rolling
                this.fmc.Run();
            }
            catch (Exception ex)
            {
                Cleanup(false);
                MessageBox.Show("Couldn't run: " + ex.Message);
            }
        }
开发者ID:ClassroomPresenter,项目名称:CP3,代码行数:37,代码来源:CaptureGraphForm.cs


示例10: InitInterfaces

 private void InitInterfaces()
 {
     try
     {
         // initialise the graph and get the graph builder and media control from it
         _graph = new FilterGraph();
         _mediaEvent = (IMediaEventEx)_graph;
         _graphBuilder = (IGraphBuilder)_graph;
         _mediaControl = (IMediaControl)_graph;
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Couldn't initialise filter graph: " + ex.Message);
     }
 }
开发者ID:Nanook,项目名称:TheGHOST,代码行数:15,代码来源:WindowsAudio.cs


示例11: FindCaptureDevice

        /*
        // Uncomment this version of FindCaptureDevice to use the DsDevice helper class
        // (and comment the first version of course)
        public IBaseFilter FindCaptureDevice()
        {
          System.Collections.ArrayList devices;
          object source;

          // Get all video input devices
          devices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

          // Take the first device
          DsDevice device = (DsDevice)devices[0];

          // Bind Moniker to a filter object
          Guid iid = typeof(IBaseFilter).GUID;
          device.Mon.BindToObject(null, null, ref iid, out source);

          // An exception is thrown if cast fail
          return (IBaseFilter) source;
        }
        */
        public void GetInterfaces()
        {
            int hr = 0;

              // An exception is thrown if cast fail
              this.graphBuilder = (IGraphBuilder) new FilterGraph();
              this.captureGraphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
              this.mediaControl = (IMediaControl) this.graphBuilder;
              this.videoWindow = (IVideoWindow) this.graphBuilder;
              this.mediaEventEx = (IMediaEventEx) this.graphBuilder;

              hr = this.mediaEventEx.SetNotifyWindow(this.Handle, WM_GRAPHNOTIFY, IntPtr.Zero);
              DsError.ThrowExceptionForHR(hr);
        }
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:36,代码来源:Form1.cs


示例12: Transcode


//.........这里部分代码省略.........
        {
          Log.Warn("DVR2MPG: FAILED:unable to get pins of muxer&source");
          Cleanup();
          return false;
        }

        bool usingAc3 = false;
        AMMediaType amAudio = new AMMediaType();
        amAudio.majorType = MediaType.Audio;
        amAudio.subType = MediaSubType.Mpeg2Audio;
        hr = pinOut0.Connect(pinIn1, amAudio);
        if (hr != 0)
        {
          amAudio.subType = MediaSubType.DolbyAC3;
          hr = pinOut0.Connect(pinIn1, amAudio);
          usingAc3 = true;
        }
        if (hr != 0)
        {
          Log.Warn("DVR2MPG: FAILED: unable to connect audio pins: 0x{0:X}", hr);
          Cleanup();
          return false;
        }

        if (usingAc3)
          Log.Info("DVR2MPG: using AC3 audio");
        else
          Log.Info("DVR2MPG: using MPEG audio");

        AMMediaType amVideo = new AMMediaType();
        amVideo.majorType = MediaType.Video;
        amVideo.subType = MediaSubType.Mpeg2Video;
        hr = pinOut1.Connect(pinIn0, amVideo);
        if (hr != 0)
        {
          Log.Warn("DVR2MPG: FAILED: unable to connect video pins: 0x{0:X}", hr);
          Cleanup();
          return false;
        }


        //connect output of powerdvd muxer->input of filewriter
        Log.Info("DVR2MPG: connect multiplexer->filewriter");
        IPin pinOut, pinIn;
        pinOut = DsFindPin.ByDirection(powerDvdMuxer, PinDirection.Output, 0);
        if (pinOut == null)
        {
          Log.Warn("DVR2MPG: FAILED:cannot get output pin of Cyberlink MPEG muxer :0x{0:X}", hr);
          Cleanup();
          return false;
        }
        pinIn = DsFindPin.ByDirection(fileWriterbase, PinDirection.Input, 0);
        if (pinIn == null)
        {
          Log.Warn("DVR2MPG: FAILED:cannot get input pin of Filewriter :0x{0:X}", hr);
          Cleanup();
          return false;
        }
        AMMediaType mt = new AMMediaType();
        hr = pinOut.Connect(pinIn, mt);
        if (hr != 0)
        {
          Log.Warn("DVR2MPG: FAILED:connect muxer->filewriter :0x{0:X}", hr);
          Cleanup();
          return false;
        }

        //set output filename
        string outputFileName = System.IO.Path.ChangeExtension(info.file, ".mpg");
        Log.Info("DVR2MPG: set output file to :{0}", outputFileName);
        mt.majorType = MediaType.Stream;
        mt.subType = MediaSubTypeEx.MPEG2;

        hr = fileWriterFilter.SetFileName(outputFileName, mt);
        if (hr != 0)
        {
          Log.Warn("DVR2MPG: FAILED:unable to set filename for filewriter :0x{0:X}", hr);
          Cleanup();
          return false;
        }
        mediaControl = graphBuilder as IMediaControl;
        mediaSeeking = graphBuilder as IMediaSeeking;
        mediaEvt = graphBuilder as IMediaEventEx;
        Log.Info("DVR2MPG: start transcoding");
        hr = mediaControl.Run();
        if (hr != 0)
        {
          Log.Warn("DVR2MPG: FAILED:unable to start graph :0x{0:X}", hr);
          Cleanup();
          return false;
        }
      }
      catch (Exception ex)
      {
        Log.Error("DVR2MPG: Unable create graph: {0}", ex.Message);
        Cleanup();
        return false;
      }
      return true;
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:Dvrms2Mpeg.cs


示例13: PlayMovieInWindow

        private void PlayMovieInWindow(string filename)
        {
            int hr = 0;

              if (filename == string.Empty)
            return;

              this.graphBuilder = (IGraphBuilder) new FilterGraph();

              // Have the graph builder construct its the appropriate graph automatically
              hr = this.graphBuilder.RenderFile(filename, null);
              DsError.ThrowExceptionForHR(hr);

              // QueryInterface for DirectShow interfaces
              this.mediaControl = (IMediaControl) this.graphBuilder;
              this.mediaEventEx = (IMediaEventEx) this.graphBuilder;
              this.mediaSeeking = (IMediaSeeking) this.graphBuilder;
              this.mediaPosition = (IMediaPosition) this.graphBuilder;

              // Query for video interfaces, which may not be relevant for audio files
              this.videoWindow = this.graphBuilder as IVideoWindow;
              this.basicVideo = this.graphBuilder as IBasicVideo;

              // Query for audio interfaces, which may not be relevant for video-only files
              this.basicAudio = this.graphBuilder as IBasicAudio;

              // Is this an audio-only file (no video component)?
              CheckVisibility();

              // Have the graph signal event via window callbacks for performance
              hr = this.mediaEventEx.SetNotifyWindow(this.Handle, WMGraphNotify, IntPtr.Zero);
              DsError.ThrowExceptionForHR(hr);

              if (!this.isAudioOnly)
              {
            // Setup the video window
            hr = this.videoWindow.put_Owner(this.Handle);
            DsError.ThrowExceptionForHR(hr);

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

            hr = InitVideoWindow(1, 1);
            DsError.ThrowExceptionForHR(hr);

            GetFrameStepInterface();
              }
              else
              {
            // Initialize the default player size and enable playback menu items
            hr = InitPlayerWindow();
            DsError.ThrowExceptionForHR(hr);

            EnablePlaybackMenu(true, MediaType.Audio);
              }

              // Complete window initialization
              CheckSizeMenu(menuFileSizeNormal);
              this.isFullScreen = false;
              this.currentPlaybackRate = 1.0;
              UpdateMainTitle();

            #if DEBUG
              rot = new DsROTEntry(this.graphBuilder);
            #endif

              this.Focus();

              // Run the graph to play the media file
              hr = this.mediaControl.Run();
              DsError.ThrowExceptionForHR(hr);

              this.currentState=PlayState.Running;
        }
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:74,代码来源:MainForm.cs


示例14: GetDVDInterfaces


//.........这里部分代码省略.........
                }
                catch (Exception ex)
                {
                    string strEx = ex.Message;
                }

                Guid riid;

                if (_dvdInfo == null)
                {
                    riid = typeof(IDvdInfo2).GUID;
                    hr = _dvdGraph.GetDvdInterface(riid, out comobj);
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }
                    _dvdInfo = (IDvdInfo2)comobj;
                    comobj = null;
                }

                if (_dvdCtrl == null)
                {
                    riid = typeof(IDvdControl2).GUID;
                    hr = _dvdGraph.GetDvdInterface(riid, out comobj);
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }
                    _dvdCtrl = (IDvdControl2)comobj;
                    comobj = null;
                }

                _mediaCtrl = (IMediaControl)_graphBuilder;
                _mediaEvt = (IMediaEventEx)_graphBuilder;
                _basicAudio = _graphBuilder as IBasicAudio;
                _mediaPos = (IMediaPosition)_graphBuilder;
                _mediaSeek = (IMediaSeeking)_graphBuilder;
                _mediaStep = (IVideoFrameStep)_graphBuilder;
                _basicVideo = _graphBuilder as IBasicVideo2;
                _videoWin = _graphBuilder as IVideoWindow;

                // disable Closed Captions!
                IBaseFilter baseFilter;
                _graphBuilder.FindFilterByName("Line 21 Decoder", out baseFilter);
                if (baseFilter == null)
                {
                    _graphBuilder.FindFilterByName("Line21 Decoder", out baseFilter);
                }
                if (baseFilter != null)
                {
                    _line21Decoder = (IAMLine21Decoder)baseFilter;
                    if (_line21Decoder != null)
                    {
                        AMLine21CCState state = AMLine21CCState.Off;
                        hr = _line21Decoder.SetServiceState(state);
                        if (hr == 0)
                        {
                            logger.Info("DVDPlayer:Closed Captions disabled");
                        }
                        else
                        {
                            logger.Info("DVDPlayer:failed 2 disable Closed Captions");
                        }
                    }
                }
                /*
开发者ID:andrewjswan,项目名称:mvcentral,代码行数:67,代码来源:Grabber.cs


示例15: 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


示例16: 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


示例17: 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


示例18: 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


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMediaItem类代码示例发布时间:2022-05-24
下一篇:
C# IMediaEncoder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap