[STRMBASE] Sync with Wine 3.0. CORE-14225

This commit is contained in:
Thomas Faber 2018-02-05 18:47:10 +01:00
parent 85b71880fa
commit a7ef5747b5
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
10 changed files with 205 additions and 97 deletions

View file

@ -250,7 +250,7 @@ In addition the following libs, dlls and source files are mostly based on code p
from Winehq CVS. If you are looking to update something in these files
check Wine current sources first as it may already be fixed.
reactos/sdk/lib/3rdparty/strmbase # Synced to WineStaging-1.9.16
reactos/sdk/lib/3rdparty/strmbase # Synced to Wine-3.0
reactos/sdk/lib/rtl/actctx.c # Partly synced with WineStaging-1.9.16
reactos/sdk/lib/rtl/timerqueue.c # Partly synced with WineStaging-1.7.55

View file

@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/list.h"
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc);
void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType);
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc);
@ -351,7 +353,7 @@ typedef struct tagOutputQueue {
BOOL bTerminate;
BOOL bSendAnyway;
struct list *SampleList;
struct list SampleList;
const struct OutputQueueFuncTable* pFuncsTable;
} OutputQueue;

View file

@ -118,18 +118,23 @@ HRESULT WINAPI EnumMediaTypes_Construct(BasePin *basePin, BasePin_GetMediaType e
pEnumMediaTypes->basePin = basePin;
i = 0;
while (enumFunc(basePin, i, &amt) == S_OK) i++;
while (enumFunc(basePin, i, &amt) == S_OK)
{
FreeMediaType(&amt);
i++;
}
pEnumMediaTypes->enumMediaDetails.cMediaTypes = i;
pEnumMediaTypes->enumMediaDetails.pMediaTypes = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * i);
memset(pEnumMediaTypes->enumMediaDetails.pMediaTypes, 0, sizeof(AM_MEDIA_TYPE) * i);
for (i = 0; i < pEnumMediaTypes->enumMediaDetails.cMediaTypes; i++)
{
enumFunc(basePin,i,&amt);
if (FAILED(CopyMediaType(&pEnumMediaTypes->enumMediaDetails.pMediaTypes[i], &amt)))
HRESULT hr;
if (FAILED(hr = enumFunc(basePin, i, &pEnumMediaTypes->enumMediaDetails.pMediaTypes[i])))
{
IEnumMediaTypes_Release(&pEnumMediaTypes->IEnumMediaTypes_iface);
return E_OUTOFMEMORY;
return hr;
}
}
*ppEnum = &pEnumMediaTypes->IEnumMediaTypes_iface;

View file

