/// <summary> /// This method waits until the playback of the sound has finished. /// No Unit Test necessary /// </summary> /// <remarks>Documented by Dev04, 2007-07-19</remarks> public void Wait() { if (StreamInfo != null) { while (StreamInfo.CurrentPosition < StreamInfo.StopTime) { Thread.Sleep(100); } mp3control.Stop(); } }
public void Stop() { if ((State != ContainerState.CS_Running) && (State != ContainerState.CS_Paused)) { return; } if ((TestControl == null) || (MediaControl == null)) { throw new VideoException("Internal error in AV engine"); } Exception ex = null; Action StopAction = new Action(() => { try { int StreamState = 0; State = ContainerState.CS_Stopped; VideoWindow.Visible = 0; TestControl.GetStreamHealth(ref StreamState); TestControl.ControlStream(2); //if (StreamState > 0)// TODO why it works fine that way? why it locks instead sometimes? { System.Diagnostics.Trace.WriteLine("Trying to close DirectShow " + StreamState.ToString()); MediaControl.Stop(); System.Diagnostics.Trace.WriteLine("DirectShow closed"); } //else { //System.Diagnostics.Trace.WriteLine("Bypassing DirectShow close as it is not safe " + StreamState.ToString()); //MediaControl.StopWhenReady(); //System.Diagnostics.Trace.WriteLine("DirectShow lazy close initiated"); } TestControl.ControlStream(0); } catch (Exception e) { ex = e; } }); IAsyncResult StopResult = StopAction.BeginInvoke(null, null); if (RTSP) { ProceedAction(step_StopThread, step_TEARDOWN, StopResult, ref ex); } else { // skip TEARDOWN step ProceedAction(step_StopThread, step_StopThread, StopResult, ref ex); } }
public void StopMp3Thread() { if (mp3control != null) { mp3control.Stop(); } }
}//public static void QuartzPause() ///<summary>QuartzStop.</summary> ///<param name="exceptionMessage">Exception message.</param> public static void QuartzStop ( ref string exceptionMessage ) { try { mediaControl.Stop(); }//try catch (System.Exception exception) { exceptionMessage = exception.Message; System.Console.WriteLine("Exception: {0}", exception.Message); } }//public static void QuartzStop()
public void Clear(bool doStop) { if (doStop) { if (TestControl != null) { TestControl.StopActivity(); } if (MediaControl != null) { if (!UseToTerminate) { MediaControl.Stop(); } } } if (VideoWindow != null) { VideoWindow.Visible = 0; } FileValid = false; TestControl = null; MediaControl = null; VideoWindow = null; try { if (FilterGraph != null) { Marshal.ReleaseComObject(FilterGraph); } } catch (Exception) { } FilterGraph = null; ClearName(); }
public void Stop() { if (State != ContainerState.CS_Running) { return; } if ((TestControl == null) || (MediaControl == null)) { throw new VideoException("Internal error in AV engine"); } Exception ex = null; Action StopAction = new Action(() => { try { int StreamState = 0; State = ContainerState.CS_Stopped; VideoWindow.Visible = 0; TestControl.GetStreamHealth(ref StreamState); TestControl.ControlStream(2); //if (StreamState > 0)// TODO why it works fine that way? why it locks instead sometimes? { System.Diagnostics.Trace.WriteLine("Trying to close DirectShow " + StreamState.ToString()); MediaControl.Stop(); System.Diagnostics.Trace.WriteLine("DirectShow closed"); } //else { //System.Diagnostics.Trace.WriteLine("Bypassing DirectShow close as it is not safe " + StreamState.ToString()); //MediaControl.StopWhenReady(); //System.Diagnostics.Trace.WriteLine("DirectShow lazy close initiated"); } TestControl.ControlStream(0); } catch (Exception e) { ex = e; } }); IAsyncResult StopResult = StopAction.BeginInvoke(null, null); #if true ProceedAction(9, 10, StopResult, ref ex); #else if (EventConsumer != null) { LogActivity(Timeout, 9, 10, StopResult); } else { StopResult.AsyncWaitHandle.WaitOne(Timeout); } if (!StopResult.IsCompleted) { throw new VideoException("Connection Timeout"); } if (ex != null) { ProceedEx(ex); //throw ex; } #endif }