Commit bd3be7a9 authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard

Started Implementing Video Renderer.

Started Implementing WAVE/AU/AIFF Parser. Started Implementing file source. Fixed some bugs.
parent 90d4b11b
......@@ -10,6 +10,7 @@ SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \
amundoc.c \
asyncsrc.c \
audren.c \
basefilt.c \
basepin.c \
......@@ -34,10 +35,13 @@ C_SRCS = \
main.c \
memalloc.c \
mtype.c \
parser.c \
regsvr.c \
sample.c \
seekpass.c \
sysclock.c
sysclock.c \
vidren.c \
wavparse.c
@MAKE_DLL_RULES@
......
/*
* Implements Asynchronous File/URL Source.
*
* hidenori@a2.ctktv.ne.jp
*/
#ifndef WINE_DSHOW_ASYNCSRC_H
#define WINE_DSHOW_ASYNCSRC_H
#include "iunk.h"
#include "basefilt.h"
typedef struct CAsyncSourceImpl CAsyncSourceImpl;
typedef struct CAsyncSourcePinImpl CAsyncSourcePinImpl;
typedef struct AsyncSourceHandlers AsyncSourceHandlers;
typedef struct CAsyncReaderImpl
{
ICOM_VFIELD(IAsyncReader);
/* IUnknown fields */
IUnknown* punkControl;
/* IAsyncReader fields */
CAsyncSourceImpl* pSource;
CRITICAL_SECTION* pcsReader;
HANDLE m_hEventInit;
HANDLE m_hEventAbort;
HANDLE m_hEventReqQueued;
HANDLE m_hEventSampQueued;
HANDLE m_hEventCompletion;
HANDLE m_hThread;
} CAsyncReaderImpl;
typedef struct CFileSourceFilterImpl
{
ICOM_VFIELD(IFileSourceFilter);
/* IUnknown fields */
IUnknown* punkControl;
/* IFileSourceFilter fields */
CAsyncSourceImpl* pSource;
CRITICAL_SECTION* pcsFileSource;
WCHAR* m_pwszFileName;
DWORD m_cbFileName;
AM_MEDIA_TYPE m_mt;
} CFileSourceFilterImpl;
struct CAsyncSourceImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
CFileSourceFilterImpl filesrc;
CRITICAL_SECTION csFilter;
CAsyncSourcePinImpl* pPin;
const AsyncSourceHandlers* m_pHandler;
void* m_pUserData;
};
struct CAsyncSourcePinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CAsyncReaderImpl async;
QUARTZ_IFDelegation qiext;
BOOL bAsyncReaderQueried;
CAsyncSourceImpl* pSource;
};
struct AsyncSourceHandlers
{
/* all handlers MUST be implemented. */
HRESULT (*pLoad)( CAsyncSourceImpl* pImpl, LPCWSTR lpwszSourceName );
HRESULT (*pCleanup)( CAsyncSourceImpl* pImpl );
HRESULT (*pGetLength)( CAsyncSourceImpl* pImpl, LONGLONG* pllTotal, LONGLONG* pllAvailable );
HRESULT (*pReadAsync)( CAsyncSourceImpl* pImpl, LONGLONG llOfsStart, LONG lLength, BYTE* pBuf, HANDLE hEventCompletion );
HRESULT (*pGetResult)( CAsyncSourceImpl* pImpl, LONG* plReturned );
HRESULT (*pCancelAsync)( CAsyncSourceImpl* pImpl );
};
#define CAsyncSourceImpl_THIS(iface,member) CAsyncSourceImpl* This = ((CAsyncSourceImpl*)(((char*)iface)-offsetof(CAsyncSourceImpl,member)))
#define CAsyncSourcePinImpl_THIS(iface,member) CAsyncSourcePinImpl* This = ((CAsyncSourcePinImpl*)(((char*)iface)-offsetof(CAsyncSourcePinImpl,member)))
HRESULT CAsyncReaderImpl_InitIAsyncReader(
CAsyncReaderImpl* This, IUnknown* punkControl,
CAsyncSourceImpl* pSource,
CRITICAL_SECTION* pcsReader );
void CAsyncReaderImpl_UninitIAsyncReader(
CAsyncReaderImpl* This );
HRESULT CFileSourceFilterImpl_InitIFileSourceFilter(
CFileSourceFilterImpl* This, IUnknown* punkControl,
CAsyncSourceImpl* pSource,
CRITICAL_SECTION* pcsFileSource );
void CFileSourceFilterImpl_UninitIFileSourceFilter(
CFileSourceFilterImpl* This );
HRESULT QUARTZ_CreateAsyncSource(
IUnknown* punkOuter,void** ppobj,
const CLSID* pclsidAsyncSource,
LPCWSTR pwszAsyncSourceName,
LPCWSTR pwszOutPinName,
const AsyncSourceHandlers* pHandler );
HRESULT QUARTZ_CreateAsyncSourcePin(
CAsyncSourceImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CAsyncSourcePinImpl** ppPin,
LPCWSTR pwszPinName );
#endif /* WINE_DSHOW_ASYNCSRC_H */
......@@ -22,6 +22,7 @@
#include "control.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "evcode.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
......@@ -365,6 +366,7 @@ static const CBaseFilterHandlers filterhandlers =
{
CAudioRendererImpl_OnActive, /* pOnActive */
CAudioRendererImpl_OnInactive, /* pOnInactive */
NULL, /* pOnStop */
};
/***************************************************************************
......@@ -378,7 +380,7 @@ static HRESULT CAudioRendererPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const
CAudioRendererPinImpl_THIS(pImpl,pin);
const WAVEFORMATEX* pwfx;
TRACE( "(%p,%p)\n",This,pmt );
TRACE("(%p,%p)\n",This,pmt);
if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Audio ) )
return E_FAIL;
......@@ -463,9 +465,11 @@ static HRESULT CAudioRendererPinImpl_EndOfStream( CPinBaseImpl* pImpl )
FIXME( "(%p)\n", This );
This->pRender->m_fInFlush = FALSE;
/* IMediaEventSink::Notify(EC_COMPLETE) */
return NOERROR;
/* FIXME - don't notify twice until stopped or seeked. */
return CBaseFilterImpl_MediaEventNotify(
&This->pRender->basefilter, EC_COMPLETE,
(LONG_PTR)S_OK, (LONG_PTR)(IBaseFilter*)(This->pRender) );
}
static HRESULT CAudioRendererPinImpl_BeginFlush( CPinBaseImpl* pImpl )
......@@ -497,11 +501,16 @@ static HRESULT CAudioRendererPinImpl_NewSegment( CPinBaseImpl* pImpl, REFERENCE_
FIXME( "(%p)\n", This );
This->pRender->m_fInFlush = FALSE;
return NOERROR;
}
static const CBasePinHandlers pinhandlers =
{
NULL, /* pOnPreConnect */
NULL, /* pOnPostConnect */
NULL, /* pOnDisconnect */
CAudioRendererPinImpl_CheckMediaType, /* pCheckMediaType */
NULL, /* pQualityNotify */
CAudioRendererPinImpl_Receive, /* pReceive */
......
......@@ -23,6 +23,13 @@ DEFAULT_DEBUG_CHANNEL(quartz);
#include "basefilt.h"
#include "enumunk.h"
/***************************************************************************
*
* CBaseFilterImpl::IBaseFilter
*
*/
static HRESULT WINAPI
CBaseFilterImpl_fnQueryInterface(IBaseFilter* iface,REFIID riid,void** ppobj)
{
......@@ -85,10 +92,17 @@ CBaseFilterImpl_fnStop(IBaseFilter* iface)
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Paused;
}
if ( This->fstate == State_Paused )
{
if ( This->pHandlers->pOnStop != NULL )
hr = This->pHandlers->pOnStop( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Stopped;
}
if ( SUCCEEDED(hr) )
This->fstate = State_Stopped;
LeaveCriticalSection( &This->csFilter );
return hr;
......@@ -105,16 +119,13 @@ CBaseFilterImpl_fnPause(IBaseFilter* iface)
hr = NOERROR;
EnterCriticalSection( &This->csFilter );
if ( This->fstate == State_Running )
if ( This->fstate != State_Paused )
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Paused;
}
if ( SUCCEEDED(hr) )
This->fstate = State_Paused;
LeaveCriticalSection( &This->csFilter );
TRACE("hr = %08lx\n",hr);
......@@ -136,15 +147,21 @@ CBaseFilterImpl_fnRun(IBaseFilter* iface,REFERENCE_TIME rtStart)
This->rtStart = rtStart;
if ( This->fstate != State_Running )
if ( This->fstate == State_Stopped )
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Paused;
}
if ( This->fstate == State_Paused )
{
if ( This->pHandlers->pOnActive != NULL )
hr = This->pHandlers->pOnActive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Running;
}
if ( SUCCEEDED(hr) )
This->fstate = State_Running;
LeaveCriticalSection( &This->csFilter );
return hr;
......@@ -366,6 +383,11 @@ CBaseFilterImpl_fnQueryVendorInfo(IBaseFilter* iface,LPWSTR* lpwszVendor)
}
/***************************************************************************
*
* construct/destruct CBaseFilterImpl
*
*/
static ICOM_VTABLE(IBaseFilter) ibasefilter =
{
......@@ -491,3 +513,41 @@ void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This )
DeleteCriticalSection( &This->csFilter );
}
/***************************************************************************
*
* CBaseFilterImpl methods
*
*/
HRESULT CBaseFilterImpl_MediaEventNotify(
CBaseFilterImpl* This, long lEvent,LONG_PTR lParam1,LONG_PTR lParam2)
{
IMediaEventSink* pSink = NULL;
HRESULT hr = E_NOTIMPL;
EnterCriticalSection( &This->csFilter );
if ( This->pfg == NULL )
{
hr = E_UNEXPECTED;
goto err;
}
hr = IFilterGraph_QueryInterface( This->pfg, &IID_IMediaEventSink, (void**)&pSink );
if ( FAILED(hr) )
goto err;
if ( pSink == NULL )
{
hr = E_FAIL;
goto err;
}
hr = IMediaEventSink_Notify(pSink,lEvent,lParam1,lParam2);
IMediaEventSink_Release(pSink);
err:
LeaveCriticalSection( &This->csFilter );
return hr;
}
......@@ -44,6 +44,7 @@ struct CBaseFilterHandlers
{
HRESULT (*pOnActive)( CBaseFilterImpl* pImpl );
HRESULT (*pOnInactive)( CBaseFilterImpl* pImpl );
HRESULT (*pOnStop)( CBaseFilterImpl* pImpl );
};
......@@ -54,12 +55,18 @@ HRESULT CBaseFilterImpl_InitIBaseFilter(
void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This );
HRESULT CBaseFilterImpl_MediaEventNotify(
CBaseFilterImpl* This, long lEvent,LONG_PTR lParam1,LONG_PTR lParam2);
/*
* Implements IPin, IMemInputPin, and IQualityControl. (internal)
*
* a base class for implementing IPin.
*/
typedef struct OutputPinAsyncImpl OutputPinAsyncImpl;
typedef struct CPinBaseImpl
{
/* IPin */
......@@ -80,7 +87,9 @@ typedef struct CPinBaseImpl
CRITICAL_SECTION* pcsPin;
CBaseFilterImpl* pFilter;
IPin* pPinConnectedTo;
IMemInputPin* pMemInputPinConnectedTo;
AM_MEDIA_TYPE* pmtConn;
OutputPinAsyncImpl* pAsyncOut; /* for asynchronous output */
} CPinBaseImpl;
typedef struct CMemInputPinBaseImpl
......@@ -111,6 +120,9 @@ typedef struct CQualityControlPassThruImpl
struct CBasePinHandlers
{
HRESULT (*pOnPreConnect)( CPinBaseImpl* pImpl, IPin* pPin );
HRESULT (*pOnPostConnect)( CPinBaseImpl* pImpl, IPin* pPin );
HRESULT (*pOnDisconnect)( CPinBaseImpl* pImpl );
HRESULT (*pCheckMediaType)( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt );
HRESULT (*pQualityNotify)( CPinBaseImpl* pImpl, IBaseFilter* pFilter, Quality q );
HRESULT (*pReceive)( CPinBaseImpl* pImpl, IMediaSample* pSample );
......@@ -146,5 +158,41 @@ void CQualityControlPassThruImpl_UninitIQualityControl(
CQualityControlPassThruImpl* This );
HRESULT CPinBaseImpl_SendSample( CPinBaseImpl* This, IMediaSample* pSample );
HRESULT CPinBaseImpl_SendEndOfStream( CPinBaseImpl* This );
HRESULT CPinBaseImpl_SendBeginFlush( CPinBaseImpl* This );
HRESULT CPinBaseImpl_SendEndFlush( CPinBaseImpl* This );
HRESULT CPinBaseImpl_SendNewSegment( CPinBaseImpl* This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
/***************************************************************************
*
* handlers for output pins.
*
*/
HRESULT OutputPinSync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
HRESULT OutputPinSync_ReceiveCanBlock( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_EndOfStream( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_BeginFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_EndFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
/***************************************************************************
*
* handlers for output pins (async).
*
*/
HRESULT OutputPinAsync_OnActive( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_OnInactive( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
HRESULT OutputPinAsync_ReceiveCanBlock( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_EndOfStream( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_BeginFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_EndFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
#endif /* WINE_DSHOW_BASEFILT_H */
......@@ -73,10 +73,19 @@ static HRESULT WINAPI
IGraphConfig_fnReconfigure(IGraphConfig* iface,IGraphConfigCallback* pCallback,PVOID pvParam,DWORD dwFlags,HANDLE hAbort)
{
CFilterGraph_THIS(iface,grphconf);
HRESULT hr;
FIXME("(%p)->() stub!\n",This);
FIXME("(%p)->(%p,%p,%08lx,%08x) stub!\n",This,pCallback,pvParam,dwFlags,hAbort);
return E_NOTIMPL;
QUARTZ_CompList_Lock( This->m_pFilterList );
EnterCriticalSection( &This->m_csGraphState );
hr = IGraphConfigCallback_Reconfigure(pCallback,pvParam,dwFlags);
LeaveCriticalSection( &This->m_csGraphState );
QUARTZ_CompList_Unlock( This->m_pFilterList );
return hr;
}
static HRESULT WINAPI
......
......@@ -32,7 +32,8 @@ DEFAULT_DEBUG_CHANNEL(quartz);
#include "fmap2.h"
#include "seekpass.h"
#include "audren.h"
#include "vidren.h"
#include "parser.h"
typedef struct QUARTZ_CLASSENTRY
{
......@@ -77,6 +78,8 @@ static const QUARTZ_CLASSENTRY QUARTZ_ClassList[] =
{ &CLSID_FilterMapper2, &QUARTZ_CreateFilterMapper2 },
{ &CLSID_SeekingPassThru, &QUARTZ_CreateSeekingPassThru },
{ &CLSID_AudioRender, &QUARTZ_CreateAudioRenderer },
{ &CLSID_VideoRenderer, &QUARTZ_CreateVideoRenderer },
{ &CLSID_quartzWaveParser, &QUARTZ_CreateWaveParser },
{ NULL, NULL },
};
......
......@@ -318,6 +318,8 @@ IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE
EnterCriticalSection( &This->csMem );
TRACE("(%p) enter critical section\n",This);
hr = NOERROR;
if ( This->pData == NULL || This->ppSamples == NULL ||
......@@ -353,6 +355,7 @@ IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE
end:
LeaveCriticalSection( &This->csMem );
TRACE("(%p) leave critical section\n",This);
return hr;
}
......@@ -418,3 +421,4 @@ void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma )
if ( pma->hEventSample != (HANDLE)NULL )
CloseHandle( pma->hEventSample );
}
......@@ -14,6 +14,7 @@
#include "wine/obj_base.h"
#include "strmif.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
......@@ -101,6 +102,22 @@ void QUARTZ_MediaType_Destroy(
CoTaskMemFree( pmt );
}
void QUARTZ_MediaSubType_FromFourCC(
GUID* psubtype, DWORD dwFourCC )
{
memcpy( psubtype, &MEDIASUBTYPE_PCM, sizeof(GUID) );
psubtype->Data1 = dwFourCC;
}
BOOL QUARTZ_MediaSubType_IsFourCC(
const GUID* psubtype )
{
GUID guidTemp;
QUARTZ_MediaSubType_FromFourCC(
&guidTemp, psubtype->Data1 );
return IsEqualGUID( psubtype, &guidTemp );
}
/****************************************************************************/
......
......@@ -17,6 +17,10 @@ AM_MEDIA_TYPE* QUARTZ_MediaType_Duplicate(
void QUARTZ_MediaType_Destroy(
AM_MEDIA_TYPE* pmt );
void QUARTZ_MediaSubType_FromFourCC(
GUID* psubtype, DWORD dwFourCC );
BOOL QUARTZ_MediaSubType_IsFourCC(
const GUID* psubtype );
HRESULT QUARTZ_CreateEnumMediaTypes(
IEnumMediaTypes** ppobj,
......
/*
* Implements Parser.
*
* hidenori@a2.ctktv.ne.jp
*/
#ifndef WINE_DSHOW_PARSER_H
#define WINE_DSHOW_PARSER_H
#include "iunk.h"
#include "basefilt.h"
typedef struct CParserImpl CParserImpl;
typedef struct CParserInPinImpl CParserInPinImpl;
typedef struct CParserOutPinImpl CParserOutPinImpl;
typedef struct ParserHandlers ParserHandlers;
/* {D51BD5A1-7548-11CF-A520-0080C77EF58A} */
DEFINE_GUID(CLSID_quartzWaveParser,
0xD51BD5A1,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
struct CParserImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
CParserInPinImpl* m_pInPin;
ULONG m_cOutStreams;
CParserOutPinImpl** m_ppOutPins;
CRITICAL_SECTION m_csParser;
IAsyncReader* m_pReader;
IMemAllocator* m_pAllocator;
ALLOCATOR_PROPERTIES m_propAlloc;
HANDLE m_hEventInit;
DWORD m_dwThreadId;
HANDLE m_hThread;
const ParserHandlers* m_pHandler;
void* m_pUserData;
};
struct CParserInPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CParserImpl* pParser;
};
struct CParserOutPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CQualityControlPassThruImpl qcontrol;
CParserImpl* pParser;
ULONG nStreamIndex;
AM_MEDIA_TYPE m_mtOut;
IMemAllocator* m_pOutPinAllocator;
void* m_pUserData;
/* for parser */
BOOL m_bReqUsed;
LONGLONG m_llReqStart;
LONG m_lReqLength;
REFERENCE_TIME m_rtReqStart;
REFERENCE_TIME m_rtReqStop;
};
struct ParserHandlers
{
HRESULT (*pInitParser)( CParserImpl* pImpl, ULONG* pcStreams );
HRESULT (*pUninitParser)( CParserImpl* pImpl );
LPCWSTR (*pGetOutPinName)( CParserImpl* pImpl, ULONG nStreamIndex );
HRESULT (*pGetStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt );
HRESULT (*pCheckStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt );
HRESULT (*pGetAllocProp)( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp );
/* S_OK - ok, S_FALSE - end of stream */
HRESULT (*pGetNextRequest)( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop );
HRESULT (*pProcessSample)( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample );
/* for IQualityControl */
HRESULT (*pQualityNotify)( CParserImpl* pImpl, ULONG nStreamIndex, Quality q );
/* for seeking */
HRESULT (*pGetSeekingCaps)( CParserImpl* pImpl, DWORD* pdwCaps );
HRESULT (*pIsTimeFormatSupported)( CParserImpl* pImpl, const GUID* pTimeFormat );
HRESULT (*pGetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
HRESULT (*pSetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
HRESULT (*pGetDuration)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllDuration );
HRESULT (*pSetDuration)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llDuration );
HRESULT (*pGetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
HRESULT (*pSetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
HRESULT (*pGetPreroll)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPreroll );
HRESULT (*pSetPreroll)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPreroll );
};
#define CParserImpl_THIS(iface,member) CParserImpl* This = ((CParserImpl*)(((char*)iface)-offsetof(CParserImpl,member)))
#define CParserInPinImpl_THIS(iface,member) CParserInPinImpl* This = ((CParserInPinImpl*)(((char*)iface)-offsetof(CParserInPinImpl,member)))
#define CParserOutPinImpl_THIS(iface,member) CParserOutPinImpl* This = ((CParserOutPinImpl*)(((char*)iface)-offsetof(CParserOutPinImpl,member)))
HRESULT QUARTZ_CreateParser(
IUnknown* punkOuter,void** ppobj,
const CLSID* pclsidParser,
LPCWSTR pwszParserName,
LPCWSTR pwszInPinName,
const ParserHandlers* pHandler );
HRESULT QUARTZ_CreateParserInPin(
CParserImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CParserInPinImpl** ppPin,
LPCWSTR pwszPinName );
HRESULT QUARTZ_CreateParserOutPin(
CParserImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CParserOutPinImpl** ppPin,
ULONG nStreamIndex,
LPCWSTR pwszPinName );
#define QUARTZ_TIMEUNITS ((LONGLONG)10000000)
#define PARSER_POLL_INTERVAL 100
#define PARSER_RIFF_OfsFirst 12
#define PARSER_WAVE mmioFOURCC('W','A','V','E')
#define PARSER_AVI mmioFOURCC('A','V','I',' ')
#define PARSER_AVIX mmioFOURCC('A','V','I','X')
#define PARSER_fmt mmioFOURCC('f','m','t',' ')
#define PARSER_fact mmioFOURCC('f','a','c','t')
#define PARSER_data mmioFOURCC('d','a','t','a')
#define PARSER_avih mmioFOURCC('a','v','i','h')
#define PARSER_strl mmioFOURCC('s','t','r','l')
#define PARSER_strh mmioFOURCC('s','t','r','h')
#define PARSER_strf mmioFOURCC('s','t','r','f')
#define PARSER_idx1 mmioFOURCC('i','d','x','1')
#define PARSER_indx mmioFOURCC('i','n','d','x')
#define PARSER_movi mmioFOURCC('m','o','v','i')
#define PARSER_JUNK mmioFOURCC('J','U','N','K')
#define PARSER_vids mmioFOURCC('v','i','d','s')
#define PARSER_auds mmioFOURCC('a','u','d','s')
#define PARSER_mids mmioFOURCC('m','i','d','s')
#define PARSER_txts mmioFOURCC('t','x','t','s')
#define PARSER_LE_UINT16(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8))
#define PARSER_LE_UINT32(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8)|((DWORD)(ptr)[2]<<16)|((DWORD)(ptr)[3]<<24))
#define PARSER_BE_UINT16(ptr) (((DWORD)(ptr)[0]<<8)|((DWORD)(ptr)[1]))
#define PARSER_BE_UINT32(ptr) (((DWORD)(ptr)[0]<<24)|((DWORD)(ptr)[1]<<16)|((DWORD)(ptr)[2]<<8)|((DWORD)(ptr)[3]))
HRESULT QUARTZ_CreateWaveParser(IUnknown* punkOuter,void** ppobj);
#endif /* WINE_DSHOW_PARSER_H */
......@@ -6,7 +6,7 @@ import oleaut32.dll
import ole32.dll
import winmm.dll
import user32.dll
#import gdi32.dll
import gdi32.dll
import advapi32.dll
import kernel32.dll
import ntdll.dll
......
......@@ -25,6 +25,147 @@ DEFAULT_DEBUG_CHANNEL(quartz);
/***************************************************************************
*
* Helper functions
*
*/
HRESULT QUARTZ_IMediaSample_GetProperties(
IMediaSample* pSample,
AM_SAMPLE2_PROPERTIES* pProp )
{
HRESULT hr;
AM_SAMPLE2_PROPERTIES prop;
IMediaSample2* pSample2 = NULL;
ZeroMemory( &prop, sizeof(AM_SAMPLE2_PROPERTIES) );
#if 0 /* not yet */
hr = IMediaSample_QueryInterface( pSample, &IID_IMediaSample2, (void**)&pSample2 );
if ( hr == S_OK )
{
hr = IMediaSample2_GetProperties(pSample2,sizeof(AM_SAMPLE2_PROPERTIES),&prop);
IMediaSample2_Release(pSample2);
if ( hr == S_OK )
{
memcpy( pProp, &prop, sizeof(AM_SAMPLE2_PROPERTIES) );
pProp->pMediaType =
QUARTZ_MediaType_Duplicate( &prop.pMediaType );
return NOERROR;
}
}
#endif
pProp->cbData = sizeof(AM_SAMPLE2_PROPERTIES);
pProp->dwTypeSpecificFlags = 0;
pProp->dwSampleFlags = 0;
if ( IMediaSample_IsSyncPoint(pSample) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_SPLICEPOINT;
if ( IMediaSample_IsPreroll(pSample) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_PREROLL;
if ( IMediaSample_IsDiscontinuity(pSample) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
pProp->lActual = (LONG)IMediaSample_GetActualDataLength(pSample);
if ( IMediaSample_GetTime(pSample,&pProp->tStart,&pProp->tStop) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID;
pProp->dwStreamId = 0;
if ( IMediaSample_GetMediaType(pSample,&(pProp->pMediaType)) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_TYPECHANGED;
IMediaSample_GetPointer(pSample,&(pProp->pbBuffer));
pProp->cbBuffer = (LONG)IMediaSample_GetSize(pSample);
return NOERROR;
}
HRESULT QUARTZ_IMediaSample_SetProperties(
IMediaSample* pSample,
const AM_SAMPLE2_PROPERTIES* pProp )
{
HRESULT hr;
AM_SAMPLE2_PROPERTIES prop;
IMediaSample2* pSample2 = NULL;
memcpy( &prop, pProp, sizeof(AM_SAMPLE2_PROPERTIES) );
prop.cbData = sizeof(AM_SAMPLE2_PROPERTIES);
prop.pbBuffer = NULL;
prop.cbBuffer = 0;
#if 0 /* not yet */
hr = IMediaSample_QueryInterface( pSample, &IID_IMediaSample2, (void**)&pSample2 );
if ( hr == S_OK )
{
hr = IMediaSample2_SetProperties(pSample2,sizeof(AM_SAMPLE2_PROPERTIES),&prop);
IMediaSample2_Release(pSample2);
if ( hr == S_OK )
return NOERROR;
}
#endif
hr = S_OK;
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetSyncPoint(pSample,
(prop.dwSampleFlags & AM_SAMPLE_SPLICEPOINT) ? TRUE : FALSE);
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetPreroll(pSample,
(prop.dwSampleFlags & AM_SAMPLE_PREROLL) ? TRUE : FALSE);
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetDiscontinuity(pSample,
(prop.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) ? TRUE : FALSE);
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetActualDataLength(pSample,prop.lActual);
if ( SUCCEEDED(hr) )
{
if ( ( prop.dwSampleFlags & AM_SAMPLE_TIMEVALID) &&
( prop.dwSampleFlags & AM_SAMPLE_STOPVALID) )
hr = IMediaSample_SetTime(pSample,&prop.tStart,&prop.tStop);
else
hr = IMediaSample_SetTime(pSample,NULL,NULL);
}
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetMediaType(pSample,
(prop.dwSampleFlags & AM_SAMPLE_TYPECHANGED) ?
prop.pMediaType : NULL);
return hr;
}
HRESULT QUARTZ_IMediaSample_Copy(
IMediaSample* pDstSample,
IMediaSample* pSrcSample,
BOOL bCopyData )
{
HRESULT hr;
AM_SAMPLE2_PROPERTIES prop;
BYTE* pDataSrc = NULL;
BYTE* pDataDst = NULL;
hr = QUARTZ_IMediaSample_GetProperties( pSrcSample, &prop );
if ( FAILED(hr) )
return hr;
hr = QUARTZ_IMediaSample_SetProperties( pDstSample, &prop );
if ( prop.pMediaType != NULL )
QUARTZ_MediaType_Destroy( prop.pMediaType );
if ( SUCCEEDED(hr) && bCopyData )
{
hr = IMediaSample_GetPointer(pSrcSample,&pDataSrc);
if ( SUCCEEDED(hr) )
hr = IMediaSample_GetPointer(pDstSample,&pDataDst);
if ( SUCCEEDED(hr) )
{
if ( pDataSrc != NULL && pDataDst != NULL )
memcpy( pDataDst, pDataSrc, prop.lActual );
else
hr = E_FAIL;
}
}
return hr;
}
/***************************************************************************
*
* CMemMediaSample::IMediaSample2
*
*/
......@@ -69,6 +210,12 @@ IMediaSample2_fnRelease(IMediaSample2* iface)
TRACE("(%p)->()\n",This);
if ( This->ref == 0 )
{
ERR("(%p) - released sample!\n",This);
return 0;
}
ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
if ( ref > 0 )
return (ULONG)ref;
......@@ -97,6 +244,12 @@ IMediaSample2_fnGetPointer(IMediaSample2* iface,BYTE** ppData)
TRACE("(%p)->()\n",This);
if ( This->ref == 0 )
{
ERR("(%p) - released sample!\n",This);
return E_UNEXPECTED;
}
if ( ppData == NULL )
return E_POINTER;
......@@ -121,6 +274,12 @@ IMediaSample2_fnGetTime(IMediaSample2* iface,REFERENCE_TIME* prtStart,REFERENCE_
TRACE("(%p)->(%p,%p)\n",This,prtStart,prtEnd);
if ( This->ref == 0 )
{
ERR("(%p) - released sample!\n",This);
return E_UNEXPECTED;
}
if ( prtStart == NULL || prtEnd == NULL )
return E_POINTER;
......@@ -226,7 +385,7 @@ IMediaSample2_fnSetActualDataLength(IMediaSample2* iface,long lLength)
TRACE("(%p)->(%ld)\n",This,lLength);
if ( This->prop.cbBuffer > lLength )
if ( This->prop.cbBuffer < lLength )
return E_INVALIDARG;
This->prop.lActual = lLength;
......
......@@ -31,4 +31,18 @@ HRESULT QUARTZ_CreateMemMediaSample(
void QUARTZ_DestroyMemMediaSample(
CMemMediaSample* pSample );
HRESULT QUARTZ_IMediaSample_GetProperties(
IMediaSample* pSample,
AM_SAMPLE2_PROPERTIES* pProp );
HRESULT QUARTZ_IMediaSample_SetProperties(
IMediaSample* pSample,
const AM_SAMPLE2_PROPERTIES* pProp );
HRESULT QUARTZ_IMediaSample_Copy(
IMediaSample* pDstSample,
IMediaSample* pSrcSample,
BOOL bCopyData );
#endif /* WINE_DSHOW_SAMPLE_H */
/*
* Implements CLSID_VideoRenderer.
*
* hidenori@a2.ctktv.ne.jp
*/
#ifndef WINE_DSHOW_VIDREN_H
#define WINE_DSHOW_VIDREN_H
#include "iunk.h"
#include "basefilt.h"
typedef struct CVideoRendererImpl CVideoRendererImpl;
typedef struct CVideoRendererPinImpl CVideoRendererPinImpl;
typedef struct VidRen_IBasicVideo
{
ICOM_VFIELD(IBasicVideo2);
} VidRen_IBasicVideo;
typedef struct VidRen_IVideoWindow
{
ICOM_VFIELD(IVideoWindow);
} VidRen_IVideoWindow;
struct CVideoRendererImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
VidRen_IBasicVideo basvid;
VidRen_IVideoWindow vidwin;
CVideoRendererPinImpl* pPin;
BOOL m_fInFlush;
/* for rendering */
HANDLE m_hEventInit;
HANDLE m_hThread;
HWND m_hwnd;
CRITICAL_SECTION m_csSample;
BOOL m_bSampleIsValid;
BYTE* m_pSampleData;
DWORD m_cbSampleData;
};
struct CVideoRendererPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CVideoRendererImpl* pRender;
};
#define CVideoRendererImpl_THIS(iface,member) CVideoRendererImpl* This = ((CVideoRendererImpl*)(((char*)iface)-offsetof(CVideoRendererImpl,member)))
#define CVideoRendererPinImpl_THIS(iface,member) CVideoRendererPinImpl* This = ((CVideoRendererPinImpl*)(((char*)iface)-offsetof(CVideoRendererPinImpl,member)))
HRESULT CVideoRendererImpl_InitIBasicVideo2( CVideoRendererImpl* This );
void CVideoRendererImpl_UninitIBasicVideo2( CVideoRendererImpl* This );
HRESULT CVideoRendererImpl_InitIVideoWindow( CVideoRendererImpl* This );
void CVideoRendererImpl_UninitIVideoWindow( CVideoRendererImpl* This );
HRESULT QUARTZ_CreateVideoRenderer(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateVideoRendererPin(
CVideoRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CVideoRendererPinImpl** ppPin);
#endif /* WINE_DSHOW_VIDREN_H */
......@@ -4,12 +4,76 @@
#include "ole2.h"
#include "ddraw.h"
typedef struct IBaseVideoMixer IBaseVideoMixer;
typedef struct IDirectDrawVideo IDirectDrawVideo;
typedef struct IFullScreenVideo IFullScreenVideo;
typedef struct IFullScreenVideoEx IFullScreenVideoEx;
typedef struct IQualProp IQualProp;
#define iEGA_COLORS 16
#define iPALETTE_COLORS 256
#define iMASK_COLORS 3
#define iRED 0
#define iGREEN 1
#define iBLUE 2
#define WIDTHBYTES(bits) ((DWORD)((((DWORD)(bits)+31U)&(~31U))>>3))
#define DIBWIDTHBYTES(bi) ((DWORD)WIDTHBYTES((bi).biWidth*(bi).biBitCount))
#define DIBSIZE(bi) (DIBWIDTHBYTES(bi)*(DWORD)abs((bi).biHeight))
typedef struct
{
DWORD dwBitMasks[iMASK_COLORS];
RGBQUAD bmiColors[iPALETTE_COLORS];
} TRUECOLORINFO;
typedef struct
{
RECT rcSource;
RECT rcTarget;
DWORD dwBitRate;
DWORD dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader;
} VIDEOINFOHEADER;
typedef struct
{
RECT rcSource;
RECT rcTarget;
DWORD dwBitRate;
DWORD dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader;
union {
RGBQUAD bmiColors[iPALETTE_COLORS];
DWORD dwBitMasks[iMASK_COLORS];
TRUECOLORINFO TrueColorInfo;
} DUMMYUNIONNAME;
} VIDEOINFO;
typedef struct
{
VIDEOINFOHEADER hdr;
DWORD dwStartTimeCode;
DWORD cbSequenceHeader;
BYTE bSequenceHeader[1];
} MPEG1VIDEOINFO;
typedef struct
{
RECT rcSource;
RECT rcTarget;
DWORD dwActiveWidth;
DWORD dwActiveHeight;
REFERENCE_TIME AvgTimePerFrame;
} ANALOGVIDEOINFO;
/**************************************************************************
*
* IBaseVideoMixer interface
......
......@@ -328,6 +328,88 @@
"CLSID"="{e30629d1-27e5-11ce-875d-00608cb78066}"
"FriendlyName"="Waveout audio renderer"
# CLSID_VideoRenderer
[HKEY_CLASSES_ROOT\CLSID\{70e102b0-5556-11ce-97c0-00aa0055595a}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{70e102b0-5556-11ce-97c0-00aa0055595a}]
"CLSID"="{70e102b0-5556-11ce-97c0-00aa0055595a}"
"FriendlyName"="Video Renderer"
# Wave Parser
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A1-7548-11CF-A520-0080C77EF58A}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{D51BD5A1-7548-11CF-A520-0080C77EF58A}]
"CLSID"="{D51BD5A1-7548-11CF-A520-0080C77EF58A}"
"FriendlyName"="Wave Parser"
# CLSID_AVIDec(AVI Decompressor) (not implemented yet)
[HKEY_CLASSES_ROOT\CLSID\{CF49D4E0-1115-11CE-B03A-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{CF49D4E0-1115-11CE-B03A-0020AF0BA770}]
"CLSID"="{CF49D4E0-1115-11CE-B03A-0020AF0BA770}"
"FriendlyName"="AVI Decompressor"
# CLSID_AsyncReader (not implemented yet)
[HKEY_CLASSES_ROOT\CLSID\{E436EBB5-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{E436EBB5-524F-11CE-9F53-0020AF0BA770}]
"CLSID"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
"FriendlyName"="Async Reader"
# CLSID_URLReader (not implemented yet)
[HKEY_CLASSES_ROOT\CLSID\{E436EBB6-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{E436EBB6-524F-11CE-9F53-0020AF0BA770}]
"CLSID"="{E436EBB6-524F-11CE-9F53-0020AF0BA770}"
"FriendlyName"="URL Reader"
# CLSID_AviSplitter (not implemented yet)
[HKEY_CLASSES_ROOT\CLSID\{1B544C20-FD0B-11CE-8C63-00AA0044B51E}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{1B544C20-FD0B-11CE-8C63-00AA0044B51E}]
"CLSID"="{1B544C20-FD0B-11CE-8C63-00AA0044B51E}"
"FriendlyName"="AVI Splitter"
# CLSID_QuickTimeParser (not implemented yet)
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A0-7548-11CF-A520-0080C77EF58A}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{D51BD5A0-7548-11CF-A520-0080C77EF58A}]
"CLSID"="{D51BD5A0-7548-11CF-A520-0080C77EF58A}"
"FriendlyName"="QuickTime Movie Parser"
# CLSID_Colour(Color space converter) (not implemented yet)
[HKEY_CLASSES_ROOT\CLSID\{1643E180-90F5-11CE-97D5-00AA0055595A}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{1643E180-90F5-11CE-97D5-00AA0055595A}]
"CLSID"="{1643E180-90F5-11CE-97D5-00AA0055595A}"
"FriendlyName"="Color space converter"
#
# 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