示例#1
0
void Video::abort()
{
	HRESULT hr;
	IMediaControl *pMC;

	if(!init_success)
		return;


	// Obtain the interface to our filter graph
	if( (hr = pGraph->QueryInterface(IID_IMediaControl, (void **) &pMC)) == 0)
	{
		// Ask the filter graph to stop and release the interface
		hr = pMC->Stop();
		pMC->Release();

		// rewind to the beginning
		IMediaPosition *pMP;
		if( (hr=pGraph->QueryInterface( IID_IMediaPosition, (void **) &pMP))==0)
		{
			pMP->put_CurrentPosition( 0);
			pMP->Release();
		}
	}
	state = STOPPED;

	if( hr && !skip_on_fail_flag)
		err.run("video.abort error %d", hr);
}
STDMETHODIMP
CPosPassThru::put_CurrentPosition(REFTIME llTime)
{
    IMediaPosition* pMP;
    HRESULT hr = GetPeer(&pMP);
    if (FAILED(hr)) {
	return hr;
    }
    hr = pMP->put_CurrentPosition(llTime);
    pMP->Release();
    return hr;
}
示例#3
0
void PlaybackControls::setSeek(int value)
{
	IMediaPosition *pPosition;
	if (mpGraph)
	{
		HRESULT hr = mpGraph->QueryInterface(IID_IMediaPosition, (void **)&pPosition);
		if (SUCCEEDED(hr))
		{
			pPosition->put_CurrentPosition(value);
		}
		pPosition->Release();
	}
}