Commit 09b49669 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

Don't use fullscreen mode in video renderer for now and improve error

handling a bit. Improved a bit Run/Pause/Stop methods of parser template.
parent ef53e7a2
...@@ -218,7 +218,7 @@ static HRESULT AVIDec_ConnectInput(TransformFilterImpl* pTransformFilter, const ...@@ -218,7 +218,7 @@ static HRESULT AVIDec_ConnectInput(TransformFilterImpl* pTransformFilter, const
/* Update output media type */ /* Update output media type */
CopyMediaType(outpmt, pmt); CopyMediaType(outpmt, pmt);
outpmt->subtype = *outsubtype; outpmt->subtype = *outsubtype;
memcpy(&(((VIDEOINFOHEADER*)outpmt->pbFormat)->bmiHeader), This->pBihOut, This->pBihOut->biSize); memcpy(&(((VIDEOINFOHEADER*)outpmt->pbFormat)->bmiHeader), This->pBihOut, This->pBihOut->biSize);
/* Update buffer size of media samples in output */ /* Update buffer size of media samples in output */
((OutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pBihOut->biSizeImage; ((OutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pBihOut->biSizeImage;
......
...@@ -223,6 +223,11 @@ static HRESULT WINAPI Parser_Stop(IBaseFilter * iface) ...@@ -223,6 +223,11 @@ static HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
EnterCriticalSection(&This->csFilter); EnterCriticalSection(&This->csFilter);
{ {
if (This->state == State_Stopped)
{
LeaveCriticalSection(&This->csFilter);
return S_OK;
}
hr = PullPin_StopProcessing(This->pInputPin); hr = PullPin_StopProcessing(This->pInputPin);
This->state = State_Stopped; This->state = State_Stopped;
} }
...@@ -241,6 +246,11 @@ static HRESULT WINAPI Parser_Pause(IBaseFilter * iface) ...@@ -241,6 +246,11 @@ static HRESULT WINAPI Parser_Pause(IBaseFilter * iface)
EnterCriticalSection(&This->csFilter); EnterCriticalSection(&This->csFilter);
{ {
if (This->state == State_Paused)
{
LeaveCriticalSection(&This->csFilter);
return S_OK;
}
bInit = (This->state == State_Stopped); bInit = (This->state == State_Stopped);
This->state = State_Paused; This->state = State_Paused;
} }
...@@ -250,7 +260,7 @@ static HRESULT WINAPI Parser_Pause(IBaseFilter * iface) ...@@ -250,7 +260,7 @@ static HRESULT WINAPI Parser_Pause(IBaseFilter * iface)
{ {
unsigned int i; unsigned int i;
/*hr = PullPin_Seek(This->pInputPin, This->CurrentChunkOffset, This->EndOfFile); */ hr = PullPin_Seek(This->pInputPin, 0, ((LONGLONG)0x7fffffff << 32) | 0xffffffff);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = PullPin_InitProcessing(This->pInputPin); hr = PullPin_InitProcessing(This->pInputPin);
...@@ -275,6 +285,9 @@ static HRESULT WINAPI Parser_Pause(IBaseFilter * iface) ...@@ -275,6 +285,9 @@ static HRESULT WINAPI Parser_Pause(IBaseFilter * iface)
} }
/* FIXME: else pause thread */ /* FIXME: else pause thread */
if (SUCCEEDED(hr))
hr = PullPin_PauseProcessing(This->pInputPin);
return hr; return hr;
} }
...@@ -288,19 +301,34 @@ static HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart) ...@@ -288,19 +301,34 @@ static HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
EnterCriticalSection(&This->csFilter); EnterCriticalSection(&This->csFilter);
{ {
if (This->state == State_Running)
{
LeaveCriticalSection(&This->csFilter);
return S_OK;
}
This->rtStreamStart = tStart; This->rtStreamStart = tStart;
This->state = State_Running;
hr = PullPin_InitProcessing(This->pInputPin); hr = PullPin_Seek(This->pInputPin, tStart, ((LONGLONG)0x7fffffff << 32) | 0xffffffff);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr) && (This->state == State_Stopped))
{ {
for (i = 1; i < This->cStreams + 1; i++) hr = PullPin_InitProcessing(This->pInputPin);
{
OutputPin_CommitAllocator((OutputPin *)This->ppPins[i]); if (SUCCEEDED(hr))
{
for (i = 1; i < (This->cStreams + 1); i++)
{
OutputPin_CommitAllocator((OutputPin *)This->ppPins[i]);
}
} }
hr = PullPin_StartProcessing(This->pInputPin);
} }
if (SUCCEEDED(hr))
hr = PullPin_StartProcessing(This->pInputPin);
if (SUCCEEDED(hr))
This->state = State_Running;
} }
LeaveCriticalSection(&This->csFilter); LeaveCriticalSection(&This->csFilter);
......
...@@ -127,7 +127,7 @@ static HRESULT VideoRenderer_CreatePrimarySurface(IBaseFilter * iface) ...@@ -127,7 +127,7 @@ static HRESULT VideoRenderer_CreatePrimarySurface(IBaseFilter * iface)
return hr; return hr;
} }
hr = IDirectDraw_SetCooperativeLevel(This->ddraw, NULL, DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE); hr = IDirectDraw_SetCooperativeLevel(This->ddraw, GetDesktopWindow(), DDSCL_NORMAL);
if (FAILED(hr)) { if (FAILED(hr)) {
ERR("Cannot set fulscreen mode\n"); ERR("Cannot set fulscreen mode\n");
return hr; return hr;
...@@ -298,12 +298,13 @@ static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample) ...@@ -298,12 +298,13 @@ static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
if (!This->init) if (!This->init)
{ {
This->init = 1;
hr = VideoRenderer_CreatePrimarySurface(iface); hr = VideoRenderer_CreatePrimarySurface(iface);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Unable to create primary surface\n"); ERR("Unable to create primary surface\n");
return hr;
} }
This->init = 1;
} }
VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream); VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment