Commit 6619ebad authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard

Implemented CLSID_AudioRender.

parent aacac86a
...@@ -10,6 +10,7 @@ SYMBOLFILE = $(MODULE).tmp.o ...@@ -10,6 +10,7 @@ SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \ C_SRCS = \
amundoc.c \ amundoc.c \
audren.c \
basefilt.c \ basefilt.c \
basepin.c \ basepin.c \
complist.c \ complist.c \
......
/*
* Audio Renderer (CLSID_AudioRender)
*
* FIXME
* - implements IRefereneceClock.
*
* hidenori@a2.ctktv.ne.jp
*/
#ifndef WINE_DSHOW_AUDREN_H
#define WINE_DSHOW_AUDREN_H
#include "iunk.h"
#include "basefilt.h"
#define WINE_QUARTZ_WAVEOUT_COUNT 4
typedef struct CAudioRendererImpl CAudioRendererImpl;
typedef struct CAudioRendererPinImpl CAudioRendererPinImpl;
typedef struct AudRen_IBasicAudioImpl
{
ICOM_VFIELD(IBasicAudio);
} AudRen_IBasicAudioImpl;
struct CAudioRendererImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
AudRen_IBasicAudioImpl basaud;
CAudioRendererPinImpl* pPin;
BOOL m_fInFlush;
/* for waveOut */
BOOL m_fWaveOutInit;
HANDLE m_hEventRender;
HWAVEOUT m_hWaveOut;
DWORD m_dwBlockSize;
WAVEHDR* m_phdrCur;
WAVEHDR m_hdr[WINE_QUARTZ_WAVEOUT_COUNT];
};
struct CAudioRendererPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CAudioRendererImpl* pRender;
};
#define CAudioRendererImpl_THIS(iface,member) CAudioRendererImpl* This = ((CAudioRendererImpl*)(((char*)iface)-offsetof(CAudioRendererImpl,member)))
#define CAudioRendererPinImpl_THIS(iface,member) CAudioRendererPinImpl* This = ((CAudioRendererPinImpl*)(((char*)iface)-offsetof(CAudioRendererPinImpl,member)))
HRESULT CAudioRendererImpl_InitIBasicAudio( CAudioRendererImpl* This );
void CAudioRendererImpl_UninitIBasicAudio( CAudioRendererImpl* This );
HRESULT QUARTZ_CreateAudioRenderer(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateAudioRendererPin(
CAudioRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CAudioRendererPinImpl** ppPin);
#endif /* WINE_DSHOW_AUDREN_H */
...@@ -73,54 +73,81 @@ static HRESULT WINAPI ...@@ -73,54 +73,81 @@ static HRESULT WINAPI
CBaseFilterImpl_fnStop(IBaseFilter* iface) CBaseFilterImpl_fnStop(IBaseFilter* iface)
{ {
ICOM_THIS(CBaseFilterImpl,iface); ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr;
TRACE("(%p)->()\n",This); TRACE("(%p)->()\n",This);
hr = NOERROR;
EnterCriticalSection( &This->csFilter ); EnterCriticalSection( &This->csFilter );
/* FIXME - call OnStop() */ if ( This->fstate == State_Running )
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
}
if ( SUCCEEDED(hr) )
This->fstate = State_Stopped; This->fstate = State_Stopped;
LeaveCriticalSection( &This->csFilter ); LeaveCriticalSection( &This->csFilter );
return NOERROR; return hr;
} }
static HRESULT WINAPI static HRESULT WINAPI
CBaseFilterImpl_fnPause(IBaseFilter* iface) CBaseFilterImpl_fnPause(IBaseFilter* iface)
{ {
ICOM_THIS(CBaseFilterImpl,iface); ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr;
TRACE("(%p)->()\n",This); TRACE("(%p)->()\n",This);
hr = NOERROR;
EnterCriticalSection( &This->csFilter ); EnterCriticalSection( &This->csFilter );
/* FIXME - call OnPause() */ if ( This->fstate == State_Running )
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
}
if ( SUCCEEDED(hr) )
This->fstate = State_Paused; This->fstate = State_Paused;
LeaveCriticalSection( &This->csFilter ); LeaveCriticalSection( &This->csFilter );
return NOERROR; TRACE("hr = %08lx\n",hr);
return hr;
} }
static HRESULT WINAPI static HRESULT WINAPI
CBaseFilterImpl_fnRun(IBaseFilter* iface,REFERENCE_TIME rtStart) CBaseFilterImpl_fnRun(IBaseFilter* iface,REFERENCE_TIME rtStart)
{ {
ICOM_THIS(CBaseFilterImpl,iface); ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr;
TRACE("(%p)->()\n",This); TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->csFilter ); hr = NOERROR;
/* FIXME - call OnRun() */ EnterCriticalSection( &This->csFilter );
This->rtStart = rtStart; This->rtStart = rtStart;
if ( This->fstate != State_Running )
{
if ( This->pHandlers->pOnActive != NULL )
hr = This->pHandlers->pOnActive( This );
}
if ( SUCCEEDED(hr) )
This->fstate = State_Running; This->fstate = State_Running;
LeaveCriticalSection( &This->csFilter ); LeaveCriticalSection( &This->csFilter );
return NOERROR; return hr;
} }
static HRESULT WINAPI static HRESULT WINAPI
...@@ -136,6 +163,7 @@ CBaseFilterImpl_fnGetState(IBaseFilter* iface,DWORD dw,FILTER_STATE* pState) ...@@ -136,6 +163,7 @@ CBaseFilterImpl_fnGetState(IBaseFilter* iface,DWORD dw,FILTER_STATE* pState)
/* FIXME - ignore 'intermediate state' now */ /* FIXME - ignore 'intermediate state' now */
EnterCriticalSection( &This->csFilter ); EnterCriticalSection( &This->csFilter );
TRACE("state %d\n",This->fstate);
*pState = This->fstate; *pState = This->fstate;
LeaveCriticalSection( &This->csFilter ); LeaveCriticalSection( &This->csFilter );
...@@ -366,7 +394,8 @@ static ICOM_VTABLE(IBaseFilter) ibasefilter = ...@@ -366,7 +394,8 @@ static ICOM_VTABLE(IBaseFilter) ibasefilter =
HRESULT CBaseFilterImpl_InitIBaseFilter( HRESULT CBaseFilterImpl_InitIBaseFilter(
CBaseFilterImpl* This, IUnknown* punkControl, CBaseFilterImpl* This, IUnknown* punkControl,
const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph ) const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
const CBaseFilterHandlers* pHandlers )
{ {
TRACE("(%p,%p)\n",This,punkControl); TRACE("(%p,%p)\n",This,punkControl);
...@@ -378,6 +407,7 @@ HRESULT CBaseFilterImpl_InitIBaseFilter( ...@@ -378,6 +407,7 @@ HRESULT CBaseFilterImpl_InitIBaseFilter(
ICOM_VTBL(This) = &ibasefilter; ICOM_VTBL(This) = &ibasefilter;
This->punkControl = punkControl; This->punkControl = punkControl;
This->pHandlers = pHandlers;
This->pclsidFilter = pclsidFilter; This->pclsidFilter = pclsidFilter;
This->pInPins = NULL; This->pInPins = NULL;
This->pOutPins = NULL; This->pOutPins = NULL;
...@@ -394,6 +424,18 @@ HRESULT CBaseFilterImpl_InitIBaseFilter( ...@@ -394,6 +424,18 @@ HRESULT CBaseFilterImpl_InitIBaseFilter(
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy( This->pwszNameGraph, lpwszNameGraph, This->cbNameGraph ); memcpy( This->pwszNameGraph, lpwszNameGraph, This->cbNameGraph );
This->pInPins = QUARTZ_CompList_Alloc();
This->pOutPins = QUARTZ_CompList_Alloc();
if ( This->pInPins == NULL || This->pOutPins == NULL )
{
if ( This->pInPins != NULL )
QUARTZ_CompList_Free(This->pInPins);
if ( This->pOutPins != NULL )
QUARTZ_CompList_Free(This->pOutPins);
QUARTZ_FreeMem(This->pwszNameGraph);
return E_OUTOFMEMORY;
}
InitializeCriticalSection( &This->csFilter ); InitializeCriticalSection( &This->csFilter );
return NOERROR; return NOERROR;
...@@ -415,7 +457,6 @@ void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This ) ...@@ -415,7 +457,6 @@ void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This )
break; break;
pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem ); pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem );
QUARTZ_CompList_RemoveComp( This->pInPins, (IUnknown*)pPin ); QUARTZ_CompList_RemoveComp( This->pInPins, (IUnknown*)pPin );
IPin_Release( pPin );
} }
QUARTZ_CompList_Free( This->pInPins ); QUARTZ_CompList_Free( This->pInPins );
...@@ -430,7 +471,6 @@ void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This ) ...@@ -430,7 +471,6 @@ void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This )
break; break;
pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem ); pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem );
QUARTZ_CompList_RemoveComp( This->pOutPins, (IUnknown*)pPin ); QUARTZ_CompList_RemoveComp( This->pOutPins, (IUnknown*)pPin );
IPin_Release( pPin );
} }
QUARTZ_CompList_Free( This->pOutPins ); QUARTZ_CompList_Free( This->pOutPins );
......
...@@ -14,13 +14,20 @@ ...@@ -14,13 +14,20 @@
*/ */
#include "complist.h" #include "complist.h"
#include "mtype.h"
typedef struct CBaseFilterHandlers CBaseFilterHandlers;
typedef struct CBasePinHandlers CBasePinHandlers;
typedef struct CBaseFilterImpl typedef struct CBaseFilterImpl
{ {
/* IPersist - IMediaFilter - IBaseFilter */
ICOM_VFIELD(IBaseFilter); ICOM_VFIELD(IBaseFilter);
/* IUnknown fields */ /* IUnknown fields */
IUnknown* punkControl; IUnknown* punkControl;
/* IBaseFilter fields */ /* IBaseFilter fields */
const CBaseFilterHandlers* pHandlers;
CRITICAL_SECTION csFilter; CRITICAL_SECTION csFilter;
const CLSID* pclsidFilter; const CLSID* pclsidFilter;
QUARTZ_CompList* pInPins; /* a list of IPin-s. */ QUARTZ_CompList* pInPins; /* a list of IPin-s. */
...@@ -33,30 +40,44 @@ typedef struct CBaseFilterImpl ...@@ -33,30 +40,44 @@ typedef struct CBaseFilterImpl
FILTER_STATE fstate; FILTER_STATE fstate;
} CBaseFilterImpl; } CBaseFilterImpl;
struct CBaseFilterHandlers
{
HRESULT (*pOnActive)( CBaseFilterImpl* pImpl );
HRESULT (*pOnInactive)( CBaseFilterImpl* pImpl );
};
HRESULT CBaseFilterImpl_InitIBaseFilter( HRESULT CBaseFilterImpl_InitIBaseFilter(
CBaseFilterImpl* This, IUnknown* punkControl, CBaseFilterImpl* This, IUnknown* punkControl,
const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph ); const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
const CBaseFilterHandlers* pHandlers );
void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This ); void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This );
/* /*
* Implements IPin and IMemInputPin. (internal) * Implements IPin, IMemInputPin, and IQualityControl. (internal)
* *
* a base class for implementing IPin. * a base class for implementing IPin.
*/ */
typedef struct CPinBaseImpl typedef struct CPinBaseImpl
{ {
/* IPin */
ICOM_VFIELD(IPin); ICOM_VFIELD(IPin);
/* IUnknown fields */ /* IUnknown fields */
IUnknown* punkControl; IUnknown* punkControl;
/* IPin fields */ /* IPin fields */
const CBasePinHandlers* pHandlers;
DWORD cbIdLen; DWORD cbIdLen;
WCHAR* pwszId; WCHAR* pwszId;
BOOL bOutput; BOOL bOutput;
CRITICAL_SECTION csPin; /* you can change AcceptTypes while pcsPin has been hold */
const AM_MEDIA_TYPE* pmtAcceptTypes;
ULONG cAcceptTypes;
CRITICAL_SECTION* pcsPin;
CBaseFilterImpl* pFilter; CBaseFilterImpl* pFilter;
IPin* pPinConnectedTo; IPin* pPinConnectedTo;
AM_MEDIA_TYPE* pmtConn; AM_MEDIA_TYPE* pmtConn;
...@@ -64,31 +85,66 @@ typedef struct CPinBaseImpl ...@@ -64,31 +85,66 @@ typedef struct CPinBaseImpl
typedef struct CMemInputPinBaseImpl typedef struct CMemInputPinBaseImpl
{ {
/* IMemInputPin */
ICOM_VFIELD(IMemInputPin); ICOM_VFIELD(IMemInputPin);
/* IUnknown fields */ /* IUnknown fields */
IUnknown* punkControl; IUnknown* punkControl;
/* IMemInputPin fields */ /* IMemInputPin fields */
CRITICAL_SECTION* pcsPin; CPinBaseImpl* pPin;
IMemAllocator* pAllocator; IMemAllocator* pAllocator;
BOOL bReadonly; BOOL bReadonly;
} CMemInputPinBaseImpl; } CMemInputPinBaseImpl;
typedef struct CQualityControlPassThruImpl
{
/* IQualityControl */
ICOM_VFIELD(IQualityControl);
/* IUnknown fields */
IUnknown* punkControl;
/* IQualityControl fields */
CPinBaseImpl* pPin;
IQualityControl* pControl;
} CQualityControlPassThruImpl;
struct CBasePinHandlers
{
HRESULT (*pCheckMediaType)( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt );
HRESULT (*pQualityNotify)( CPinBaseImpl* pImpl, IBaseFilter* pFilter, Quality q );
HRESULT (*pReceive)( CPinBaseImpl* pImpl, IMediaSample* pSample );
HRESULT (*pReceiveCanBlock)( CPinBaseImpl* pImpl );
HRESULT (*pEndOfStream)( CPinBaseImpl* pImpl );
HRESULT (*pBeginFlush)( CPinBaseImpl* pImpl );
HRESULT (*pEndFlush)( CPinBaseImpl* pImpl );
HRESULT (*pNewSegment)( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
};
HRESULT CPinBaseImpl_InitIPin( HRESULT CPinBaseImpl_InitIPin(
CPinBaseImpl* This, IUnknown* punkControl, CPinBaseImpl* This, IUnknown* punkControl,
CRITICAL_SECTION* pcsPin,
CBaseFilterImpl* pFilter, LPCWSTR pwszId, CBaseFilterImpl* pFilter, LPCWSTR pwszId,
BOOL bOutput ); BOOL bOutput,
const CBasePinHandlers* pHandlers );
void CPinBaseImpl_UninitIPin( CPinBaseImpl* This ); void CPinBaseImpl_UninitIPin( CPinBaseImpl* This );
HRESULT CMemInputPinBaseImpl_InitIMemInputPin( HRESULT CMemInputPinBaseImpl_InitIMemInputPin(
CMemInputPinBaseImpl* This, IUnknown* punkControl, CMemInputPinBaseImpl* This, IUnknown* punkControl,
CRITICAL_SECTION* pcsPin CPinBaseImpl* pPin );
);
void CMemInputPinBaseImpl_UninitIMemInputPin( void CMemInputPinBaseImpl_UninitIMemInputPin(
CMemInputPinBaseImpl* This ); CMemInputPinBaseImpl* This );
HRESULT CQualityControlPassThruImpl_InitIQualityControl(
CQualityControlPassThruImpl* This, IUnknown* punkControl,
CPinBaseImpl* pPin );
void CQualityControlPassThruImpl_UninitIQualityControl(
CQualityControlPassThruImpl* This );
#endif /* WINE_DSHOW_BASEFILT_H */ #endif /* WINE_DSHOW_BASEFILT_H */
...@@ -25,7 +25,7 @@ DEFAULT_DEBUG_CHANNEL(quartz); ...@@ -25,7 +25,7 @@ DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h" #include "quartz_private.h"
#include "fgraph.h" #include "fgraph.h"
#define EVENTQUEUE_BLOCKSIZE 16 #define EVENTQUEUE_BLOCKSIZE 2
#define EVENTQUEUE_MAX 1024 #define EVENTQUEUE_MAX 1024
struct FilterGraph_MEDIAEVENT struct FilterGraph_MEDIAEVENT
...@@ -36,6 +36,106 @@ struct FilterGraph_MEDIAEVENT ...@@ -36,6 +36,106 @@ struct FilterGraph_MEDIAEVENT
}; };
static HRESULT FGEVENT_KeepEvent(
BOOL bKeep,
long lEventCode, LONG_PTR lParam1, LONG_PTR lParam2 )
{
switch ( lEventCode )
{
/*case EC_COMPLETE:*/
case EC_USERABORT:
break;
case EC_ERRORABORT:
break;
case EC_TIME:
break;
/*case EC_REPAINT:*/
case EC_STREAM_ERROR_STOPPED:
break;
case EC_STREAM_ERROR_STILLPLAYING:
break;
case EC_ERROR_STILLPLAYING:
break;
case EC_PALETTE_CHANGED:
break;
case EC_VIDEO_SIZE_CHANGED:
break;
case EC_QUALITY_CHANGE:
break;
/*case EC_SHUTTING_DOWN:*/
case EC_CLOCK_CHANGED:
break;
case EC_PAUSED:
break;
case EC_OPENING_FILE:
break;
case EC_BUFFERING_DATA:
break;
case EC_FULLSCREEN_LOST:
if ( bKeep )
{
if ( ((IBaseFilter*)lParam2) != NULL )
IBaseFilter_AddRef( (IBaseFilter*)lParam2 );
}
else
{
if ( ((IBaseFilter*)lParam2) != NULL )
IBaseFilter_Release( (IBaseFilter*)lParam2 );
}
break;
/*case EC_ACTIVATE:*/
/*case EC_NEED_RESTART:*/
/*case EC_WINDOW_DESTROYED:*/
/*case EC_DISPLAY_CHANGED:*/
/*case EC_STARVATION:*/
/*case EC_OLE_EVENT:*/
/*case EC_NOTIFY_WINDOW:*/
/*case EC_STREAM_CONTROL_STOPPED:*/
/*case EC_STREAM_CONTROL_STARTED:*/
/*case EC_END_OF_SEGMENT:*/
/*case EC_SEGMENT_STARTED:*/
case EC_LENGTH_CHANGED:
break;
case EC_DEVICE_LOST:
if ( bKeep )
{
if ( ((IUnknown*)lParam1) != NULL )
IUnknown_AddRef( (IUnknown*)lParam1 );
}
else
{
if ( ((IUnknown*)lParam1) != NULL )
IUnknown_Release( (IUnknown*)lParam1 );
}
break;
case EC_STEP_COMPLETE:
break;
case EC_SKIP_FRAMES:
break;
/*case EC_TIMECODE_AVAILABLE:*/
/*case EC_EXTDEVICE_MODE_CHANGE:*/
case EC_GRAPH_CHANGED:
break;
case EC_CLOCK_UNSET:
break;
default:
if ( lEventCode < EC_USER )
{
FIXME( "unknown system event %08lx\n", lEventCode );
return E_INVALIDARG;
}
TRACE( "user event %08lx\n", lEventCode );
break;
}
return NOERROR;
}
/*************************************************************************** /***************************************************************************
* *
* CLSID_FilterGraph::IMediaEvent[Ex] * CLSID_FilterGraph::IMediaEvent[Ex]
...@@ -129,7 +229,7 @@ static HRESULT WINAPI ...@@ -129,7 +229,7 @@ static HRESULT WINAPI
IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* plEventCode,LONG_PTR* plParam1,LONG_PTR* plParam2,long lTimeOut) IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* plEventCode,LONG_PTR* plParam1,LONG_PTR* plParam2,long lTimeOut)
{ {
CFilterGraph_THIS(iface,mediaevent); CFilterGraph_THIS(iface,mediaevent);
ULONG cbQueued; ULONG cQueued;
DWORD dw; DWORD dw;
DWORD dwStart; DWORD dwStart;
HRESULT hr; HRESULT hr;
...@@ -154,11 +254,11 @@ IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* plEventCode,LONG_PTR* plPara ...@@ -154,11 +254,11 @@ IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* plEventCode,LONG_PTR* plPara
hr = S_FALSE; hr = S_FALSE;
if ( This->m_cbMediaEventsMax > 0 ) if ( This->m_cbMediaEventsMax > 0 )
{ {
cbQueued = cQueued =
(This->m_cbMediaEventsMax + (This->m_cbMediaEventsMax +
This->m_cbMediaEventsPut - This->m_cbMediaEventsGet) % This->m_cbMediaEventsPut - This->m_cbMediaEventsGet) %
This->m_cbMediaEventsMax; This->m_cbMediaEventsMax;
if ( cbQueued > 0 ) if ( cQueued > 0 )
{ {
pEvent = &This->m_pMediaEvents[This->m_cbMediaEventsGet]; pEvent = &This->m_pMediaEvents[This->m_cbMediaEventsGet];
*plEventCode = pEvent->lEventCode; *plEventCode = pEvent->lEventCode;
...@@ -168,6 +268,8 @@ IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* plEventCode,LONG_PTR* plPara ...@@ -168,6 +268,8 @@ IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* plEventCode,LONG_PTR* plPara
This->m_cbMediaEventsMax; This->m_cbMediaEventsMax;
hr = NOERROR; hr = NOERROR;
if ( This->m_cbMediaEventsPut == This->m_cbMediaEventsGet )
ResetEvent( This->m_hMediaEvent );
} }
} }
LeaveCriticalSection( &This->m_csMediaEvents ); LeaveCriticalSection( &This->m_csMediaEvents );
...@@ -259,9 +361,9 @@ IMediaEventEx_fnFreeEventParams(IMediaEventEx* iface,long lEventCode,LONG_PTR lP ...@@ -259,9 +361,9 @@ IMediaEventEx_fnFreeEventParams(IMediaEventEx* iface,long lEventCode,LONG_PTR lP
{ {
CFilterGraph_THIS(iface,mediaevent); CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->() stub!\n",This); TRACE("(%p)->(%08lx,%08x,%08x)\n",This,lEventCode,lParam1,lParam2);
return E_NOTIMPL; return FGEVENT_KeepEvent( FALSE, lEventCode, lParam1, lParam2 );
} }
static HRESULT WINAPI static HRESULT WINAPI
...@@ -269,9 +371,15 @@ IMediaEventEx_fnSetNotifyWindow(IMediaEventEx* iface,OAHWND hwnd,long message,LO ...@@ -269,9 +371,15 @@ IMediaEventEx_fnSetNotifyWindow(IMediaEventEx* iface,OAHWND hwnd,long message,LO
{ {
CFilterGraph_THIS(iface,mediaevent); CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->() stub!\n",This); TRACE("(%p)->(%08x,%08lx,%08x)\n",This,hwnd,message,lParam);
return E_NOTIMPL; EnterCriticalSection( &This->m_csMediaEvents );
This->m_hwndEventNotify = (HWND)hwnd;
This->m_lEventNotifyMsg = message;
This->m_lEventNotifyParam = lParam;
LeaveCriticalSection( &This->m_csMediaEvents );
return NOERROR;
} }
static HRESULT WINAPI static HRESULT WINAPI
...@@ -279,9 +387,16 @@ IMediaEventEx_fnSetNotifyFlags(IMediaEventEx* iface,long lNotifyFlags) ...@@ -279,9 +387,16 @@ IMediaEventEx_fnSetNotifyFlags(IMediaEventEx* iface,long lNotifyFlags)
{ {
CFilterGraph_THIS(iface,mediaevent); CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->() stub!\n",This); TRACE("(%p)->(%ld)\n",This,lNotifyFlags);
return E_NOTIMPL; if ( lNotifyFlags != 0 && lNotifyFlags != 1 )
return E_INVALIDARG;
EnterCriticalSection( &This->m_csMediaEvents );
This->m_lEventNotifyFlags = lNotifyFlags;
LeaveCriticalSection( &This->m_csMediaEvents );
return NOERROR;
} }
static HRESULT WINAPI static HRESULT WINAPI
...@@ -289,9 +404,16 @@ IMediaEventEx_fnGetNotifyFlags(IMediaEventEx* iface,long* plNotifyFlags) ...@@ -289,9 +404,16 @@ IMediaEventEx_fnGetNotifyFlags(IMediaEventEx* iface,long* plNotifyFlags)
{ {
CFilterGraph_THIS(iface,mediaevent); CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->() stub!\n",This); TRACE("(%p)->(%p)\n",This,plNotifyFlags);
return E_NOTIMPL; if ( plNotifyFlags == NULL )
return E_POINTER;
EnterCriticalSection( &This->m_csMediaEvents );
*plNotifyFlags = This->m_lEventNotifyFlags;
LeaveCriticalSection( &This->m_csMediaEvents );
return NOERROR;
} }
...@@ -336,6 +458,10 @@ HRESULT CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg ) ...@@ -336,6 +458,10 @@ HRESULT CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg )
pfg->m_cbMediaEventsPut = 0; pfg->m_cbMediaEventsPut = 0;
pfg->m_cbMediaEventsGet = 0; pfg->m_cbMediaEventsGet = 0;
pfg->m_cbMediaEventsMax = 0; pfg->m_cbMediaEventsMax = 0;
pfg->m_hwndEventNotify = (HWND)NULL;
pfg->m_lEventNotifyMsg = 0;
pfg->m_lEventNotifyParam = 0;
pfg->m_lEventNotifyFlags = 0;
return NOERROR; return NOERROR;
} }
...@@ -411,10 +537,98 @@ static HRESULT WINAPI ...@@ -411,10 +537,98 @@ static HRESULT WINAPI
IMediaEventSink_fnNotify(IMediaEventSink* iface,long lEventCode,LONG_PTR lParam1,LONG_PTR lParam2) IMediaEventSink_fnNotify(IMediaEventSink* iface,long lEventCode,LONG_PTR lParam1,LONG_PTR lParam2)
{ {
CFilterGraph_THIS(iface,mediaeventsink); CFilterGraph_THIS(iface,mediaeventsink);
HRESULT hr = NOERROR;
ULONG cQueued;
ULONG cTemp;
FilterGraph_MEDIAEVENT* pEvent;
FIXME("(%p)->(%ld,%08x,%08x) stub!\n",This,lEventCode,lParam1,lParam2); TRACE("(%p)->(%08lx,%08x,%08x) stub!\n",This,lEventCode,lParam1,lParam2);
return E_NOTIMPL; EnterCriticalSection( &This->m_csMediaEvents );
/* allocate a new entry. */
if ( This->m_cbMediaEventsMax == 0 )
cQueued = 0;
else
cQueued =
(This->m_cbMediaEventsMax +
This->m_cbMediaEventsPut - This->m_cbMediaEventsGet) %
This->m_cbMediaEventsMax;
if ( (cQueued + 1) >= This->m_cbMediaEventsMax )
{
if ( This->m_cbMediaEventsMax >= EVENTQUEUE_MAX )
{
hr = E_FAIL;
goto end;
}
pEvent = (FilterGraph_MEDIAEVENT*)
QUARTZ_AllocMem( sizeof(FilterGraph_MEDIAEVENT) *
(This->m_cbMediaEventsMax+EVENTQUEUE_BLOCKSIZE) );
if ( pEvent == NULL )
{
hr = E_OUTOFMEMORY;
goto end;
}
if ( cQueued > 0 )
{
if ( (This->m_cbMediaEventsGet + cQueued) >=
This->m_cbMediaEventsMax )
{
cTemp = This->m_cbMediaEventsMax - This->m_cbMediaEventsGet;
memcpy(
pEvent,
&This->m_pMediaEvents[This->m_cbMediaEventsGet],
sizeof(FilterGraph_MEDIAEVENT) * cTemp );
memcpy(
pEvent + cTemp,
&This->m_pMediaEvents[0],
sizeof(FilterGraph_MEDIAEVENT) * (cQueued - cTemp) );
}
else
{
memcpy(
pEvent,
&This->m_pMediaEvents[This->m_cbMediaEventsGet],
sizeof(FilterGraph_MEDIAEVENT) * cQueued );
}
QUARTZ_FreeMem( This->m_pMediaEvents );
}
This->m_pMediaEvents = pEvent;
This->m_cbMediaEventsMax += EVENTQUEUE_BLOCKSIZE;
This->m_cbMediaEventsPut = cQueued;
This->m_cbMediaEventsGet = 0;
}
/* duplicate params if necessary. */
hr = FGEVENT_KeepEvent( TRUE, lEventCode, lParam1, lParam2 );
if ( FAILED(hr) )
goto end;
/* add to the queue. */
pEvent = &This->m_pMediaEvents[This->m_cbMediaEventsPut];
pEvent->lEventCode = lEventCode;
pEvent->lParam1 = lParam1;
pEvent->lParam2 = lParam2;
This->m_cbMediaEventsPut =
(This->m_cbMediaEventsPut + 1) % This->m_cbMediaEventsMax;
SetEvent( This->m_hMediaEvent );
if ( This->m_hwndEventNotify != (HWND)NULL &&
This->m_lEventNotifyFlags == 0 )
{
PostMessageA(
This->m_hwndEventNotify,
This->m_lEventNotifyMsg,
(WPARAM)0,
(LPARAM)This->m_lEventNotifyParam );
}
hr = NOERROR;
end:
LeaveCriticalSection( &This->m_csMediaEvents );
return hr;
} }
......
...@@ -140,6 +140,10 @@ typedef struct CFilterGraph ...@@ -140,6 +140,10 @@ typedef struct CFilterGraph
ULONG m_cbMediaEventsPut; ULONG m_cbMediaEventsPut;
ULONG m_cbMediaEventsGet; ULONG m_cbMediaEventsGet;
ULONG m_cbMediaEventsMax; ULONG m_cbMediaEventsMax;
HWND m_hwndEventNotify;
long m_lEventNotifyMsg;
LONG_PTR m_lEventNotifyParam;
long m_lEventNotifyFlags;
/* IMediaEventSink fields. */ /* IMediaEventSink fields. */
/* IMediaPosition fields. */ /* IMediaPosition fields. */
/* IMediaSeeking fields. */ /* IMediaSeeking fields. */
......
...@@ -80,6 +80,20 @@ static HRESULT CFilterGraph_DisconnectAllPins( IBaseFilter* pFilter ) ...@@ -80,6 +80,20 @@ static HRESULT CFilterGraph_DisconnectAllPins( IBaseFilter* pFilter )
} }
static HRESULT CFilterGraph_GraphChanged( CFilterGraph* This )
{
/* IDistributorNotify_NotifyGraphChange() */
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This),
EC_GRAPH_CHANGED, 0, 0);
EnterCriticalSection( &This->m_csGraphVersion );
This->m_lGraphVersion ++;
LeaveCriticalSection( &This->m_csGraphVersion );
return NOERROR;
}
/****************************************************************************/ /****************************************************************************/
static HRESULT WINAPI static HRESULT WINAPI
...@@ -220,12 +234,9 @@ name_ok: ...@@ -220,12 +234,9 @@ name_ok:
goto end; goto end;
} }
/* IDistributorNotify_NotifyGraphChange() */ hr = CFilterGraph_GraphChanged(This);
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This), if ( FAILED(hr) )
EC_GRAPH_CHANGED, 0, 0); goto end;
EnterCriticalSection( &This->m_csGraphVersion );
This->m_lGraphVersion ++;
LeaveCriticalSection( &This->m_csGraphVersion );
hr = hrSucceeded; hr = hrSucceeded;
end: end:
...@@ -269,12 +280,9 @@ IFilterGraph2_fnRemoveFilter(IFilterGraph2* iface,IBaseFilter* pFilter) ...@@ -269,12 +280,9 @@ IFilterGraph2_fnRemoveFilter(IFilterGraph2* iface,IBaseFilter* pFilter)
This->m_pFilterList, (IUnknown*)pFilter ); This->m_pFilterList, (IUnknown*)pFilter );
} }
/* IDistributorNotify_NotifyGraphChange() */ hr = CFilterGraph_GraphChanged(This);
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This), if ( FAILED(hr) )
EC_GRAPH_CHANGED, 0, 0); goto end;
EnterCriticalSection( &This->m_csGraphVersion );
This->m_lGraphVersion ++;
LeaveCriticalSection( &This->m_csGraphVersion );
end:; end:;
QUARTZ_CompList_Unlock( This->m_pFilterList ); QUARTZ_CompList_Unlock( This->m_pFilterList );
...@@ -403,12 +411,9 @@ IFilterGraph2_fnConnectDirect(IFilterGraph2* iface,IPin* pOut,IPin* pIn,const AM ...@@ -403,12 +411,9 @@ IFilterGraph2_fnConnectDirect(IFilterGraph2* iface,IPin* pOut,IPin* pIn,const AM
goto end; goto end;
} }
/* IDistributorNotify_NotifyGraphChange() */ hr = CFilterGraph_GraphChanged(This);
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This), if ( FAILED(hr) )
EC_GRAPH_CHANGED, 0, 0); goto end;
EnterCriticalSection( &This->m_csGraphVersion );
This->m_lGraphVersion ++;
LeaveCriticalSection( &This->m_csGraphVersion );
end: end:
QUARTZ_CompList_Unlock( This->m_pFilterList ); QUARTZ_CompList_Unlock( This->m_pFilterList );
...@@ -454,14 +459,14 @@ IFilterGraph2_fnDisconnect(IFilterGraph2* iface,IPin* pPin) ...@@ -454,14 +459,14 @@ IFilterGraph2_fnDisconnect(IFilterGraph2* iface,IPin* pPin)
IPin_Release(pConnTo); IPin_Release(pConnTo);
} }
hr = IPin_Disconnect(pPin); hr = IPin_Disconnect(pPin);
if ( FAILED(hr) )
goto end;
/* IDistributorNotify_NotifyGraphChange() */ hr = CFilterGraph_GraphChanged(This);
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This), if ( FAILED(hr) )
EC_GRAPH_CHANGED, 0, 0); goto end;
EnterCriticalSection( &This->m_csGraphVersion );
This->m_lGraphVersion ++;
LeaveCriticalSection( &This->m_csGraphVersion );
end:
QUARTZ_CompList_Unlock( This->m_pFilterList ); QUARTZ_CompList_Unlock( This->m_pFilterList );
return hr; return hr;
...@@ -657,17 +662,13 @@ static HRESULT WINAPI ...@@ -657,17 +662,13 @@ static HRESULT WINAPI
IFilterGraph2_fnReconnectEx(IFilterGraph2* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt) IFilterGraph2_fnReconnectEx(IFilterGraph2* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt)
{ {
CFilterGraph_THIS(iface,fgraph); CFilterGraph_THIS(iface,fgraph);
HRESULT hr;
FIXME( "(%p)->(%p,%p) stub!\n",This,pPin,pmt ); FIXME( "(%p)->(%p,%p) stub!\n",This,pPin,pmt );
/* reconnect asynchronously. */ /* reconnect asynchronously. */
/* IDistributorNotify_NotifyGraphChange() */ hr = CFilterGraph_GraphChanged(This);
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This),
EC_GRAPH_CHANGED, 0, 0);
EnterCriticalSection( &This->m_csGraphVersion );
This->m_lGraphVersion ++;
LeaveCriticalSection( &This->m_csGraphVersion );
return E_NOTIMPL; return E_NOTIMPL;
} }
......
...@@ -348,12 +348,8 @@ IMediaFilter_fnSetSyncSource(IMediaFilter* iface,IReferenceClock* pobjClock) ...@@ -348,12 +348,8 @@ IMediaFilter_fnSetSyncSource(IMediaFilter* iface,IReferenceClock* pobjClock)
QUARTZ_CompList_Unlock( This->m_pFilterList ); QUARTZ_CompList_Unlock( This->m_pFilterList );
if ( This->m_pClock != NULL )
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This), IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This),
EC_CLOCK_CHANGED, 0, 0); EC_CLOCK_CHANGED, 0, 0);
else
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This),
EC_CLOCK_UNSET, 0, 0);
LeaveCriticalSection( &This->m_csClock ); LeaveCriticalSection( &This->m_csClock );
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "winnls.h" #include "winnls.h"
#include "mmsystem.h"
#include "ole2.h" #include "ole2.h"
#include "wine/obj_oleaut.h" #include "wine/obj_oleaut.h"
#include "strmif.h" #include "strmif.h"
...@@ -30,6 +31,7 @@ DEFAULT_DEBUG_CHANNEL(quartz); ...@@ -30,6 +31,7 @@ DEFAULT_DEBUG_CHANNEL(quartz);
#include "fmap.h" #include "fmap.h"
#include "fmap2.h" #include "fmap2.h"
#include "seekpass.h" #include "seekpass.h"
#include "audren.h"
typedef struct QUARTZ_CLASSENTRY typedef struct QUARTZ_CLASSENTRY
...@@ -74,6 +76,7 @@ static const QUARTZ_CLASSENTRY QUARTZ_ClassList[] = ...@@ -74,6 +76,7 @@ static const QUARTZ_CLASSENTRY QUARTZ_ClassList[] =
{ &CLSID_FilterMapper, &QUARTZ_CreateFilterMapper }, { &CLSID_FilterMapper, &QUARTZ_CreateFilterMapper },
{ &CLSID_FilterMapper2, &QUARTZ_CreateFilterMapper2 }, { &CLSID_FilterMapper2, &QUARTZ_CreateFilterMapper2 },
{ &CLSID_SeekingPassThru, &QUARTZ_CreateSeekingPassThru }, { &CLSID_SeekingPassThru, &QUARTZ_CreateSeekingPassThru },
{ &CLSID_AudioRender, &QUARTZ_CreateAudioRenderer },
{ NULL, NULL }, { NULL, NULL },
}; };
...@@ -292,6 +295,8 @@ BOOL WINAPI QUARTZ_DllMain( ...@@ -292,6 +295,8 @@ BOOL WINAPI QUARTZ_DllMain(
DWORD fdwReason, DWORD fdwReason,
LPVOID lpvReserved ) LPVOID lpvReserved )
{ {
TRACE("(%08x,%08lx,%p)\n",hInstDLL,fdwReason,lpvReserved);
switch ( fdwReason ) switch ( fdwReason )
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
......
...@@ -287,6 +287,10 @@ IMemAllocator_fnDecommit(IMemAllocator* iface) ...@@ -287,6 +287,10 @@ IMemAllocator_fnDecommit(IMemAllocator* iface)
if ( !bBlock ) if ( !bBlock )
{ {
QUARTZ_FreeMem(This->ppSamples);
This->ppSamples = NULL;
QUARTZ_FreeMem(This->pData);
This->pData = NULL;
hr = NOERROR; hr = NOERROR;
break; break;
} }
......
...@@ -4,7 +4,7 @@ init QUARTZ_DllMain ...@@ -4,7 +4,7 @@ init QUARTZ_DllMain
import oleaut32.dll import oleaut32.dll
import ole32.dll import ole32.dll
#import winmm.dll import winmm.dll
import user32.dll import user32.dll
#import gdi32.dll #import gdi32.dll
import advapi32.dll import advapi32.dll
......
...@@ -491,6 +491,8 @@ HRESULT QUARTZ_CreateMemMediaSample( ...@@ -491,6 +491,8 @@ HRESULT QUARTZ_CreateMemMediaSample(
void QUARTZ_DestroyMemMediaSample( void QUARTZ_DestroyMemMediaSample(
CMemMediaSample* pSample ) CMemMediaSample* pSample )
{ {
TRACE("(%p)\n",pSample);
QUARTZ_FreeObj( pSample ); QUARTZ_FreeObj( pSample );
} }
...@@ -1331,7 +1331,7 @@ ICOM_DEFINE(IMediaSample,IUnknown) ...@@ -1331,7 +1331,7 @@ ICOM_DEFINE(IMediaSample,IUnknown)
#define IMediaSample_SetSyncPoint(p,a1) ICOM_CALL1(SetSyncPoint,p,a1) #define IMediaSample_SetSyncPoint(p,a1) ICOM_CALL1(SetSyncPoint,p,a1)
#define IMediaSample_IsPreroll(p) ICOM_CALL (IsPreroll,p) #define IMediaSample_IsPreroll(p) ICOM_CALL (IsPreroll,p)
#define IMediaSample_SetPreroll(p,a1) ICOM_CALL1(SetPreroll,p,a1) #define IMediaSample_SetPreroll(p,a1) ICOM_CALL1(SetPreroll,p,a1)
#define IMediaSample_GetActualDataLength(p,a1) ICOM_CALL1(GetActualDataLength,p,a1) #define IMediaSample_GetActualDataLength(p) ICOM_CALL (GetActualDataLength,p)
#define IMediaSample_SetActualDataLength(p,a1) ICOM_CALL1(SetActualDataLength,p,a1) #define IMediaSample_SetActualDataLength(p,a1) ICOM_CALL1(SetActualDataLength,p,a1)
#define IMediaSample_GetMediaType(p,a1) ICOM_CALL1(GetMediaType,p,a1) #define IMediaSample_GetMediaType(p,a1) ICOM_CALL1(GetMediaType,p,a1)
#define IMediaSample_SetMediaType(p,a1) ICOM_CALL1(SetMediaType,p,a1) #define IMediaSample_SetMediaType(p,a1) ICOM_CALL1(SetMediaType,p,a1)
......
...@@ -318,6 +318,16 @@ ...@@ -318,6 +318,16 @@
"FriendlyName"="Audio Renderers" "FriendlyName"="Audio Renderers"
# CLSID_AudioRender
[HKEY_CLASSES_ROOT\CLSID\{e30629d1-27e5-11ce-875d-00608cb78066}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{E0F158E1-CB04-11D0-BD4E-00A0C911CE86}\Instance\{e30629d1-27e5-11ce-875d-00608cb78066}]
"CLSID"="{e30629d1-27e5-11ce-875d-00608cb78066}"
"FriendlyName"="Waveout audio renderer"
# #
# Entries for Mozilla ActiveX control support # Entries for Mozilla ActiveX control support
......
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