public void Play(PlayableItem item, bool enableReclock, bool enableMadvr, bool enableXySubFilter) { _logger.Info("Playing {0}. Reclock: {1}, Madvr: {2}, xySubFilter: {3}", item.OriginalItem.Name, enableReclock, enableMadvr, enableXySubFilter); _item = item; var isDvd = (item.OriginalItem.VideoType ?? VideoType.VideoFile) == VideoType.Dvd || (item.OriginalItem.IsoType ?? IsoType.BluRay) == IsoType.Dvd && item.PlayablePath.IndexOf("http://", StringComparison.OrdinalIgnoreCase) == -1; Initialize(item.PlayablePath, enableReclock, enableMadvr, enableXySubFilter, isDvd); var hr = _mediaControl.Run(); DsError.ThrowExceptionForHR(hr); PlayState = PlayState.Playing; }
public static void startSecond() { initDSArrays(); filter1 = (DirectShowLib.IBaseFilter) new DirectShowLib.VideoMixingRenderer9(); DirectShowLib.IVMRFilterConfig9 filterConfig = (DirectShowLib.IVMRFilterConfig9)filter1; filterConfig.SetRenderingMode(VMR9Mode.Renderless); filterConfig.SetNumberOfStreams(2); DirectShowLib.IVMRSurfaceAllocatorNotify9 vmrSurfAllocNotify = (DirectShowLib.IVMRSurfaceAllocatorNotify9)filter1; try { int hr = vmrSurfAllocNotify.AdviseSurfaceAllocator(userId1, allocator); DsError.ThrowExceptionForHR(hr); hr = allocator.AdviseNotify(vmrSurfAllocNotify); DsError.ThrowExceptionForHR(hr); } catch { } graph1 = (DirectShowLib.IGraphBuilder) new DirectShowLib.FilterGraph(); graph1.AddFilter(filter1, "Video Mixing Renderer 9"); graph1.RenderFile(@"C:\Download\workmates.wmv", null); mediaControl1 = (DirectShowLib.IMediaControl)graph1; mediaControl1.Run(); }
// Start the capture graph public void Start() { if (!m_bRunning) { int hr = m_mediaCtrl.Run(); DsError.ThrowExceptionForHR(hr); m_bRunning = true; } }
// start playing public void Start() { // If we aren't already playing (or shutting down) if (m_State == GraphState.Stopped || m_State == GraphState.Paused) { int hr = m_mediaCtrl.Run(); DsError.ThrowExceptionForHR(hr); m_State = GraphState.Running; } }
private void Videotest1() { pGraphBuilder = (DirectShowLib.IGraphBuilder) new FilterGraph(); pMediaControl = (DirectShowLib.IMediaControl)pGraphBuilder; //controler pMediaEvent = (DirectShowLib.IMediaEvent)pGraphBuilder; //envent pMediaControl.RenderFile(@"C:\Users\trevor\Desktop\Videos\cctv2.wmv"); pVideoWindow = (DirectShowLib.IVideoWindow)pGraphBuilder; // renderFile을 실행 한 후 연결해줘야한다. 출력처를 알기위해서. //pVideoWindow.put_Caption("test"); // setTitle //pVideoWindow.put_FullScreenMode(OABool.True); //Video full Screen pVideoWindow.put_Owner(tabPage2.Handle); // tabPage2에 그리기. pVideoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings); Rectangle rect = tabPage2.ClientRectangle; pVideoWindow.SetWindowPosition(0, 0, rect.Right, rect.Bottom); pMediaControl.Run(); // Video play pMediaEvent.WaitForCompletion(-1, out eventCode); //블로킹을 실시하는 메소드 switch (eventCode) { case 0: textBox1.Text = "TimeOut"; break; case EventCode.UserAbort: //ex) alt+f4 textBox1.Text = "User Abort"; break; case EventCode.Complete: textBox1.Text = "complete"; break; case EventCode.ErrorAbort: textBox1.Text = "Error Abort"; break; } //pVideoWindow.put_FullScreenMode(OABool.False); // !full Screen //free Marshal.ReleaseComObject(pGraphBuilder); pGraphBuilder = null; Marshal.ReleaseComObject(pMediaControl); pMediaControl = null; Marshal.ReleaseComObject(pMediaEvent); pMediaEvent = null; }
//private void Videotest2() //{ // if (DirectShowBtn.Text == "DiShow") // { // play(); // DirectShowBtn.Text = "close"; // } // else if (DirectShowBtn.Text == "close") // { // CloseInterface(); // DirectShowBtn.Text = "DiShow"; // } //} private void play() { SetupGraph(tabPage2, @"C:\Users\trevor\Desktop\Videos\cctv2.wmv"); pMediaControl.Run(); pCapture(); }
public virtual void Play() { m_hr = m_MediaControl.Run(); DsError.ThrowExceptionForHR(m_hr); }