29#include "wine/unicode.h"
39static const WCHAR wcsOutputPinName[] = {
'o',
'u',
't',
'p',
'u',
't',
' ',
'p',
'i',
'n',0};
64 duration /=
This->nAvgBytesPerSec;
73 bytepos =
This->nAvgBytesPerSec;
76 bytepos -= bytepos %
This->nBlockAlign;
86 ULONG cbSrcStream = 0;
93 IMediaSample_GetPointer(pSample, &pbSrcStream);
94 hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
96 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
101 TRACE(
".. Why do I need you?\n");
108 hr = IMemAllocator_GetBuffer(
pin->pAlloc, &newsample,
NULL,
NULL, 0);
116 if (rtSampleStop >
pin->rtStop)
119 IMediaSample_SetTime(newsample, &rtSampleStart, &rtSampleStop);
121 pin->rtCurrent =
pin->rtNext;
122 pin->rtNext = rtSampleStop;
124 IMediaSample_SetPreroll(newsample,
FALSE);
125 IMediaSample_SetDiscontinuity(newsample,
FALSE);
126 IMediaSample_SetSyncPoint(newsample,
TRUE);
128 hr = IAsyncReader_Request(
pin->pReader, newsample, 0);
135 IMediaSample_SetSyncPoint(pSample,
TRUE);
141 IMediaSample_SetTime(pSample, &tAviStart, &tAviStop);
145 ERR(
"Error sending sample (%x)\n",
hr);
148 This->Parser.pInputPin->rtCurrent = tStart;
155 TRACE(
"End of file reached\n");
157 for (
i = 0;
i <
This->Parser.cStreams;
i++)
162 TRACE(
"Send End Of Stream to output pin %u\n",
i);
164 hr = IPin_ConnectedTo(
This->Parser.ppPins[
i+1], &ppin);
167 hr = IPin_EndOfStream(ppin);
186 if (!
IsEqualIID(&pmt->majortype, &MEDIATYPE_Stream))
188 if (
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_WAVE))
190 if (
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_AU) ||
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_AIFF))
191 FIXME(
"AU and AIFF files not supported yet!\n");
200 LONGLONG newpos, curpos, endpos, bytepos;
202 newpos =
This->Parser.sourceSeeking.llCurrent;
209 WARN(
"Requesting position %x%08x beyond end of stream %x%08x\n", (
DWORD)(newpos>>32), (
DWORD)newpos, (
DWORD)(endpos>>32), (
DWORD)endpos);
213 if (curpos/1000000 == newpos/1000000)
215 TRACE(
"Requesting position %x%08x same as current position %x%08x\n", (
DWORD)(newpos>>32), (
DWORD)newpos, (
DWORD)(curpos>>32), (
DWORD)curpos);
226 IPin_ConnectedTo(
This->Parser.ppPins[1], &victim);
229 IPin_NewSegment(victim, newpos, endpos, pPin->
dRate);
230 IPin_Release(victim);
237 TRACE(
"Done flushing\n");
264 ERR(
"Input stream not a RIFF file\n");
267 if (
list.cb > 1 * 1024 * 1024 * 1024)
269 ERR(
"Input stream violates RIFF spec\n");
274 ERR(
"Input stream not an WAVE RIFF file\n");
282 ERR(
"Expected 'fmt ' chunk, but got %.04s\n", (
LPSTR)&
chunk.fcc);
286 amt.majortype = MEDIATYPE_Audio;
287 amt.formattype = FORMAT_WaveFormatEx;
288 amt.cbFormat =
chunk.cb;
291 IAsyncReader_SyncRead(
This->pReader,
pos, amt.cbFormat, amt.pbFormat);
292 amt.subtype = MEDIATYPE_Audio;
293 amt.subtype.Data1 = ((
WAVEFORMATEX*)amt.pbFormat)->wFormatTag;
299 FIXME(
"'fact' chunk not supported yet\n");
305 ERR(
"Expected 'data' chunk, but got %.04s\n", (
LPSTR)&
chunk.fcc);
320 props->cbBuffer = 4096;
334 TRACE(
"WAVE File ok\n");
355 if (
pin->rtCurrent >=
pin->rtStop)
362 hr = IMemAllocator_GetBuffer(
pin->pAlloc, &sample,
NULL,
NULL, 0);
364 pin->rtNext =
pin->rtCurrent;
372 if (rtSampleStop >
pin->rtStop)
375 IMediaSample_SetTime(sample, &rtSampleStart, &rtSampleStop);
377 pin->rtCurrent =
pin->rtNext;
378 pin->rtNext = rtSampleStop;
380 IMediaSample_SetPreroll(sample,
FALSE);
382 IMediaSample_SetDiscontinuity(sample,
TRUE);
384 IMediaSample_SetDiscontinuity(sample,
FALSE);
386 hr = IAsyncReader_Request(
pin->pReader, sample, 0);
389 ERR(
"Horsemen of the apocalypse came to bring error 0x%08x %p\n",
hr, sample);
424 TRACE(
"(%p, %p)\n", pUnkOuter,
ppv);
434 hr =
Parser_Create(&(
This->Parser), &
WAVEParser_Vtbl, &CLSID_WAVEParser,
WAVEParser_Sample,
WAVEParser_QueryAccept,
WAVEParser_InputPin_PreConnect,
WAVEParser_Cleanup,
WAVEParser_disconnect,
WAVEParser_first_request,
NULL,
NULL,
WAVEParserImpl_seek,
NULL);
439 *
ppv = &
This->Parser.filter.IBaseFilter_iface;
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
HRESULT WINAPI Parser_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *pInfo)
HRESULT WINAPI Parser_GetClassID(IBaseFilter *iface, CLSID *pClsid)
HRESULT WINAPI Parser_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
HRESULT WINAPI Parser_Pause(IBaseFilter *iface)
HRESULT WINAPI Parser_Stop(IBaseFilter *iface)
ULONG WINAPI Parser_AddRef(IBaseFilter *iface)
HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter *iface, LPWSTR *pVendorInfo)
HRESULT Parser_AddPin(ParserImpl *This, const PIN_INFO *piOutput, ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *amt)
HRESULT WINAPI Parser_GetState(IBaseFilter *iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *Parser_Vtbl, const CLSID *pClsid, PFN_PROCESS_SAMPLE fnProcessSample, PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect, PFN_CLEANUP fnCleanup, PFN_DISCONNECT fnDisconnect, REQUESTPROC fnRequest, STOPPROCESSPROC fnDone, SourceSeeking_ChangeStop stop, SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate)
HRESULT WINAPI Parser_GetSyncSource(IBaseFilter *iface, IReferenceClock **ppClock)
ULONG WINAPI Parser_Release(IBaseFilter *iface)
HRESULT WINAPI Parser_EnumPins(IBaseFilter *iface, IEnumPins **ppEnum)
HRESULT WINAPI Parser_SetSyncSource(IBaseFilter *iface, IReferenceClock *pClock)
HRESULT WINAPI Parser_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID *ppv)
HRESULT WINAPI Parser_FindPin(IBaseFilter *iface, LPCWSTR Id, IPin **ppPin)
HRESULT WINAPI Parser_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *pGraph, LPCWSTR pName)
static Parser_OutputPin * unsafe_impl_Parser_OutputPin_from_IPin(IPin *iface)
#define ALIGNUP(value, boundary)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
#define mmioFOURCC(c0, c1, c2, c3)
static PullPin * impl_PullPin_from_IPin(IPin *iface)
#define IsEqualIID(riid1, riid2)
#define MEDIATIME_FROM_BYTES(x)
#define BYTES_FROM_MEDIATIME(time)
HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample *pSample)
IBaseFilter IBaseFilter_iface
SourceSeeking sourceSeeking
LONGLONG dwSamplesProcessed
CRITICAL_SECTION thread_lock
#define CONTAINING_RECORD(address, type, field)
#define VFW_E_WRONG_STATE
#define VFW_E_NOT_CONNECTED
static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample *pSample, DWORD_PTR cookie)
static HRESULT WAVEParser_disconnect(LPVOID iface)
static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
static HRESULT WAVEParser_Cleanup(LPVOID iface)
static HRESULT WAVEParser_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE *pmt)
static WAVEParserImpl * impl_from_IMediaSeeking(IMediaSeeking *iface)
static const WCHAR wcsOutputPinName[]
static const IBaseFilterVtbl WAVEParser_Vtbl
HRESULT WAVEParser_create(IUnknown *pUnkOuter, LPVOID *ppv)
static HRESULT WAVEParser_first_request(LPVOID iface)
static LONGLONG duration_to_bytepos(WAVEParserImpl *This, LONGLONG duration)
static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
static WAVEParserImpl * impl_from_IBaseFilter(IBaseFilter *iface)
static HRESULT WAVEParser_InputPin_PreConnect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
static const WCHAR props[]
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define CLASS_E_NOAGGREGATION