mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[AMSTREAM] Sync with Wine Staging 3.3. CORE-14434
This commit is contained in:
parent
fbbe3b3856
commit
7401c74a40
9 changed files with 454 additions and 204 deletions
|
@ -10,7 +10,7 @@ list(APPEND SOURCE
|
|||
main.c
|
||||
mediastream.c
|
||||
mediastreamfilter.c
|
||||
amstream_private.h)
|
||||
precomp.h)
|
||||
|
||||
add_library(amstream SHARED
|
||||
${SOURCE}
|
||||
|
@ -20,5 +20,5 @@ add_library(amstream SHARED
|
|||
set_module_type(amstream win32dll)
|
||||
target_link_libraries(amstream strmbase strmiids uuid wine)
|
||||
add_importlibs(amstream ole32 ddraw user32 msvcrt kernel32 ntdll)
|
||||
add_pch(amstream amstream_private.h SOURCE)
|
||||
add_pch(amstream precomp.h SOURCE)
|
||||
add_cd_file(TARGET amstream DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -19,8 +19,17 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
|
||||
#include "amstream_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||
|
||||
typedef struct {
|
||||
IAMMultiMediaStream IAMMultiMediaStream_iface;
|
||||
LONG ref;
|
||||
|
|
|
@ -21,15 +21,17 @@
|
|||
#ifndef __AMSTREAM_PRIVATE_INCLUDED__
|
||||
#define __AMSTREAM_PRIVATE_INCLUDED__
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define COBJMACROS
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <dshow.h>
|
||||
#include <amstream.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wtypes.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#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;
|
||||
|
|
|
@ -18,8 +18,15 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "winbase.h"
|
||||
#include "amstream_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||
|
||||
typedef struct {
|
||||
IAudioData IAudioData_iface;
|
||||
LONG ref;
|
||||
|
|
|
@ -18,9 +18,24 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "amstream_private.h"
|
||||
|
||||
#include <rpcproxy.h>
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||
|
||||
static HINSTANCE instance;
|
||||
|
||||
|
|
|
@ -18,8 +18,27 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __REACTOS__
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
#endif
|
||||
#define COBJMACROS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "dshow.h"
|
||||
|
||||
#include "wine/strmbase.h"
|
||||
|
||||
#include "amstream_private.h"
|
||||
|
||||
#include "ddstream.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||
|
||||
#include <initguid.h>
|
||||
DEFINE_GUID(IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b);
|
||||
|
||||
|
@ -27,7 +46,14 @@ static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectD
|
|||
const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample);
|
||||
static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample);
|
||||
|
||||
struct DirectDrawMediaStreamImpl;
|
||||
|
||||
typedef struct {
|
||||
BaseInputPin pin;
|
||||
struct DirectDrawMediaStreamImpl *parent;
|
||||
} DirectDrawMediaStreamInputPin;
|
||||
|
||||
typedef struct DirectDrawMediaStreamImpl {
|
||||
IAMMediaStream IAMMediaStream_iface;
|
||||
IDirectDrawMediaStream IDirectDrawMediaStream_iface;
|
||||
LONG ref;
|
||||
|
@ -35,6 +61,8 @@ typedef struct {
|
|||
MSPID purpose_id;
|
||||
STREAM_TYPE stream_type;
|
||||
IDirectDraw7 *ddraw;
|
||||
DirectDrawMediaStreamInputPin *input_pin;
|
||||
CRITICAL_SECTION critical_section;
|
||||
} DirectDrawMediaStreamImpl;
|
||||
|
||||
static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface)
|
||||
|
@ -64,6 +92,18 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IA
|
|||
*ret_iface = &This->IDirectDrawMediaStream_iface;
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(riid, &IID_IPin))
|
||||
{
|
||||
IAMMediaStream_AddRef(iface);
|
||||
*ret_iface = &This->input_pin->pin.pin.IPin_iface;
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(riid, &IID_IMemInputPin))
|
||||
{
|
||||
IAMMediaStream_AddRef(iface);
|
||||
*ret_iface = &This->input_pin->pin.IMemInputPin_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
|
||||
return E_NOINTERFACE;
|
||||
|
@ -88,6 +128,8 @@ static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStr
|
|||
|
||||
if (!ref)
|
||||
{
|
||||
BaseInputPin_Destroy((BaseInputPin *)This->input_pin);
|
||||
DeleteCriticalSection(&This->critical_section);
|
||||
if (This->ddraw)
|
||||
IDirectDraw7_Release(This->ddraw);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
|
@ -200,9 +242,11 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMed
|
|||
{
|
||||
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
|
||||
TRACE("(%p/%p)->(%p)\n", This, iface, media_stream_filter);
|
||||
|
||||
return S_FALSE;
|
||||
This->input_pin->pin.pin.pinInfo.pFilter = (IBaseFilter *)media_stream_filter;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
|
||||
|
@ -421,10 +465,151 @@ static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirect
|
|||
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame
|
||||
};
|
||||
|
||||
static inline DirectDrawMediaStreamInputPin *impl_from_DirectDrawMediaStreamInputPin_IPin(IPin *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, DirectDrawMediaStreamInputPin, pin.pin.IPin_iface);
|
||||
}
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
static HRESULT WINAPI DirectDrawMediaStreamInputPin_IPin_QueryInterface(IPin *iface, REFIID riid, void **ret_iface)
|
||||
{
|
||||
DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface);
|
||||
|
||||
return IAMMediaStream_QueryInterface(&This->parent->IAMMediaStream_iface, riid, ret_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_AddRef(IPin *iface)
|
||||
{
|
||||
DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface);
|
||||
|
||||
return IAMMediaStream_AddRef(&This->parent->IAMMediaStream_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_Release(IPin *iface)
|
||||
{
|
||||
DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface);
|
||||
|
||||
return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface);
|
||||
}
|
||||
|
||||
static const IPinVtbl DirectDrawMediaStreamInputPin_IPin_Vtbl =
|
||||
{
|
||||
DirectDrawMediaStreamInputPin_IPin_QueryInterface,
|
||||
DirectDrawMediaStreamInputPin_IPin_AddRef,
|
||||
DirectDrawMediaStreamInputPin_IPin_Release,
|
||||
BaseInputPinImpl_Connect,
|
||||
BaseInputPinImpl_ReceiveConnection,
|
||||
BasePinImpl_Disconnect,
|
||||
BasePinImpl_ConnectedTo,
|
||||
BasePinImpl_ConnectionMediaType,
|
||||
BasePinImpl_QueryPinInfo,
|
||||
BasePinImpl_QueryDirection,
|
||||
BasePinImpl_QueryId,
|
||||
BaseInputPinImpl_QueryAccept,
|
||||
BasePinImpl_EnumMediaTypes,
|
||||
BasePinImpl_QueryInternalConnections,
|
||||
BaseInputPinImpl_EndOfStream,
|
||||
BaseInputPinImpl_BeginFlush,
|
||||
BaseInputPinImpl_EndFlush,
|
||||
BaseInputPinImpl_NewSegment,
|
||||
};
|
||||
|
||||
static HRESULT WINAPI DirectDrawMediaStreamInputPin_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *media_type)
|
||||
{
|
||||
DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, media_type);
|
||||
|
||||
if (IsEqualGUID(&media_type->majortype, &MEDIATYPE_Video))
|
||||
{
|
||||
if (IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB1) ||
|
||||
IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB4) ||
|
||||
IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB8) ||
|
||||
IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB565) ||
|
||||
IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB555) ||
|
||||
IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB24) ||
|
||||
IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB32))
|
||||
{
|
||||
TRACE("Video sub-type %s matches\n", debugstr_guid(&media_type->subtype));
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static LONG WINAPI DirectDrawMediaStreamInputPin_GetMediaTypeVersion(BasePin *base)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DirectDrawMediaStreamInputPin_GetMediaType(BasePin *base, int index, AM_MEDIA_TYPE *media_type)
|
||||
{
|
||||
DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface);
|
||||
|
||||
TRACE("(%p)->(%d,%p)\n", This, index, media_type);
|
||||
|
||||
/* FIXME: Reset structure as we only fill majortype and minortype for now */
|
||||
ZeroMemory(media_type, sizeof(*media_type));
|
||||
|
||||
media_type->majortype = MEDIATYPE_Video;
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
media_type->subtype = MEDIASUBTYPE_RGB1;
|
||||
break;
|
||||
case 1:
|
||||
media_type->subtype = MEDIASUBTYPE_RGB4;
|
||||
break;
|
||||
case 2:
|
||||
media_type->subtype = MEDIASUBTYPE_RGB8;
|
||||
break;
|
||||
case 3:
|
||||
media_type->subtype = MEDIASUBTYPE_RGB565;
|
||||
break;
|
||||
case 4:
|
||||
media_type->subtype = MEDIASUBTYPE_RGB555;
|
||||
break;
|
||||
case 5:
|
||||
media_type->subtype = MEDIASUBTYPE_RGB24;
|
||||
break;
|
||||
case 6:
|
||||
media_type->subtype = MEDIASUBTYPE_RGB32;
|
||||
break;
|
||||
default:
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DirectDrawMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample)
|
||||
{
|
||||
DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->pin.IPin_iface);
|
||||
|
||||
FIXME("(%p)->(%p) stub!\n", This, sample);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const BaseInputPinFuncTable DirectDrawMediaStreamInputPin_FuncTable =
|
||||
{
|
||||
{
|
||||
DirectDrawMediaStreamInputPin_CheckMediaType,
|
||||
NULL,
|
||||
DirectDrawMediaStreamInputPin_GetMediaTypeVersion,
|
||||
DirectDrawMediaStreamInputPin_GetMediaType,
|
||||
},
|
||||
DirectDrawMediaStreamInputPin_Receive,
|
||||
};
|
||||
|
||||
HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
|
||||
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
|
||||
{
|
||||
DirectDrawMediaStreamImpl *object;
|
||||
PIN_INFO pin_info;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
|
||||
|
||||
|
@ -436,6 +621,20 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
|
|||
object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl;
|
||||
object->ref = 1;
|
||||
|
||||
InitializeCriticalSection(&object->critical_section);
|
||||
|
||||
pin_info.pFilter = NULL;
|
||||
pin_info.dir = PINDIR_INPUT;
|
||||
pin_info.achName[0] = 'I';
|
||||
StringFromGUID2(purpose_id, pin_info.achName + 1, MAX_PIN_NAME - 1);
|
||||
hr = BaseInputPin_Construct(&DirectDrawMediaStreamInputPin_IPin_Vtbl,
|
||||
sizeof(DirectDrawMediaStreamInputPin), &pin_info, &DirectDrawMediaStreamInputPin_FuncTable,
|
||||
&object->critical_section, NULL, (IPin **)&object->input_pin);
|
||||
if (FAILED(hr))
|
||||
goto out_object;
|
||||
|
||||
object->input_pin->parent = object;
|
||||
|
||||
object->parent = parent;
|
||||
object->purpose_id = *purpose_id;
|
||||
object->stream_type = stream_type;
|
||||
|
@ -443,15 +642,29 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
|
|||
*media_stream = &object->IAMMediaStream_iface;
|
||||
|
||||
return S_OK;
|
||||
|
||||
out_object:
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
struct AudioMediaStreamImpl;
|
||||
|
||||
typedef struct {
|
||||
BaseInputPin pin;
|
||||
struct AudioMediaStreamImpl *parent;
|
||||
} AudioMediaStreamInputPin;
|
||||
|
||||
typedef struct AudioMediaStreamImpl {
|
||||
IAMMediaStream IAMMediaStream_iface;
|
||||
IAudioMediaStream IAudioMediaStream_iface;
|
||||
LONG ref;
|
||||
IMultiMediaStream* parent;
|
||||
MSPID purpose_id;
|
||||
STREAM_TYPE stream_type;
|
||||
AudioMediaStreamInputPin *input_pin;
|
||||
CRITICAL_SECTION critical_section;
|
||||
} AudioMediaStreamImpl;
|
||||
|
||||
static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface)
|
||||
|
@ -481,6 +694,18 @@ static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMedi
|
|||
*ret_iface = &This->IAudioMediaStream_iface;
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(riid, &IID_IPin))
|
||||
{
|
||||
IAMMediaStream_AddRef(iface);
|
||||
*ret_iface = &This->input_pin->pin.pin.IPin_iface;
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualGUID(riid, &IID_IMemInputPin))
|
||||
{
|
||||
IAMMediaStream_AddRef(iface);
|
||||
*ret_iface = &This->input_pin->pin.IMemInputPin_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
|
||||
return E_NOINTERFACE;
|
||||
|
@ -504,7 +729,11 @@ static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *
|
|||
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
BaseInputPin_Destroy((BaseInputPin *)This->input_pin);
|
||||
DeleteCriticalSection(&This->critical_section);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -613,9 +842,11 @@ static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStr
|
|||
{
|
||||
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
|
||||
TRACE("(%p/%p)->(%p)\n", This, iface, media_stream_filter);
|
||||
|
||||
return S_FALSE;
|
||||
This->input_pin->pin.pin.pinInfo.pFilter = (IBaseFilter *)media_stream_filter;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
|
||||
|
@ -803,10 +1034,122 @@ static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream
|
|||
AudioMediaStreamImpl_IAudioMediaStream_CreateSample
|
||||
};
|
||||
|
||||
static inline AudioMediaStreamInputPin *impl_from_AudioMediaStreamInputPin_IPin(IPin *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, AudioMediaStreamInputPin, pin.pin.IPin_iface);
|
||||
}
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
static HRESULT WINAPI AudioMediaStreamInputPin_IPin_QueryInterface(IPin *iface, REFIID riid, void **ret_iface)
|
||||
{
|
||||
AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface);
|
||||
|
||||
return IAMMediaStream_QueryInterface(&This->parent->IAMMediaStream_iface, riid, ret_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI AudioMediaStreamInputPin_IPin_AddRef(IPin *iface)
|
||||
{
|
||||
AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface);
|
||||
|
||||
return IAMMediaStream_AddRef(&This->parent->IAMMediaStream_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI AudioMediaStreamInputPin_IPin_Release(IPin *iface)
|
||||
{
|
||||
AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface);
|
||||
|
||||
return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface);
|
||||
}
|
||||
|
||||
static const IPinVtbl AudioMediaStreamInputPin_IPin_Vtbl =
|
||||
{
|
||||
AudioMediaStreamInputPin_IPin_QueryInterface,
|
||||
AudioMediaStreamInputPin_IPin_AddRef,
|
||||
AudioMediaStreamInputPin_IPin_Release,
|
||||
BaseInputPinImpl_Connect,
|
||||
BaseInputPinImpl_ReceiveConnection,
|
||||
BasePinImpl_Disconnect,
|
||||
BasePinImpl_ConnectedTo,
|
||||
BasePinImpl_ConnectionMediaType,
|
||||
BasePinImpl_QueryPinInfo,
|
||||
BasePinImpl_QueryDirection,
|
||||
BasePinImpl_QueryId,
|
||||
BaseInputPinImpl_QueryAccept,
|
||||
BasePinImpl_EnumMediaTypes,
|
||||
BasePinImpl_QueryInternalConnections,
|
||||
BaseInputPinImpl_EndOfStream,
|
||||
BaseInputPinImpl_BeginFlush,
|
||||
BaseInputPinImpl_EndFlush,
|
||||
BaseInputPinImpl_NewSegment,
|
||||
};
|
||||
|
||||
static HRESULT WINAPI AudioMediaStreamInputPin_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *media_type)
|
||||
{
|
||||
AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, media_type);
|
||||
|
||||
if (IsEqualGUID(&media_type->majortype, &MEDIATYPE_Audio))
|
||||
{
|
||||
if (IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_PCM))
|
||||
{
|
||||
TRACE("Audio sub-type %s matches\n", debugstr_guid(&media_type->subtype));
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static LONG WINAPI AudioMediaStreamInputPin_GetMediaTypeVersion(BasePin *base)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioMediaStreamInputPin_GetMediaType(BasePin *base, int index, AM_MEDIA_TYPE *media_type)
|
||||
{
|
||||
AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface);
|
||||
|
||||
TRACE("(%p)->(%d,%p)\n", This, index, media_type);
|
||||
|
||||
/* FIXME: Reset structure as we only fill majortype and minortype for now */
|
||||
ZeroMemory(media_type, sizeof(*media_type));
|
||||
|
||||
if (index)
|
||||
return S_FALSE;
|
||||
|
||||
media_type->majortype = MEDIATYPE_Audio;
|
||||
media_type->subtype = MEDIASUBTYPE_PCM;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample)
|
||||
{
|
||||
AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->pin.IPin_iface);
|
||||
|
||||
FIXME("(%p)->(%p) stub!\n", This, sample);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const BaseInputPinFuncTable AudioMediaStreamInputPin_FuncTable =
|
||||
{
|
||||
{
|
||||
AudioMediaStreamInputPin_CheckMediaType,
|
||||
NULL,
|
||||
AudioMediaStreamInputPin_GetMediaTypeVersion,
|
||||
AudioMediaStreamInputPin_GetMediaType,
|
||||
},
|
||||
AudioMediaStreamInputPin_Receive,
|
||||
};
|
||||
|
||||
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
|
||||
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
|
||||
{
|
||||
AudioMediaStreamImpl *object;
|
||||
PIN_INFO pin_info;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
|
||||
|
||||
|
@ -818,6 +1161,20 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
|
|||
object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl;
|
||||
object->ref = 1;
|
||||
|
||||
InitializeCriticalSection(&object->critical_section);
|
||||
|
||||
pin_info.pFilter = NULL;
|
||||
pin_info.dir = PINDIR_INPUT;
|
||||
pin_info.achName[0] = 'I';
|
||||
StringFromGUID2(purpose_id, pin_info.achName + 1, MAX_PIN_NAME - 1);
|
||||
hr = BaseInputPin_Construct(&AudioMediaStreamInputPin_IPin_Vtbl,
|
||||
sizeof(AudioMediaStreamInputPin), &pin_info, &AudioMediaStreamInputPin_FuncTable,
|
||||
&object->critical_section, NULL, (IPin **)&object->input_pin);
|
||||
if (FAILED(hr))
|
||||
goto out_object;
|
||||
|
||||
object->input_pin->parent = object;
|
||||
|
||||
object->parent = parent;
|
||||
object->purpose_id = *purpose_id;
|
||||
object->stream_type = stream_type;
|
||||
|
@ -825,6 +1182,11 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
|
|||
*media_stream = &object->IAMMediaStream_iface;
|
||||
|
||||
return S_OK;
|
||||
|
||||
out_object:
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -918,7 +1280,7 @@ static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample
|
|||
{
|
||||
FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
|
||||
|
||||
return E_NOTIMPL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds)
|
||||
|
|
|
@ -18,176 +18,33 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "dshow.h"
|
||||
|
||||
#include "wine/strmbase.h"
|
||||
|
||||
#include "amstream_private.h"
|
||||
|
||||
#include <wine/strmbase.h>
|
||||
#include "ddstream.h"
|
||||
|
||||
typedef struct MediaStreamFilter_InputPin
|
||||
{
|
||||
BaseInputPin pin;
|
||||
} MediaStreamFilter_InputPin;
|
||||
|
||||
static const IPinVtbl MediaStreamFilter_InputPin_Vtbl =
|
||||
{
|
||||
BaseInputPinImpl_QueryInterface,
|
||||
BasePinImpl_AddRef,
|
||||
BaseInputPinImpl_Release,
|
||||
BaseInputPinImpl_Connect,
|
||||
BaseInputPinImpl_ReceiveConnection,
|
||||
BasePinImpl_Disconnect,
|
||||
BasePinImpl_ConnectedTo,
|
||||
BasePinImpl_ConnectionMediaType,
|
||||
BasePinImpl_QueryPinInfo,
|
||||
BasePinImpl_QueryDirection,
|
||||
BasePinImpl_QueryId,
|
||||
BasePinImpl_QueryAccept,
|
||||
BasePinImpl_EnumMediaTypes,
|
||||
BasePinImpl_QueryInternalConnections,
|
||||
BaseInputPinImpl_EndOfStream,
|
||||
BaseInputPinImpl_BeginFlush,
|
||||
BaseInputPinImpl_EndFlush,
|
||||
BasePinImpl_NewSegment
|
||||
};
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||
|
||||
typedef struct {
|
||||
BaseFilter filter;
|
||||
ULONG nb_streams;
|
||||
IMediaStream** streams;
|
||||
IPin** pins;
|
||||
IAMMediaStream** streams;
|
||||
} IMediaStreamFilterImpl;
|
||||
|
||||
static inline IMediaStreamFilterImpl *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IMediaStreamFilterImpl, filter);
|
||||
return CONTAINING_RECORD((IBaseFilter *)iface, IMediaStreamFilterImpl, filter.IBaseFilter_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BasePinImpl_CheckMediaType(BasePin *This, const AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
IMediaStreamFilterImpl *filter = impl_from_IMediaStreamFilter((IMediaStreamFilter*)This->pinInfo.pFilter);
|
||||
MSPID purpose_id;
|
||||
ULONG i;
|
||||
|
||||
TRACE("Checking media type %s - %s\n", debugstr_guid(&pmt->majortype), debugstr_guid(&pmt->subtype));
|
||||
|
||||
/* Find which stream is associated with the pin */
|
||||
for (i = 0; i < filter->nb_streams; i++)
|
||||
if (&This->IPin_iface == filter->pins[i])
|
||||
break;
|
||||
|
||||
if (i == filter->nb_streams)
|
||||
return S_FALSE;
|
||||
|
||||
if (FAILED(IMediaStream_GetInformation(filter->streams[i], &purpose_id, NULL)))
|
||||
return S_FALSE;
|
||||
|
||||
TRACE("Checking stream with purpose id %s\n", debugstr_guid(&purpose_id));
|
||||
|
||||
if (IsEqualGUID(&purpose_id, &MSPID_PrimaryVideo) && IsEqualGUID(&pmt->majortype, &MEDIATYPE_Video))
|
||||
{
|
||||
if (IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB1) ||
|
||||
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB4) ||
|
||||
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB8) ||
|
||||
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
|
||||
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB555) ||
|
||||
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
|
||||
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB32))
|
||||
{
|
||||
TRACE("Video sub-type %s matches\n", debugstr_guid(&pmt->subtype));
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else if (IsEqualGUID(&purpose_id, &MSPID_PrimaryAudio) && IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio))
|
||||
{
|
||||
if (IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_PCM))
|
||||
{
|
||||
TRACE("Audio sub-type %s matches\n", debugstr_guid(&pmt->subtype));
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static LONG WINAPI BasePinImp_GetMediaTypeVersion(BasePin *This)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BasePinImp_GetMediaType(BasePin *This, int index, AM_MEDIA_TYPE *amt)
|
||||
{
|
||||
IMediaStreamFilterImpl *filter = (IMediaStreamFilterImpl*)This->pinInfo.pFilter;
|
||||
MSPID purpose_id;
|
||||
ULONG i;
|
||||
|
||||
/* FIXME: Reset structure as we only fill majortype and minortype for now */
|
||||
ZeroMemory(amt, sizeof(*amt));
|
||||
|
||||
/* Find which stream is associated with the pin */
|
||||
for (i = 0; i < filter->nb_streams; i++)
|
||||
if (&This->IPin_iface == filter->pins[i])
|
||||
break;
|
||||
|
||||
if (i == filter->nb_streams)
|
||||
return S_FALSE;
|
||||
|
||||
if (FAILED(IMediaStream_GetInformation(filter->streams[i], &purpose_id, NULL)))
|
||||
return S_FALSE;
|
||||
|
||||
TRACE("Processing stream with purpose id %s\n", debugstr_guid(&purpose_id));
|
||||
|
||||
if (IsEqualGUID(&purpose_id, &MSPID_PrimaryVideo))
|
||||
{
|
||||
amt->majortype = MEDIATYPE_Video;
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
amt->subtype = MEDIASUBTYPE_RGB1;
|
||||
break;
|
||||
case 1:
|
||||
amt->subtype = MEDIASUBTYPE_RGB4;
|
||||
break;
|
||||
case 2:
|
||||
amt->subtype = MEDIASUBTYPE_RGB8;
|
||||
break;
|
||||
case 3:
|
||||
amt->subtype = MEDIASUBTYPE_RGB565;
|
||||
break;
|
||||
case 4:
|
||||
amt->subtype = MEDIASUBTYPE_RGB555;
|
||||
break;
|
||||
case 5:
|
||||
amt->subtype = MEDIASUBTYPE_RGB24;
|
||||
break;
|
||||
case 6:
|
||||
amt->subtype = MEDIASUBTYPE_RGB32;
|
||||
break;
|
||||
default:
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
else if (IsEqualGUID(&purpose_id, &MSPID_PrimaryAudio))
|
||||
{
|
||||
if (index)
|
||||
return S_FALSE;
|
||||
|
||||
amt->majortype = MEDIATYPE_Audio;
|
||||
amt->subtype = MEDIASUBTYPE_PCM;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
|
||||
{
|
||||
BasePinImpl_CheckMediaType,
|
||||
NULL,
|
||||
BasePinImp_GetMediaTypeVersion,
|
||||
BasePinImp_GetMediaType
|
||||
},
|
||||
NULL
|
||||
};
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
|
||||
static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *iface, REFIID riid, void **ret_iface)
|
||||
|
@ -234,11 +91,10 @@ static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
|
|||
ULONG i;
|
||||
for (i = 0; i < This->nb_streams; i++)
|
||||
{
|
||||
IMediaStream_Release(This->streams[i]);
|
||||
IPin_Release(This->pins[i]);
|
||||
IAMMediaStream_JoinFilter(This->streams[i], NULL);
|
||||
IAMMediaStream_Release(This->streams[i]);
|
||||
}
|
||||
CoTaskMemFree(This->streams);
|
||||
CoTaskMemFree(This->pins);
|
||||
BaseFilter_Destroy(&This->filter);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
@ -331,39 +187,21 @@ static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter *
|
|||
static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface, IAMMediaStream *pAMMediaStream)
|
||||
{
|
||||
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||
IMediaStream** streams;
|
||||
IPin** pins;
|
||||
MediaStreamFilter_InputPin* pin;
|
||||
IAMMediaStream** streams;
|
||||
HRESULT hr;
|
||||
PIN_INFO info;
|
||||
MSPID purpose_id;
|
||||
|
||||
TRACE("(%p)->(%p)\n", iface, pAMMediaStream);
|
||||
|
||||
streams = CoTaskMemRealloc(This->streams, (This->nb_streams + 1) * sizeof(IMediaStream*));
|
||||
streams = CoTaskMemRealloc(This->streams, (This->nb_streams + 1) * sizeof(IAMMediaStream*));
|
||||
if (!streams)
|
||||
return E_OUTOFMEMORY;
|
||||
This->streams = streams;
|
||||
pins = CoTaskMemRealloc(This->pins, (This->nb_streams + 1) * sizeof(IPin*));
|
||||
if (!pins)
|
||||
return E_OUTOFMEMORY;
|
||||
This->pins = pins;
|
||||
info.pFilter = &This->filter.IBaseFilter_iface;
|
||||
info.dir = PINDIR_INPUT;
|
||||
hr = IAMMediaStream_GetInformation(pAMMediaStream, &purpose_id, NULL);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
/* Pin name is "I{guid MSPID_PrimaryVideo or MSPID_PrimaryAudio}" */
|
||||
info.achName[0] = 'I';
|
||||
StringFromGUID2(&purpose_id, info.achName + 1, 40);
|
||||
hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, sizeof(BaseInputPin), &info,
|
||||
&input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]);
|
||||
|
||||
hr = IAMMediaStream_JoinFilter(pAMMediaStream, iface);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
pin = (MediaStreamFilter_InputPin*)This->pins[This->nb_streams];
|
||||
pin->pin.pin.pinInfo.pFilter = &This->filter.IBaseFilter_iface;
|
||||
This->streams[This->nb_streams] = (IMediaStream*)pAMMediaStream;
|
||||
This->streams[This->nb_streams] = pAMMediaStream;
|
||||
This->nb_streams++;
|
||||
|
||||
IAMMediaStream_AddRef(pAMMediaStream);
|
||||
|
@ -381,10 +219,10 @@ static HRESULT WINAPI MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter* i
|
|||
|
||||
for (i = 0; i < This->nb_streams; i++)
|
||||
{
|
||||
IMediaStream_GetInformation(This->streams[i], &purpose_id, NULL);
|
||||
IAMMediaStream_GetInformation(This->streams[i], &purpose_id, NULL);
|
||||
if (IsEqualIID(&purpose_id, idPurpose))
|
||||
{
|
||||
*ppMediaStream = This->streams[i];
|
||||
*ppMediaStream = (IMediaStream *)This->streams[i];
|
||||
IMediaStream_AddRef(*ppMediaStream);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -476,8 +314,9 @@ static IPin* WINAPI MediaStreamFilterImpl_GetPin(BaseFilter *iface, int pos)
|
|||
|
||||
if (pos < This->nb_streams)
|
||||
{
|
||||
IPin_AddRef(This->pins[pos]);
|
||||
return This->pins[pos];
|
||||
IPin *pin = NULL;
|
||||
IAMMediaStream_QueryInterface(This->streams[pos], &IID_IPin, (void **)&pin);
|
||||
return pin;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
16
dll/directx/wine/amstream/precomp.h
Normal file
16
dll/directx/wine/amstream/precomp.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
#ifndef _AMSTREAM_PRECOMP_H_
|
||||
#define _AMSTREAM_PRECOMP_H_
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "amstream_private.h"
|
||||
|
||||
#include <ddstream.h>
|
||||
#include <wine/strmbase.h>
|
||||
#include <wine/debug.h>
|
||||
|
||||
#endif /* _AMSTREAM_PRECOMP_H_ */
|
|
@ -21,7 +21,7 @@ reactos/sdk/tools/wpp # Synced to WineStaging-2.9
|
|||
|
||||
The following libraries are shared with Wine.
|
||||
|
||||
reactos/dll/directx/wine/amstream # Synced to Wine-3.0
|
||||
reactos/dll/directx/wine/amstream # Synced to WineStaging-3.3
|
||||
reactos/dll/directx/wine/d3d8 # Synced to Wine-3.0
|
||||
reactos/dll/directx/wine/d3d9 # Synced to Wine-3.0
|
||||
reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-3.3
|
||||
|
|
Loading…
Reference in a new issue