Commit 5b248546 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 1e97a2db
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "wingdi.h" #include "wingdi.h"
#include "amstream_private.h" #include "amstream_private.h"
#include "amstream.h"
WINE_DEFAULT_DEBUG_CHANNEL(amstream); WINE_DEFAULT_DEBUG_CHANNEL(amstream);
...@@ -37,10 +36,10 @@ typedef struct { ...@@ -37,10 +36,10 @@ typedef struct {
IGraphBuilder* pFilterGraph; IGraphBuilder* pFilterGraph;
IMediaSeeking* media_seeking; IMediaSeeking* media_seeking;
IMediaControl* media_control; IMediaControl* media_control;
IBaseFilter* media_stream_filter; IMediaStreamFilter *media_stream_filter;
IPin* ipin; IPin* ipin;
ULONG nbStreams; ULONG nbStreams;
IMediaStream** pStreams; IAMMediaStream **pStreams;
STREAM_TYPE StreamType; STREAM_TYPE StreamType;
OAEVENT event; OAEVENT event;
} IAMMultiMediaStreamImpl; } IAMMultiMediaStreamImpl;
...@@ -114,11 +113,11 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface) ...@@ -114,11 +113,11 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
if (!ref) if (!ref)
{ {
for(i = 0; i < This->nbStreams; i++) for(i = 0; i < This->nbStreams; i++)
IMediaStream_Release(This->pStreams[i]); IAMMediaStream_Release(This->pStreams[i]);
if (This->ipin) if (This->ipin)
IPin_Release(This->ipin); IPin_Release(This->ipin);
if (This->media_stream_filter) if (This->media_stream_filter)
IBaseFilter_Release(This->media_stream_filter); IMediaStreamFilter_Release(This->media_stream_filter);
if (This->media_seeking) if (This->media_seeking)
IMediaSeeking_Release(This->media_seeking); IMediaSeeking_Release(This->media_seeking);
if (This->media_control) if (This->media_control)
...@@ -151,10 +150,10 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream ...@@ -151,10 +150,10 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream
for (i = 0; i < This->nbStreams; i++) 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)) if (IsEqualIID(&PurposeId, idPurpose))
{ {
*ppMediaStream = This->pStreams[i]; *ppMediaStream = (IMediaStream*)This->pStreams[i];
IMediaStream_AddRef(*ppMediaStream); IMediaStream_AddRef(*ppMediaStream);
return S_OK; return S_OK;
} }
...@@ -258,9 +257,9 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if ...@@ -258,9 +257,9 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IMediaControl, (void**)&This->media_control); hr = IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IMediaControl, (void**)&This->media_control);
if (SUCCEEDED(hr)) 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)) 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)) if (SUCCEEDED(hr))
{ {
IMediaEventEx* media_event = NULL; IMediaEventEx* media_event = NULL;
...@@ -277,7 +276,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if ...@@ -277,7 +276,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
if (FAILED(hr)) if (FAILED(hr))
{ {
if (This->media_stream_filter) if (This->media_stream_filter)
IBaseFilter_Release(This->media_stream_filter); IMediaStreamFilter_Release(This->media_stream_filter);
This->media_stream_filter = NULL; This->media_stream_filter = NULL;
if (This->media_seeking) if (This->media_seeking)
IMediaSeeking_Release(This->media_seeking); IMediaSeeking_Release(This->media_seeking);
...@@ -313,19 +312,17 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream ...@@ -313,19 +312,17 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter) static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
{ {
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr = S_OK;
TRACE("(%p/%p)->(%p)\n", This, iface, ppFilter); TRACE("(%p/%p)->(%p)\n", This, iface, ppFilter);
if (!ppFilter) if (!ppFilter)
return E_POINTER; return E_POINTER;
*ppFilter = NULL; *ppFilter = This->media_stream_filter;
if (*ppFilter)
if (This->media_stream_filter) IMediaStreamFilter_AddRef(*ppFilter);
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, static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* stream_object, const MSPID* PurposeId,
...@@ -333,8 +330,8 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream ...@@ -333,8 +330,8 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
{ {
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface); IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
HRESULT hr; HRESULT hr;
IMediaStream* pStream; IAMMediaStream* pStream;
IMediaStream** pNewStreams; IAMMediaStream** pNewStreams;
TRACE("(%p/%p)->(%p,%s,%x,%p)\n", This, iface, stream_object, debugstr_guid(PurposeId), dwFlags, ppNewStream); 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 ...@@ -374,10 +371,10 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream); hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*)); pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IAMMediaStream*));
if (!pNewStreams) if (!pNewStreams)
{ {
IMediaStream_Release(pStream); IAMMediaStream_Release(pStream);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
This->pStreams = pNewStreams; This->pStreams = pNewStreams;
...@@ -385,13 +382,13 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream ...@@ -385,13 +382,13 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
This->nbStreams++; This->nbStreams++;
if (ppNewStream) if (ppNewStream)
*ppNewStream = pStream; *ppNewStream = (IMediaStream*)pStream;
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
/* Add stream to the media stream filter */ /* 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; return hr;
......
...@@ -31,13 +31,14 @@ ...@@ -31,13 +31,14 @@
#include "dshow.h" #include "dshow.h"
#include "mmstream.h" #include "mmstream.h"
#include "austream.h" #include "austream.h"
#include "amstream.h"
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT AMAudioData_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 MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId, 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, 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__ */ #endif /* __AMSTREAM_PRIVATE_INCLUDED__ */
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include "winbase.h" #include "winbase.h"
#include "amstream_private.h" #include "amstream_private.h"
#include "amstream.h"
WINE_DEFAULT_DEBUG_CHANNEL(amstream); WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct { typedef struct {
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "rpcproxy.h" #include "rpcproxy.h"
#include "amstream_private.h" #include "amstream_private.h"
#include "amstream.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "wingdi.h" #include "wingdi.h"
#include "amstream_private.h" #include "amstream_private.h"
#include "amstream.h"
#include "ddstream.h" #include "ddstream.h"
...@@ -428,7 +427,7 @@ static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirect ...@@ -428,7 +427,7 @@ static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirect
}; };
HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, 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; DirectDrawMediaStreamImpl *object;
...@@ -446,7 +445,7 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ ...@@ -446,7 +445,7 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
object->purpose_id = *purpose_id; object->purpose_id = *purpose_id;
object->stream_type = stream_type; object->stream_type = stream_type;
*media_stream = (IMediaStream*)&object->IAMMediaStream_iface; *media_stream = &object->IAMMediaStream_iface;
return S_OK; return S_OK;
} }
...@@ -828,7 +827,7 @@ static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream ...@@ -828,7 +827,7 @@ static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream
}; };
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, 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; AudioMediaStreamImpl *object;
...@@ -846,7 +845,7 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ ...@@ -846,7 +845,7 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
object->purpose_id = *purpose_id; object->purpose_id = *purpose_id;
object->stream_type = stream_type; object->stream_type = stream_type;
*media_stream = (IMediaStream*)&object->IAMMediaStream_iface; *media_stream = &object->IAMMediaStream_iface;
return S_OK; return S_OK;
} }
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "wine/strmbase.h" #include "wine/strmbase.h"
#include "amstream_private.h" #include "amstream_private.h"
#include "amstream.h"
#include "ddstream.h" #include "ddstream.h"
......
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