amstream: Get rid of some casts by using proper iface types.

This commit is contained in:
Nikolay Sivov 2015-06-20 23:34:58 +03:00 committed by Alexandre Julliard
parent 1e97a2db17
commit 5b24854680
6 changed files with 26 additions and 33 deletions

View File

@ -27,7 +27,6 @@
#include "wingdi.h"
#include "amstream_private.h"
#include "amstream.h"
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
@ -37,10 +36,10 @@ typedef struct {
IGraphBuilder* pFilterGraph;
IMediaSeeking* media_seeking;
IMediaControl* media_control;
IBaseFilter* media_stream_filter;
IMediaStreamFilter *media_stream_filter;
IPin* ipin;
ULONG nbStreams;
IMediaStream** pStreams;
IAMMediaStream **pStreams;
STREAM_TYPE StreamType;
OAEVENT event;
} IAMMultiMediaStreamImpl;
@ -114,11 +113,11 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
if (!ref)
{
for(i = 0; i < This->nbStreams; i++)
IMediaStream_Release(This->pStreams[i]);
IAMMediaStream_Release(This->pStreams[i]);
if (This->ipin)
IPin_Release(This->ipin);
if (This->media_stream_filter)
IBaseFilter_Release(This->media_stream_filter);
IMediaStreamFilter_Release(This->media_stream_filter);
if (This->media_seeking)
IMediaSeeking_Release(This->media_seeking);
if (This->media_control)
@ -151,10 +150,10 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream
for (i = 0; i < This->nbStreams; i++)
{
IMediaStream_GetInformation(This->pStreams[i], &PurposeId, NULL);
IAMMediaStream_GetInformation(This->pStreams[i], &PurposeId, NULL);
if (IsEqualIID(&PurposeId, idPurpose))
{
*ppMediaStream = This->pStreams[i];
*ppMediaStream = (IMediaStream*)This->pStreams[i];
IMediaStream_AddRef(*ppMediaStream);
return S_OK;
}
@ -258,9 +257,9 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
if (SUCCEEDED(hr))
hr = IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IMediaControl, (void**)&This->media_control);
if (SUCCEEDED(hr))
hr = CoCreateInstance(&CLSID_MediaStreamFilter, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&This->media_stream_filter);
hr = CoCreateInstance(&CLSID_MediaStreamFilter, NULL, CLSCTX_INPROC_SERVER, &IID_IMediaStreamFilter, (void**)&This->media_stream_filter);
if (SUCCEEDED(hr))
hr = IGraphBuilder_AddFilter(This->pFilterGraph, This->media_stream_filter, filternameW);
hr = IGraphBuilder_AddFilter(This->pFilterGraph, (IBaseFilter*)This->media_stream_filter, filternameW);
if (SUCCEEDED(hr))
{
IMediaEventEx* media_event = NULL;
@ -277,7 +276,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
if (FAILED(hr))
{
if (This->media_stream_filter)
IBaseFilter_Release(This->media_stream_filter);
IMediaStreamFilter_Release(This->media_stream_filter);
This->media_stream_filter = NULL;
if (This->media_seeking)
IMediaSeeking_Release(This->media_seeking);
@ -313,19 +312,17 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
{
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr = S_OK;
TRACE("(%p/%p)->(%p)\n", This, iface, ppFilter);
if (!ppFilter)
return E_POINTER;
*ppFilter = NULL;
*ppFilter = This->media_stream_filter;
if (*ppFilter)
IMediaStreamFilter_AddRef(*ppFilter);
if (This->media_stream_filter)
hr = IBaseFilter_QueryInterface(This->media_stream_filter, &IID_IMediaStreamFilter, (LPVOID*)ppFilter);
return hr;
return S_OK;
}
static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* stream_object, const MSPID* PurposeId,
@ -333,8 +330,8 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
{
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr;
IMediaStream* pStream;
IMediaStream** pNewStreams;
IAMMediaStream* pStream;
IAMMediaStream** pNewStreams;
TRACE("(%p/%p)->(%p,%s,%x,%p)\n", This, iface, stream_object, debugstr_guid(PurposeId), dwFlags, ppNewStream);
@ -374,10 +371,10 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
if (SUCCEEDED(hr))
{
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*));
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IAMMediaStream*));
if (!pNewStreams)
{
IMediaStream_Release(pStream);
IAMMediaStream_Release(pStream);
return E_OUTOFMEMORY;
}
This->pStreams = pNewStreams;
@ -385,13 +382,13 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
This->nbStreams++;
if (ppNewStream)
*ppNewStream = pStream;
*ppNewStream = (IMediaStream*)pStream;
}
if (SUCCEEDED(hr))
{
/* Add stream to the media stream filter */
IMediaStreamFilter_AddMediaStream((IMediaStreamFilter*)This->media_stream_filter, (IAMMediaStream*)pStream);
IMediaStreamFilter_AddMediaStream(This->media_stream_filter, pStream);
}
return hr;

View File

@ -31,13 +31,14 @@
#include "dshow.h"
#include "mmstream.h"
#include "austream.h"
#include "amstream.h"
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
STREAM_TYPE StreamType, IMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
STREAM_TYPE StreamType, IAMMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
STREAM_TYPE stream_type, IMediaStream **media_stream) DECLSPEC_HIDDEN;
STREAM_TYPE stream_type, IAMMediaStream **media_stream) DECLSPEC_HIDDEN;
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */

View File

@ -25,8 +25,6 @@
#include "winbase.h"
#include "amstream_private.h"
#include "amstream.h"
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct {

View File

@ -32,7 +32,6 @@
#include "rpcproxy.h"
#include "amstream_private.h"
#include "amstream.h"
#include "wine/debug.h"

View File

@ -26,7 +26,6 @@
#include "wingdi.h"
#include "amstream_private.h"
#include "amstream.h"
#include "ddstream.h"
@ -428,7 +427,7 @@ static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirect
};
HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
STREAM_TYPE stream_type, IMediaStream **media_stream)
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
{
DirectDrawMediaStreamImpl *object;
@ -446,7 +445,7 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
object->purpose_id = *purpose_id;
object->stream_type = stream_type;
*media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
*media_stream = &object->IAMMediaStream_iface;
return S_OK;
}
@ -828,7 +827,7 @@ static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream
};
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
STREAM_TYPE stream_type, IMediaStream **media_stream)
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
{
AudioMediaStreamImpl *object;
@ -846,7 +845,7 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
object->purpose_id = *purpose_id;
object->stream_type = stream_type;
*media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
*media_stream = &object->IAMMediaStream_iface;
return S_OK;
}

View File

@ -29,7 +29,6 @@
#include "wine/strmbase.h"
#include "amstream_private.h"
#include "amstream.h"
#include "ddstream.h"