/// <summary> /// Start sending the data stream. /// </summary> public void Run() { if (fgm != null) { fgm.Run(); } }
/// <summary> /// Call the graph manager run method. /// </summary> /// <returns></returns> public bool Run() { if (playing) { Debug.WriteLine("Graph is already running."); return(false); } try { if (this.stream != null) { //Note: failing to do this will occasionally cause Run to fail. (as of 3.0 RC3) stream.BlockNextFrame(); } fgm.Run(); playing = true; } catch (Exception e) { Debug.WriteLine("Failed to run graph: " + e.ToString()); eventLog.WriteEntry("Failed to run graph: " + e.ToString(), EventLogEntryType.Error, 1001); return(false); } return(true); }
private void btnStartStop_Click(object sender, System.EventArgs e) { try { if (btnStartStop.Text == Start) { if (fgm == null) { BuildFilterGraph(); // Changing the bit rate on the fly hasn't been tested yet hsbBitRate.Enabled = false; } fgm.Run(); btnStartStop.Text = Stop; } else { // Pause, don't Stop, otherwise the media clock needs to be reset on the source // filter, and that isn't implemented yet. jasonv 3/29/2005 fgm.Pause(); btnStartStop.Text = Start; } } catch (Exception ex) { RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Strings.DataStreamError, ex.ToString()), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } }
private void btnStartStop_Click(object sender, System.EventArgs e) { try { if (btnStartStop.Text == Start) { if (fgm == null) { BuildFilterGraph(); // Changing the bit rate on the fly hasn't been tested yet hsbBitRate.Enabled = false; } fgm.Run(); btnStartStop.Text = Stop; } else { // Pause, don't Stop, otherwise the media clock needs to be reset on the source // filter, and that isn't implemented yet. jasonv 3/29/2005 fgm.Pause(); btnStartStop.Text = Start; } } catch (Exception ex) { MessageBox.Show(this, "Error starting or stopping the data stream. \r\n" + ex.ToString()); } }
/// <summary> /// Starts / Stops the video playing process (always starts with the first video) /// Toggles the Play / Stop button /// </summary> private void btnPlay_Click(object sender, System.EventArgs e) { if (!btnPause.Enabled && btnStop.Enabled) // we're paused, not stopped { Debug.Assert(fgm != null); fgm.Run(); } else { PlayFile(file); } btnPlay.Enabled = false; btnStop.Enabled = true; btnPause.Enabled = true; // Until we support changing the media type on the fly don't allow choosing another // file after the first one is started jasonv 4.22.2005 btnSelect.Enabled = false; }
private void clbWindows_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e) { if (e.NewValue == CheckState.Checked) { iSS.Handle(((Win32Window)clbWindows.SelectedItem).Window); fgm.Run(); } else { fgm.Stop(); } }
public bool LoadFile(string sfile, Panel parentHandler) { graphManager.RenderFile(sfile); mControl = graphManager; mPosition = graphManager; mWindow = graphManager; mWindow.Owner = parentHandler.Handle.ToInt32(); mWindow.WindowStyle = WS_CHILD; mWindow.SetWindowPosition(parentHandler.ClientRectangle.Left, parentHandler.ClientRectangle.Top, parentHandler.ClientRectangle.Width, parentHandler.ClientRectangle.Height); graphManager.Run(); return(true); }
public static void Main(string[] args) { FilgraphManagerClass graphClass = null; try { graphClass = new FilgraphManagerClass(); graphClass.RenderFile(@"C:\Users\Ryuzaki\Desktop\AviTokaiNoHitorigurashi.avi"); graphClass.Run(); int evCode; graphClass.WaitForCompletion(-1, out evCode); } catch (Exception) { } finally { graphClass = null; } }
private void CreateReceivingGraph() { // Tell the stream we will poll it for data with our own (DShow) thread // Instead of receiving data through the FrameReceived event rtpStream.IsUsingNextFrame = true; // Create receiving filtergraph fgm = new FilgraphManagerClass(); IGraphBuilder iGB = (IGraphBuilder)fgm; IBaseFilter rtpSource = RtpSourceClass.CreateInstance(); ((MSR.LST.MDShow.Filters.IRtpSource)rtpSource).Initialize(rtpStream); iGB.AddFilter(rtpSource, "RtpSource"); iGB.Render(Filter.GetPin(rtpSource, _PinDirection.PINDIR_OUTPUT, Guid.Empty, Guid.Empty, false, 0)); VideoWindow(); fgm.Run(); }