Initialize the COM libraries for the newly created worker thread in

the AVI splitter.
Fixed some returned error codes.
Show refcount in the AddRef/Release traces in filter.
Added 24 bits source in the video renderer.
This commit is contained in:
Christian Costa 2004-12-27 17:15:58 +00:00 committed by Alexandre Julliard
parent 35a92e16c7
commit 9b8d5c625f
7 changed files with 39 additions and 18 deletions

View file

@ -401,14 +401,18 @@ static HRESULT WINAPI AVIDec_QueryInterface(IBaseFilter * iface, REFIID riid, LP
static ULONG WINAPI AVIDec_AddRef(IBaseFilter * iface)
{
AVIDecImpl *This = (AVIDecImpl *)iface;
TRACE("(%p/%p)->()\n", This, iface);
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI AVIDec_Release(IBaseFilter * iface)
{
AVIDecImpl *This = (AVIDecImpl *)iface;
TRACE("(%p/%p)->()\n", This, iface);
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
if (!InterlockedDecrement(&This->refCount))
{
ULONG i;

View file

@ -211,14 +211,18 @@ static HRESULT WINAPI AVISplitter_QueryInterface(IBaseFilter * iface, REFIID rii
static ULONG WINAPI AVISplitter_AddRef(IBaseFilter * iface)
{
AVISplitter *This = (AVISplitter *)iface;
TRACE("()\n");
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI AVISplitter_Release(IBaseFilter * iface)
{
AVISplitter *This = (AVISplitter *)iface;
TRACE("()\n");
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
if (!InterlockedDecrement(&This->refCount))
{
ULONG i;

View file

@ -358,14 +358,18 @@ static HRESULT WINAPI DSoundRender_QueryInterface(IBaseFilter * iface, REFIID ri
static ULONG WINAPI DSoundRender_AddRef(IBaseFilter * iface)
{
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
TRACE("(%p/%p)->()\n", This, iface);
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI DSoundRender_Release(IBaseFilter * iface)
{
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
TRACE("(%p/%p)->()\n", This, iface);
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
if (!InterlockedDecrement(&This->refCount))
{
DeleteCriticalSection(&This->csFilter);

View file

@ -283,7 +283,7 @@ static HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName,
if (SUCCEEDED(hr) && !bFound)
{
ERR("Media class not found\n");
hr = S_FALSE;
hr = E_FAIL;
}
else if (bFound)
TRACE("Found file's class: major = %s, subtype = %s\n", qzdebugstr_guid(majorType), qzdebugstr_guid(minorType));
@ -358,7 +358,7 @@ static ULONG WINAPI AsyncReader_AddRef(IBaseFilter * iface)
{
AsyncReader *This = (AsyncReader *)iface;
TRACE("()\n");
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
return InterlockedIncrement(&This->refCount);
}
@ -367,7 +367,7 @@ static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
{
AsyncReader *This = (AsyncReader *)iface;
TRACE("()\n");
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
if (!InterlockedDecrement(&This->refCount))
{

View file

@ -1030,7 +1030,7 @@ error:
IGraphBuilder_RemoveFilter(iface, preader);
IBaseFilter_Release(preader);
return S_OK;
return hr;
}
static HRESULT WINAPI Graphbuilder_SetLogFile(IGraphBuilder *iface,

View file

@ -1134,6 +1134,8 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
REFERENCE_TIME rtCurrent;
ALLOCATOR_PROPERTIES allocProps;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
SetEvent(This->hEventStateChanged);
hr = IMemAllocator_GetProperties(This->pAlloc, &allocProps);
@ -1174,6 +1176,8 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
if (pSample)
IMediaSample_Release(pSample);
}
CoUninitialize();
}
static void CALLBACK PullPin_Thread_Stop(ULONG_PTR iface)

View file

@ -222,21 +222,22 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
*(ptr + i*psz + 3 + j * sdesc.u1.lPitch) = 0xFF;
}
}
else if (format->bmiHeader.biBitCount == 32)
else if ((format->bmiHeader.biBitCount == 24) || (format->bmiHeader.biBitCount == 32))
{
int psz = sdesc.ddpfPixelFormat.u1.dwRGBBitCount == 32 ? 4 : 3;
int dpsz = sdesc.ddpfPixelFormat.u1.dwRGBBitCount == 32 ? 4 : 3;
int spsz = format->bmiHeader.biBitCount == 32 ? 4 : 3;
for (j = 0; j < height; j++)
for (i = 0; i < width; i++)
{
*(ptr + i*psz + 0 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*4 + 0);
*(ptr + i*psz + 1 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*4 + 1);
*(ptr + i*psz + 2 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*4 + 2);
if (psz == 4)
*(ptr + i*psz + 3 + j * sdesc.u1.lPitch) = 0xFF;
*(ptr + i*dpsz + 0 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*spsz + 0);
*(ptr + i*dpsz + 1 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*spsz + 1);
*(ptr + i*dpsz + 2 + j * sdesc.u1.lPitch) = *(data + (i + 0 + (height-1-j) * width)*spsz + 2);
if (dpsz == 4)
*(ptr + i*dpsz + 3 + j * sdesc.u1.lPitch) = 0xFF;
}
}
else
FIXME("Source size with a depths other than paletted 8 or 32 bits are not yet supported\n");
FIXME("Source size with a depths other than 8 (paletted), 24 or 32 bits are not yet supported\n");
}
else
FIXME("Destination depths with a depth other than 24 or 32 bits are not yet supported\n");
@ -403,14 +404,18 @@ static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID r
static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
{
VideoRendererImpl *This = (VideoRendererImpl *)iface;
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
{
VideoRendererImpl *This = (VideoRendererImpl *)iface;
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
if (!InterlockedDecrement(&This->refCount))
{
DeleteCriticalSection(&This->csFilter);