IMediaControl::GetState method (control.h)
GetState method retrieves the state of the filter graph—paused, running, or stopped.
State transitions are not necessarily synchronous. Therefore, when you call this method, the filter graph might be in transition to a new state. In that case, the method blocks until the transition completes or until the specified time-out elapses.
HRESULT GetState( [in] LONG msTimeout, [out] OAFilterState *pfs );
Duration of the time-out, in milliseconds, or INFINITE to specify an infinite time-out.
Receives a member of the FILTER_STATE enumeration.
Returns an HRESULT value. Possible values include the following.
||The filter graph is still in transition to the indicated state.|
||The filter graph is paused, but cannot cue data.|
Applications can use this method to determine whether playback has started after a call to IMediaControl::Run. Generally, applications should have their own mechanism for tracking which state they have put the filter graph into. Applications typically use the current state to determine which user interface controls are enabled or disabled. For example, once the graph goes into the running state, the application might disable a "Play" button and enable "Stop" and "Pause" buttons.
If the filter graph is in a transition to a new state, the returned state is the new state, not the previous state.
This method returns an error if there is a call on another thread to change the state while this method is blocked.
Avoid specifying a time-out of INFINITE, because threads cannot process messages while waiting in
GetState. If you call
GetState from the thread that processes Windows messages, specify small wait times on the call in order to remain responsive to user input. This is especially important when the source is streaming over a network or from the Internet because state transitions in these environments can take significantly more time to complete.
The FILTER_STATE enumeration. You can cast the variable as follows:
FILTER_STATE fs; hr = pControl->GetState(msTimeOut, (OAFilterState*)&fs);
For more information about filter graph states, see Filter States.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||control.h (include Dshow.h)|