共用方式為


IMediaControl::Run

 
Microsoft DirectShow 9.0

IMediaControl::Run

The Run method runs all the filters in the filter graph. While the graph is running, data moves through the graph and is rendered.

Syntax

  HRESULT Run(void);

Return Values

Returns an HRESULT value. Possible values include the following.

Return code Description
S_FALSE The graph is preparing to run, but some filters have not completed the transition to a running state.
S_OK All filters in the graph completed the transition to a running state.

Remarks

If the filter graph is stopped, this method pauses the graph before running. If the graph is already running, the method returns S_OK but has no effect.

The graph runs until the application calls the IMediaControl::Pause or IMediaControl::Stop method. When playback reaches the end of the stream, the graph continues to run, but the filters do not stream any more data. At that point, the application can pause or stop the graph. For information about the end-of-stream event, see IMediaControl::Pause and EC_COMPLETE.

This method does not seek to the beginning of the stream. Therefore, if you run the graph, pause it, and then run it again, playback resumes from the paused position. If you run the graph after it has reached the end of the stream, nothing is rendered. To seek the graph, use the IMediaSeeking interface.

If the return value is S_FALSE, you can wait for the transition to complete by calling the IMediaControl::GetState method. If the method fails, some filters might be in a running state. In a multistream graph, entire streams might be playing successfully. The application must determine whether to stop the graph.

Requirements

Header: Declared in Control.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also