コード例 #1
0
ファイル: OVIDEO.cpp プロジェクト: the3dfxdude/7kaa
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);
}
コード例 #2
0
STDMETHODIMP
CPosPassThru::CanSeekBackward(LONG *pCanSeekBackward)
{
    IMediaPosition* pMP;
    HRESULT hr = GetPeer(&pMP);
    if (FAILED(hr)) {
	return hr;
    }
    hr = pMP->CanSeekBackward(pCanSeekBackward);
    pMP->Release();
    return hr;
}
コード例 #3
0
STDMETHODIMP
CPosPassThru::get_Rate(double * pdRate)
{
    IMediaPosition* pMP;
    HRESULT hr = GetPeer(&pMP);
    if (FAILED(hr)) {
	return hr;
    }
    hr = pMP->get_Rate(pdRate);
    pMP->Release();
    return hr;
}
コード例 #4
0
STDMETHODIMP
CPosPassThru::put_PrerollTime(REFTIME llTime)
{
    IMediaPosition* pMP;
    HRESULT hr = GetPeer(&pMP);
    if (FAILED(hr)) {
	return hr;
    }
    hr = pMP->put_PrerollTime(llTime);
    pMP->Release();
    return hr;
}
コード例 #5
0
STDMETHODIMP
CPosPassThru::get_StopTime(REFTIME * pllTime)
{
    IMediaPosition* pMP;
    HRESULT hr = GetPeer(&pMP);
    if (FAILED(hr)) {
	return hr;
    }
    hr = pMP->get_StopTime(pllTime);
    pMP->Release();
    return hr;
}
コード例 #6
0
STDMETHODIMP
CPosPassThru::get_Duration(REFTIME * plength)
{
    IMediaPosition* pMP;
    HRESULT hr = GetPeer(&pMP);
    if (FAILED(hr)) {
	return hr;
    }

    hr = pMP->get_Duration(plength);
    pMP->Release();
    return hr;
}
コード例 #7
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();
	}
}
コード例 #8
0
STDMETHODIMP
CPosPassThru::put_Rate(double dRate)
{
    if (0.0 == dRate) {
		return E_INVALIDARG;
    }

    IMediaPosition* pMP;
    HRESULT hr = GetPeer(&pMP);
    if (FAILED(hr)) {
	return hr;
    }
    hr = pMP->put_Rate(dRate);
    pMP->Release();
    return hr;
}
コード例 #9
0
void PlaybackControls::getSeek()
{
	if (needsReset == true)
	{
		mpParentWindow->resize(351, 161);
		QSize size = mpParentWindow->size();
		int height = size.height();
		int width = size.width();
		if (width < 360)
		{
			needsReset = false;
		}
	}
	reset = true;
	REFTIME time;
	REFTIME duration;
	QString timeString;
	QString durationString;
	IMediaPosition *pPosition;
	if (mpGraph)
	{
		HRESULT hr = mpGraph->QueryInterface(IID_IMediaPosition, (void **)&pPosition);
		if (SUCCEEDED(hr))
		{
			pPosition->get_CurrentPosition(&time);
			pPosition->get_Duration(&duration);
			timeString.setNum(floor(time));
			durationString.setNum(floor(duration));
			QString output = timeString;
			output += " : ";
			output += durationString;
			mpParentWindow->seekLabel->setText(output);
			mpParentWindow->seekBar->setRange(0, duration);
			if (!mpParentWindow->seekBar->isSliderDown())
			{
				mpParentWindow->seekBar->setValue(time);
			}
		}
		pPosition->Release();
	}
}