@ -40,7 +40,7 @@ static DWORD WINAPI OutputQueue_InitialThreadProc(LPVOID data)
static void OutputQueue_FreeSamples(OutputQueue *pOutputQueue)
{
struct list *cursor, *cursor2;
LIST_FOR_EACH_SAFE(cursor, cursor2, pOutputQueue->SampleList)
LIST_FOR_EACH_SAFE(cursor, cursor2, &pOutputQueue->SampleList)
{
QueuedEvent *qev = LIST_ENTRY(cursor, QueuedEvent, entry);
list_remove(cursor);
@ -77,14 +77,7 @@ HRESULT WINAPI OutputQueue_Construct(
This->bBatchExact = bBatchExact;
InitializeCriticalSection(&This->csQueue);
This->csQueue.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": OutputQueue.csQueue");
This->SampleList = HeapAlloc(GetProcessHeap(),0,sizeof(struct list));
if (!This->SampleList)
{
OutputQueue_Destroy(This);
*ppOutputQueue = NULL;
return E_OUTOFMEMORY;
}
list_init(This->SampleList);
list_init(&This->SampleList);
This->pInputPin = pInputPin;
IPin_AddRef(&pInputPin->pin.IPin_iface);
@ -121,8 +114,6 @@ HRESULT WINAPI OutputQueue_Destroy(OutputQueue *pOutputQueue)
DeleteCriticalSection(&pOutputQueue->csQueue);
CloseHandle(pOutputQueue->hProcessQueue);
HeapFree(GetProcessHeap(),0,pOutputQueue->SampleList);
IPin_Release(&pOutputQueue->pInputPin->pin.IPin_iface);
HeapFree(GetProcessHeap(),0,pOutputQueue);
return S_OK;
@ -159,11 +150,11 @@ HRESULT WINAPI OutputQueue_ReceiveMultiple(OutputQueue *pOutputQueue, IMediaSamp
qev->type = SAMPLE_PACKET;
qev->pSample = ppSamples[i];
IMediaSample_AddRef(ppSamples[i]);
list_add_tail(pOutputQueue->SampleList, &qev->entry);
list_add_tail(&pOutputQueue->SampleList, &qev->entry);
(*nSamplesProcessed)++;
}
if (!pOutputQueue->bBatchExact || list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize)
if (!pOutputQueue->bBatchExact || list_count(&pOutputQueue->SampleList) >= pOutputQueue->lBatchSize)
SetEvent(pOutputQueue->hProcessQueue);
LeaveCriticalSection(&pOutputQueue->csQueue);
}
@ -181,7 +172,7 @@ VOID WINAPI OutputQueue_SendAnyway(OutputQueue *pOutputQueue)
if (pOutputQueue->hThread)
{
EnterCriticalSection(&pOutputQueue->csQueue);
if (!list_empty(pOutputQueue->SampleList))
if (!list_empty(&pOutputQueue->SampleList))
{
pOutputQueue->bSendAnyway = TRUE;
SetEvent(pOutputQueue->hProcessQueue);
@ -204,7 +195,7 @@ VOID WINAPI OutputQueue_EOS(OutputQueue *pOutputQueue)
}
qev->type = EOS_PACKET;
qev->pSample = NULL;
list_add_tail(pOutputQueue->SampleList, &qev->entry);
list_add_tail(&pOutputQueue->SampleList, &qev->entry);
}
else
{
@ -226,14 +217,14 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
do
{
EnterCriticalSection(&pOutputQueue->csQueue);
if (!list_empty(pOutputQueue->SampleList) &&
if (!list_empty(&pOutputQueue->SampleList) &&
(!pOutputQueue->bBatchExact ||
list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize ||
list_count(&pOutputQueue->SampleList) >= pOutputQueue->lBatchSize ||
pOutputQueue->bSendAnyway
)
)
{
while (!list_empty(pOutputQueue->SampleList))
while (!list_empty(&pOutputQueue->SampleList))
{
IMediaSample **ppSamples;
LONG nSamples;
@ -242,10 +233,10 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
int i = 0;
/* First Pass Process Samples */
i = list_count(pOutputQueue->SampleList);
i = list_count(&pOutputQueue->SampleList);
ppSamples = HeapAlloc(GetProcessHeap(),0,sizeof(IMediaSample*) * i);
nSamples = 0;
LIST_FOR_EACH_SAFE(cursor, cursor2, pOutputQueue->SampleList)
LIST_FOR_EACH_SAFE(cursor, cursor2, &pOutputQueue->SampleList)
{
QueuedEvent *qev = LIST_ENTRY(cursor, QueuedEvent, entry);
if (qev->type == SAMPLE_PACKET)
@ -269,7 +260,7 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
HeapFree(GetProcessHeap(),0,ppSamples);
/* Process Non-Samples */
LIST_FOR_EACH_SAFE(cursor, cursor2, pOutputQueue->SampleList)
LIST_FOR_EACH_SAFE(cursor, cursor2, &pOutputQueue->SampleList)
{
QueuedEvent *qev = LIST_ENTRY(cursor, QueuedEvent, entry);
if (qev->type == EOS_PACKET)

View file

@ -329,7 +329,7 @@ HRESULT WINAPI BasePinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFER
{
BasePin *This = impl_from_IPin(iface);
TRACE("(%x%08x, %x%08x, %e)\n", (ULONG)(tStart >> 32), (ULONG)tStart, (ULONG)(tStop >> 32), (ULONG)tStop, dRate);
TRACE("(%s, %s, %e)\n", wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate);
This->tStart = tStart;
This->tStop = tStop;
@ -387,10 +387,8 @@ ULONG WINAPI BaseOutputPinImpl_Release(IPin * iface)
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
if (!refCount)
{
BaseOutputPin_Destroy(This);
return 0;
}
return refCount;
}
@ -1009,7 +1007,7 @@ HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart,
BaseInputPin *This = impl_BaseInputPin_from_IPin(iface);
newsegmentargs args;
TRACE("(%x%08x, %x%08x, %e)\n", (ULONG)(tStart >> 32), (ULONG)tStart, (ULONG)(tStop >> 32), (ULONG)tStop, dRate);
TRACE("(%s, %s, %e)\n", wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate);
args.tStart = This->pin.tStart = tStart;
args.tStop = This->pin.tStop = tStop;
@ -1202,7 +1200,7 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size
if (SUCCEEDED(InputPin_Init(InputPin_Vtbl, pPinInfo, vtbl, pCritSec, allocator, pPinImpl)))
{
*ppPin = (IPin *)pPinImpl;
*ppPin = &pPinImpl->pin.IPin_iface;
return S_OK;
}

View file

@ -67,7 +67,7 @@ static HRESULT WINAPI SeekInner_QueryInterface(IUnknown * iface,
REFIID riid,
LPVOID *ppvObj) {
PassThruImpl *This = impl_from_IUnknown_inner(iface);
TRACE("(%p)->(%s (%p), %p)\n", This, debugstr_guid(riid), riid, ppvObj);
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
if (This->bAggregatable)
This->bUnkOuterValid = TRUE;
@ -142,9 +142,9 @@ static HRESULT SeekOuter_QueryInterface(PassThruImpl *This, REFIID riid, LPVOID
{
HRESULT hr;
IUnknown_AddRef((IUnknown *)&(This->IUnknown_inner));
hr = IUnknown_QueryInterface((IUnknown *)&(This->IUnknown_inner), riid, ppv);
IUnknown_Release((IUnknown *)&(This->IUnknown_inner));
IUnknown_AddRef(&This->IUnknown_inner);
hr = IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppv);
IUnknown_Release(&This->IUnknown_inner);
This->bAggregatable = TRUE;
return hr;
}
@ -153,28 +153,28 @@ static HRESULT SeekOuter_QueryInterface(PassThruImpl *This, REFIID riid, LPVOID
return E_NOINTERFACE;
}
return IUnknown_QueryInterface((IUnknown *)&(This->IUnknown_inner), riid, ppv);
return IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppv);
}
static ULONG SeekOuter_AddRef(PassThruImpl *This)
{
if (This->outer_unk && This->bUnkOuterValid)
return IUnknown_AddRef(This->outer_unk);
return IUnknown_AddRef((IUnknown *)&(This->IUnknown_inner));
return IUnknown_AddRef(&This->IUnknown_inner);
}
static ULONG SeekOuter_Release(PassThruImpl *This)
{
if (This->outer_unk && This->bUnkOuterValid)
return IUnknown_Release(This->outer_unk);
return IUnknown_Release((IUnknown *)&(This->IUnknown_inner));
return IUnknown_Release(&This->IUnknown_inner);
}
static HRESULT WINAPI SeekingPassThru_QueryInterface(ISeekingPassThru *iface, REFIID riid, LPVOID *ppvObj)
{
PassThruImpl *This = impl_from_ISeekingPassThru(iface);
TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
return SeekOuter_QueryInterface(This, riid, ppvObj);
}
@ -266,7 +266,7 @@ static HRESULT WINAPI MediaSeekingPassThru_QueryInterface(IMediaSeeking *iface,
{
PassThruImpl *This = impl_from_IMediaSeeking(iface);
TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
return SeekOuter_QueryInterface(This, riid, ppvObj);
}
@ -516,11 +516,9 @@ static HRESULT WINAPI MediaSeekingPassThru_GetPositions(IMediaSeeking * iface, L
if (SUCCEEDED(hr)) {
hr = IMediaSeeking_GetPositions(seek, pCurrent, pStop);
IMediaSeeking_Release(seek);
} else if (hr == VFW_E_NOT_CONNECTED) {
*pCurrent = 0;
*pStop = 0;
hr = S_OK;
}
else
return E_NOTIMPL;
return hr;
}
@ -651,7 +649,7 @@ static HRESULT WINAPI MediaPositionPassThru_QueryInterface(IMediaPosition *iface
{
PassThruImpl *This = impl_from_IMediaPosition(iface);
TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
return SeekOuter_QueryInterface(This, riid, ppvObj);
}

View file

@ -228,7 +228,8 @@ static const BaseInputPinFuncTable input_BaseInputFuncTable = {
};
HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtbl, IUnknown *pUnkOuter, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseRendererFuncTable* pBaseFuncsTable)
HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtbl, IUnknown *pUnkOuter, const CLSID *pClsid,
DWORD_PTR DebugInfo, const BaseRendererFuncTable* pBaseFuncsTable)
{
PIN_INFO piInput;
HRESULT hr;
@ -247,7 +248,8 @@ HRESULT WINAPI BaseRenderer_Init(BaseRenderer * This, const IBaseFilterVtbl *Vtb
if (SUCCEEDED(hr))
{
hr = CreatePosPassThru(pUnkOuter ? pUnkOuter: (IUnknown*)This, TRUE, &This->pInputPin->pin.IPin_iface, &This->pPosition);
hr = CreatePosPassThru(pUnkOuter ? pUnkOuter: (IUnknown *)&This->filter.IBaseFilter_iface, TRUE,
&This->pInputPin->pin.IPin_iface, &This->pPosition);
if (FAILED(hr))
return hr;

View file

@ -223,7 +223,8 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p
{
ISeekingPassThru *passthru;
pTransformFilter->seekthru_unk = NULL;
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)pTransformFilter, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pTransformFilter->seekthru_unk);
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown *)&pTransformFilter->filter.IBaseFilter_iface, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&pTransformFilter->seekthru_unk);
if (SUCCEEDED(hr))
{
IUnknown_QueryInterface(pTransformFilter->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
@ -326,11 +327,8 @@ ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface)
IUnknown_Release(This->seekthru_unk);
BaseFilter_Destroy(&This->filter);
CoTaskMemFree(This);
return 0;
}
else
return refCount;
return refCount;
}
/** IMediaFilter methods **/
@ -530,7 +528,7 @@ static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENC
TransformFilter* pTransform;
HRESULT hr = S_OK;
TRACE("(%p)->()\n", iface);
TRACE("(%p)->(%s %s %e)\n", iface, wine_dbgstr_longlong(tStart), wine_dbgstr_longlong(tStop), dRate);
pTransform = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
EnterCriticalSection(&pTransform->filter.csFilter);

View file

@ -43,6 +43,33 @@ HRESULT WINAPI BaseControlVideo_Destroy(BaseControlVideo *pControlVideo)
return BaseDispatch_Destroy(&pControlVideo->baseDispatch);
}
static HRESULT BaseControlVideoImpl_CheckSourceRect(BaseControlVideo *This, RECT *pSourceRect)
{
LONG VideoWidth, VideoHeight;
HRESULT hr;
if (IsRectEmpty(pSourceRect))
return E_INVALIDARG;
hr = BaseControlVideoImpl_GetVideoSize((IBasicVideo *)This, &VideoWidth, &VideoHeight);
if (FAILED(hr))
return hr;
if (pSourceRect->top < 0 || pSourceRect->left < 0 ||
pSourceRect->bottom > VideoHeight || pSourceRect->right > VideoWidth)
return E_INVALIDARG;
return S_OK;
}
static HRESULT BaseControlVideoImpl_CheckTargetRect(BaseControlVideo *This, RECT *pTargetRect)
{
if (IsRectEmpty(pTargetRect))
return E_INVALIDARG;
return S_OK;
}
HRESULT WINAPI BaseControlVideoImpl_GetTypeInfoCount(IBasicVideo *iface, UINT *pctinfo)
{
BaseControlVideo *This = impl_from_IBasicVideo(iface);
@ -85,6 +112,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_AvgTimePerFrame(IBasicVideo *iface, REFT
VIDEOINFOHEADER *vih;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
if (!pAvgTimePerFrame)
return E_POINTER;
if (!This->pPin->pConnectedTo)
return VFW_E_NOT_CONNECTED;
@ -102,6 +131,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_BitRate(IBasicVideo *iface, LONG *pBitRa
TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
if (!pBitRate)
return E_POINTER;
if (!This->pPin->pConnectedTo)
return VFW_E_NOT_CONNECTED;
@ -117,6 +148,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_BitErrorRate(IBasicVideo *iface, LONG *p
TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
if (!pBitErrorRate)
return E_POINTER;
if (!This->pPin->pConnectedTo)
return VFW_E_NOT_CONNECTED;
@ -131,6 +164,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_VideoWidth(IBasicVideo *iface, LONG *pVi
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
if (!pVideoWidth)
return E_POINTER;
vih = This->pFuncsTable->pfnGetVideoFormat(This);
*pVideoWidth = vih->bmiHeader.biWidth;
@ -144,6 +179,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_VideoHeight(IBasicVideo *iface, LONG *pV
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
if (!pVideoHeight)
return E_POINTER;
vih = This->pFuncsTable->pfnGetVideoFormat(This);
*pVideoHeight = abs(vih->bmiHeader.biHeight);
@ -155,13 +192,20 @@ HRESULT WINAPI BaseControlVideoImpl_put_SourceLeft(IBasicVideo *iface, LONG Sour
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
SourceRect.left = SourceLeft;
This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.right = (SourceRect.right - SourceRect.left) + SourceLeft;
SourceRect.left = SourceLeft;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_SourceLeft(IBasicVideo *iface, LONG *pSourceLeft)
@ -170,6 +214,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_SourceLeft(IBasicVideo *iface, LONG *pSo
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
if (!pSourceLeft)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceLeft = SourceRect.left;
@ -180,13 +226,19 @@ HRESULT WINAPI BaseControlVideoImpl_put_SourceWidth(IBasicVideo *iface, LONG Sou
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
SourceRect.right = SourceRect.left + SourceWidth;
This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.right = SourceRect.left + SourceWidth;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_SourceWidth(IBasicVideo *iface, LONG *pSourceWidth)
@ -195,6 +247,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_SourceWidth(IBasicVideo *iface, LONG *pS
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
if (!pSourceWidth)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceWidth = SourceRect.right - SourceRect.left;
@ -205,13 +259,20 @@ HRESULT WINAPI BaseControlVideoImpl_put_SourceTop(IBasicVideo *iface, LONG Sourc
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
SourceRect.top = SourceTop;
This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.bottom = (SourceRect.bottom - SourceRect.top) + SourceTop;
SourceRect.top = SourceTop;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_SourceTop(IBasicVideo *iface, LONG *pSourceTop)
@ -220,6 +281,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_SourceTop(IBasicVideo *iface, LONG *pSou
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
if (!pSourceTop)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceTop = SourceRect.top;
@ -230,13 +293,19 @@ HRESULT WINAPI BaseControlVideoImpl_put_SourceHeight(IBasicVideo *iface, LONG So
{
RECT SourceRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
SourceRect.bottom = SourceRect.top + SourceHeight;
This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
if (SUCCEEDED(hr))
{
SourceRect.bottom = SourceRect.top + SourceHeight;
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_SourceHeight(IBasicVideo *iface, LONG *pSourceHeight)
@ -245,6 +314,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_SourceHeight(IBasicVideo *iface, LONG *p
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
if (!pSourceHeight)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pSourceHeight = SourceRect.bottom - SourceRect.top;
@ -256,13 +327,20 @@ HRESULT WINAPI BaseControlVideoImpl_put_DestinationLeft(IBasicVideo *iface, LONG
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
DestRect.left = DestinationLeft;
This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.right = (DestRect.right - DestRect.left) + DestinationLeft;
DestRect.left = DestinationLeft;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_DestinationLeft(IBasicVideo *iface, LONG *pDestinationLeft)
@ -271,6 +349,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_DestinationLeft(IBasicVideo *iface, LONG
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
if (!pDestinationLeft)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationLeft = DestRect.left;
@ -281,13 +361,19 @@ HRESULT WINAPI BaseControlVideoImpl_put_DestinationWidth(IBasicVideo *iface, LON
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
DestRect.right = DestRect.left + DestinationWidth;
This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.right = DestRect.left + DestinationWidth;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_DestinationWidth(IBasicVideo *iface, LONG *pDestinationWidth)
@ -296,6 +382,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_DestinationWidth(IBasicVideo *iface, LON
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
if (!pDestinationWidth)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationWidth = DestRect.right - DestRect.left;
@ -306,13 +394,20 @@ HRESULT WINAPI BaseControlVideoImpl_put_DestinationTop(IBasicVideo *iface, LONG
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
DestRect.top = DestinationTop;
This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.bottom = (DestRect.bottom - DestRect.top) + DestinationTop;
DestRect.top = DestinationTop;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_DestinationTop(IBasicVideo *iface, LONG *pDestinationTop)
@ -321,6 +416,8 @@ HRESULT WINAPI BaseControlVideoImpl_get_DestinationTop(IBasicVideo *iface, LONG
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
if (!pDestinationTop)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationTop = DestRect.top;
@ -331,13 +428,19 @@ HRESULT WINAPI BaseControlVideoImpl_put_DestinationHeight(IBasicVideo *iface, LO
{
RECT DestRect;
BaseControlVideo *This = impl_from_IBasicVideo(iface);
HRESULT hr;
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
DestRect.right = DestRect.left + DestinationHeight;
This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
if (SUCCEEDED(hr))
{
DestRect.bottom = DestRect.top + DestinationHeight;
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
}
if (SUCCEEDED(hr))
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
return S_OK;
return hr;
}
HRESULT WINAPI BaseControlVideoImpl_get_DestinationHeight(IBasicVideo *iface, LONG *pDestinationHeight)
@ -346,8 +449,10 @@ HRESULT WINAPI BaseControlVideoImpl_get_DestinationHeight(IBasicVideo *iface, LO
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
if (!pDestinationHeight)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pDestinationHeight = DestRect.right - DestRect.left;
*pDestinationHeight = DestRect.bottom - DestRect.top;
return S_OK;
}
@ -360,9 +465,9 @@ HRESULT WINAPI BaseControlVideoImpl_SetSourcePosition(IBasicVideo *iface, LONG L
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
SetRect(&SourceRect, Left, Top, Left + Width, Top + Height);
This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
return S_OK;
if (FAILED(BaseControlVideoImpl_CheckSourceRect(This, &SourceRect)))
return E_INVALIDARG;
return This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
}
HRESULT WINAPI BaseControlVideoImpl_GetSourcePosition(IBasicVideo *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
@ -371,6 +476,8 @@ HRESULT WINAPI BaseControlVideoImpl_GetSourcePosition(IBasicVideo *iface, LONG *
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
if (!pLeft || !pTop || !pWidth || !pHeight)
return E_POINTER;
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
*pLeft = SourceRect.left;
@ -397,9 +504,9 @@ HRESULT WINAPI BaseControlVideoImpl_SetDestinationPosition(IBasicVideo *iface, L
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
SetRect(&DestRect, Left, Top, Left + Width, Top + Height);
This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
return S_OK;
if (FAILED(BaseControlVideoImpl_CheckTargetRect(This, &DestRect)))
return E_INVALIDARG;
return This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
}
HRESULT WINAPI BaseControlVideoImpl_GetDestinationPosition(IBasicVideo *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
@ -408,6 +515,8 @@ HRESULT WINAPI BaseControlVideoImpl_GetDestinationPosition(IBasicVideo *iface, L
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
if (!pLeft || !pTop || !pWidth || !pHeight)
return E_POINTER;
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
*pLeft = DestRect.left;
@ -432,6 +541,8 @@ HRESULT WINAPI BaseControlVideoImpl_GetVideoSize(IBasicVideo *iface, LONG *pWidt
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
if (!pWidth || !pHeight)
return E_POINTER;
vih = This->pFuncsTable->pfnGetVideoFormat(This);
*pHeight = vih->bmiHeader.biHeight;
@ -445,15 +556,18 @@ HRESULT WINAPI BaseControlVideoImpl_GetVideoPaletteEntries(IBasicVideo *iface, L
BaseControlVideo *This = impl_from_IBasicVideo(iface);
TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
if (!pRetrieved || !pPalette)
return E_POINTER;
if (pRetrieved)
*pRetrieved = 0;
*pRetrieved = 0;
return VFW_E_NO_PALETTE_AVAILABLE;
}
HRESULT WINAPI BaseControlVideoImpl_GetCurrentImage(IBasicVideo *iface, LONG *pBufferSize, LONG *pDIBImage)
{
BaseControlVideo *This = impl_from_IBasicVideo(iface);
if (!pBufferSize || !pDIBImage)
return E_POINTER;
return This->pFuncsTable->pfnGetStaticImage(This, pBufferSize, pDIBImage);
}

View file

@ -285,7 +285,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG W
TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
return E_INVALIDARG;
SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WindowStyle);