The filter graph exposes the IMediaControl object to allow applications to control the streaming of media through the filters in the graph. The interface provides methods for running, pausing, and stopping the streaming of data. It also provides applications with a simple method that builds graphs to play back media files.
Properties
Name | Description |
FilterCollection | Retrieves a collection of IFilterInfo objects representing the current filters in the graph. |
RegFilterCollection | Retrieves a collection of IRegFilterInfo objects representing the filters available in the registry. |
Methods
Name | Description |
AddSourceFilter | Adds to the graph the source filter that can read the given file name. |
GetState | Retrieves the state of the filter graph. |
Pause | Pauses all filters in the filter graph. |
RenderFile | Adds and connects all filters needed to play the specified file. |
Run | Switches the entire filter graph into run mode. |
Stop | Switches all filters in the filter graph to a stopped state. |
Adds the source filter that can read the given file name to the graph and returns the created IFilterInfo object.
objMediaControl.AddSourceFilter string, objFilterInfo
Retrieves a collection of IFilterInfo objects representing the filters in the graph. Returns an IAMCollection object.
Set objCollection = objMediaControl.FilterCollection
Returns a Long integer indicating the current state value.
objMediaControl.GetState msTimeout, State
Value | Description |
State_Paused | The media source is paused. |
State_Running | The media source is running. |
State_Stopped | The media source is stopped. |
Returns run-time error 567 if the state transition is not complete, or 0 if it completed successfully.
Not all state transitions are synchronous. For example, even though the Pause method returns immediately, the graph typically does not complete the transition into paused mode until data is ready at the renderer. This method will not return zero until the state transition has been completed.
If you specify a nonzero time-out, the method waits up to that number of milliseconds for the graph to leave the intermediate state. If the time-out expires before the state transition is complete, the return code will be 567, and the returned state will be the state into which the graph is transitioning (either State_Stopped, State_Paused, or State_Running).
Retrieves a collection of IRegFilterInfo objects representing the filters available in the registry.
Set objCollection = objMediaControl.RegFilterCollection
Returns an IAMCollection object.
Pauses all the filters in the filter graph.
objMediaControl.Pause
In the paused state, filters process data but do not render it. Data is pushed down the filter graph and is processed by transform filters as far as buffering permits. No data is rendered (except that media types capable of being rendered statically, such as video, have a static, poster frame rendered in paused mode). Therefore, putting a filter graph into a paused state cues the graph for immediate rendering when put into a running state.
Adds and connects filters needed to play the specified file.
objMediaControl.RenderFile string
This method allows an application to pass the name of a media file that it wants rendered to the filter graph manager. The filter graph manager will build a graph of the filters that are needed to play back this file.
Switches the entire filter graph into a running state.
objMediaControl.Run
If the filter graph is in the stopped state, this method first pauses the graph before running.
If an error value is returned, some filters within the graph might have successfully entered the running state. In a multistream graph, entire streams might be playing successfully. The application must determine whether to stop execution or not.
Switches all filters in the filter graph to a stopped state.
objMediaControl.Stop
In this mode, filters release resources and no data is processed. If the filters are in a running state, this method pauses them before stopping them. This allows video renderers to make a copy of the current frame for poster frame display while stopped.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.