ReactOS  0.4.14-dev-358-gbef841c
waveparser.c File Reference
#include "quartz_private.h"
#include "pin.h"
#include "uuids.h"
#include "aviriff.h"
#include "vfwmsgs.h"
#include "mmsystem.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include <math.h>
#include <assert.h>
#include "parser.h"
Include dependency graph for waveparser.c:

Go to the source code of this file.

Classes

struct  WAVEParserImpl
 

Typedefs

typedef struct WAVEParserImpl WAVEParserImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static WAVEParserImplimpl_from_IMediaSeeking (IMediaSeeking *iface)
 
static WAVEParserImplimpl_from_IBaseFilter (IBaseFilter *iface)
 
static LONGLONG bytepos_to_duration (WAVEParserImpl *This, LONGLONG bytepos)
 
static LONGLONG duration_to_bytepos (WAVEParserImpl *This, LONGLONG duration)
 
static HRESULT WAVEParser_Sample (LPVOID iface, IMediaSample *pSample, DWORD_PTR cookie)
 
static HRESULT WAVEParser_QueryAccept (LPVOID iface, const AM_MEDIA_TYPE *pmt)
 
static HRESULT WINAPI WAVEParserImpl_seek (IMediaSeeking *iface)
 
static HRESULT WAVEParser_InputPin_PreConnect (IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
 
static HRESULT WAVEParser_Cleanup (LPVOID iface)
 
static HRESULT WAVEParser_first_request (LPVOID iface)
 
static HRESULT WAVEParser_disconnect (LPVOID iface)
 
HRESULT WAVEParser_create (IUnknown *pUnkOuter, LPVOID *ppv)
 

Variables

static const WCHAR wcsOutputPinName [] = {'o','u','t','p','u','t',' ','p','i','n',0}
 
static const IBaseFilterVtbl WAVEParser_Vtbl
 

Typedef Documentation

◆ WAVEParserImpl

Function Documentation

◆ bytepos_to_duration()

static LONGLONG bytepos_to_duration ( WAVEParserImpl This,
LONGLONG  bytepos 
)
static

Definition at line 60 of file waveparser.c.

61 {
62  LONGLONG duration = BYTES_FROM_MEDIATIME(bytepos - This->StartOfFile);
63  duration *= 10000000;
64  duration /= This->nAvgBytesPerSec;
65 
66  return duration;
67 }
int64_t LONGLONG
Definition: typedefs.h:66
#define BYTES_FROM_MEDIATIME(time)

Referenced by WAVEParser_InputPin_PreConnect(), WAVEParser_Sample(), and WAVEParserImpl_seek().

◆ duration_to_bytepos()

static LONGLONG duration_to_bytepos ( WAVEParserImpl This,
LONGLONG  duration 
)
static

Definition at line 69 of file waveparser.c.

70 {
71  LONGLONG bytepos;
72 
73  bytepos = This->nAvgBytesPerSec;
74  bytepos *= duration;
75  bytepos /= 10000000;
76  bytepos -= bytepos % This->nBlockAlign;
77  bytepos += BYTES_FROM_MEDIATIME(This->StartOfFile);
78 
79  return MEDIATIME_FROM_BYTES(bytepos);
80 }
int64_t LONGLONG
Definition: typedefs.h:66
#define BYTES_FROM_MEDIATIME(time)
#define MEDIATIME_FROM_BYTES(x)

Referenced by WAVEParserImpl_seek().

◆ impl_from_IBaseFilter()

static WAVEParserImpl* impl_from_IBaseFilter ( IBaseFilter iface)
inlinestatic

Definition at line 55 of file waveparser.c.

56 {
57  return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.filter.IBaseFilter_iface);
58 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by WAVEParser_InputPin_PreConnect().

◆ impl_from_IMediaSeeking()

static WAVEParserImpl* impl_from_IMediaSeeking ( IMediaSeeking iface)
inlinestatic

Definition at line 50 of file waveparser.c.

51 {
52  return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.sourceSeeking.IMediaSeeking_iface);
53 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by WAVEParserImpl_seek().

◆ WAVEParser_Cleanup()

static HRESULT WAVEParser_Cleanup ( LPVOID  iface)
static

Definition at line 339 of file waveparser.c.

340 {
341  WAVEParserImpl *This = iface;
342 
343  TRACE("(%p)->()\n", This);
344 
345  return S_OK;
346 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

Referenced by WAVEParser_create().

◆ WAVEParser_create()

HRESULT WAVEParser_create ( IUnknown pUnkOuter,
LPVOID ppv 
)

Definition at line 419 of file waveparser.c.

420 {
421  HRESULT hr;
423 
424  TRACE("(%p, %p)\n", pUnkOuter, ppv);
425 
426  *ppv = NULL;
427 
428  if (pUnkOuter)
429  return CLASS_E_NOAGGREGATION;
430 
431  /* Note: This memory is managed by the transform filter once created */
433 
435 
436  if (FAILED(hr))
437  return hr;
438 
439  *ppv = &This->Parser.filter.IBaseFilter_iface;
440 
441  return hr;
442 }
static HRESULT WAVEParser_Cleanup(LPVOID iface)
Definition: waveparser.c:339
HRESULT hr
Definition: shlfolder.c:183
static HRESULT WAVEParser_first_request(LPVOID iface)
Definition: waveparser.c:348
REFIID LPVOID * ppv
Definition: atlbase.h:39
static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
Definition: waveparser.c:195
static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample *pSample, DWORD_PTR cookie)
Definition: waveparser.c:82
smooth NULL
Definition: ftsmooth.c:416
static HRESULT WAVEParser_InputPin_PreConnect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
Definition: waveparser.c:244
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
static HRESULT WAVEParser_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE *pmt)
Definition: waveparser.c:184
static const IBaseFilterVtbl WAVEParser_Vtbl
Definition: waveparser.c:400
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)
Definition: parser.c:96
static HRESULT WAVEParser_disconnect(LPVOID iface)
Definition: waveparser.c:394
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

◆ WAVEParser_disconnect()

static HRESULT WAVEParser_disconnect ( LPVOID  iface)
static

Definition at line 394 of file waveparser.c.

395 {
396  /* TODO: Find and plug memory leaks */
397  return S_OK;
398 }
#define S_OK
Definition: intsafe.h:59

Referenced by WAVEParser_create().

◆ WAVEParser_first_request()

static HRESULT WAVEParser_first_request ( LPVOID  iface)
static

Definition at line 348 of file waveparser.c.

349 {
350  WAVEParserImpl *This = iface;
351  PullPin *pin = This->Parser.pInputPin;
352  HRESULT hr;
353  IMediaSample *sample;
354 
355  if (pin->rtCurrent >= pin->rtStop)
356  {
357  /* Last sample has already been queued, request nothing more */
358  TRACE("Done!\n");
359  return S_OK;
360  }
361 
362  hr = IMemAllocator_GetBuffer(pin->pAlloc, &sample, NULL, NULL, 0);
363 
364  pin->rtNext = pin->rtCurrent;
365  if (SUCCEEDED(hr))
366  {
367  LONGLONG rtSampleStart = pin->rtNext;
368  /* Add 4 for the next header, which should hopefully work */
369  LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(sample));
370  Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
371 
372  if (rtSampleStop > pin->rtStop)
373  rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign));
374 
375  IMediaSample_SetTime(sample, &rtSampleStart, &rtSampleStop);
376 
377  pin->rtCurrent = pin->rtNext;
378  pin->rtNext = rtSampleStop;
379 
380  IMediaSample_SetPreroll(sample, FALSE);
381  if (!outpin->dwSamplesProcessed++)
382  IMediaSample_SetDiscontinuity(sample, TRUE);
383  else
384  IMediaSample_SetDiscontinuity(sample, FALSE);
385 
386  hr = IAsyncReader_Request(pin->pReader, sample, 0);
387  }
388  if (FAILED(hr))
389  ERR("Horsemen of the apocalypse came to bring error 0x%08x %p\n", hr, sample);
390 
391  return hr;
392 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
Definition: regsvr.c:103
Definition: pin.h:70
smooth NULL
Definition: ftsmooth.c:416
#define ALIGNUP(value, boundary)
Definition: pin.c:33
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define BYTES_FROM_MEDIATIME(time)
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static Parser_OutputPin * unsafe_impl_Parser_OutputPin_from_IPin(IPin *iface)
Definition: parser.h:81
#define MEDIATIME_FROM_BYTES(x)
LONGLONG dwSamplesProcessed
Definition: parser.h:49
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by WAVEParser_create().

◆ WAVEParser_InputPin_PreConnect()

static HRESULT WAVEParser_InputPin_PreConnect ( IPin iface,
IPin pConnectPin,
ALLOCATOR_PROPERTIES props 
)
static

Definition at line 244 of file waveparser.c.

245 {
247  HRESULT hr;
248  RIFFLIST list;
250  LONGLONG pos = 0; /* in bytes */
251  PIN_INFO piOutput;
252  AM_MEDIA_TYPE amt;
253  WAVEParserImpl * pWAVEParser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
254 
255  piOutput.dir = PINDIR_OUTPUT;
256  piOutput.pFilter = &pWAVEParser->Parser.filter.IBaseFilter_iface;
257  lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]));
258 
259  hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
260  pos += sizeof(list);
261 
262  if (list.fcc != FOURCC_RIFF)
263  {
264  ERR("Input stream not a RIFF file\n");
265  return E_FAIL;
266  }
267  if (list.cb > 1 * 1024 * 1024 * 1024) /* cannot be more than 1Gb in size */
268  {
269  ERR("Input stream violates RIFF spec\n");
270  return E_FAIL;
271  }
272  if (list.fccListType != mmioFOURCC('W','A','V','E'))
273  {
274  ERR("Input stream not an WAVE RIFF file\n");
275  return E_FAIL;
276  }
277 
278  hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(chunk), (BYTE *)&chunk);
279  pos += sizeof(chunk);
280  if (chunk.fcc != mmioFOURCC('f','m','t',' '))
281  {
282  ERR("Expected 'fmt ' chunk, but got %.04s\n", (LPSTR)&chunk.fcc);
283  return E_FAIL;
284  }
285 
286  amt.majortype = MEDIATYPE_Audio;
287  amt.formattype = FORMAT_WaveFormatEx;
288  amt.cbFormat = chunk.cb;
289  amt.pbFormat = CoTaskMemAlloc(amt.cbFormat);
290  amt.pUnk = NULL;
291  IAsyncReader_SyncRead(This->pReader, pos, amt.cbFormat, amt.pbFormat);
292  amt.subtype = MEDIATYPE_Audio;
293  amt.subtype.Data1 = ((WAVEFORMATEX*)amt.pbFormat)->wFormatTag;
294 
295  pos += chunk.cb;
296  hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(chunk), (BYTE *)&chunk);
297  if (chunk.fcc == mmioFOURCC('f','a','c','t'))
298  {
299  FIXME("'fact' chunk not supported yet\n");
300  pos += sizeof(chunk) + chunk.cb;
301  hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(chunk), (BYTE *)&chunk);
302  }
303  if (chunk.fcc != mmioFOURCC('d','a','t','a'))
304  {
305  ERR("Expected 'data' chunk, but got %.04s\n", (LPSTR)&chunk.fcc);
306  return E_FAIL;
307  }
308 
309  if (hr == S_OK)
310  {
311  pWAVEParser->StartOfFile = MEDIATIME_FROM_BYTES(pos + sizeof(RIFFCHUNK));
312  pWAVEParser->EndOfFile = MEDIATIME_FROM_BYTES(pos + chunk.cb + sizeof(RIFFCHUNK));
313  }
314 
315  if (hr != S_OK)
316  return E_FAIL;
317 
318  props->cbAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
319  props->cbPrefix = 0;
320  props->cbBuffer = 4096;
321  props->cBuffers = 3;
322  pWAVEParser->nBlockAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
323  pWAVEParser->nAvgBytesPerSec = ((WAVEFORMATEX*)amt.pbFormat)->nAvgBytesPerSec;
324  hr = Parser_AddPin(&(pWAVEParser->Parser), &piOutput, props, &amt);
325  CoTaskMemFree(amt.pbFormat);
326 
327  pWAVEParser->Parser.sourceSeeking.llCurrent = 0;
328  pWAVEParser->Parser.sourceSeeking.llStop = pWAVEParser->Parser.sourceSeeking.llDuration = bytepos_to_duration(pWAVEParser, pWAVEParser->EndOfFile);
329  TRACE("Duration: %u seconds\n", (DWORD)(pWAVEParser->Parser.sourceSeeking.llDuration / (LONGLONG)10000000));
330 
331  This->rtStop = pWAVEParser->EndOfFile;
332  This->rtStart = pWAVEParser->StartOfFile;
333 
334  TRACE("WAVE File ok\n");
335 
336  return hr;
337 }
static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
Definition: waveparser.c:60
DWORD nBlockAlign
Definition: waveparser.c:47
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
LONGLONG llStop
Definition: strmbase.h:284
LONGLONG StartOfFile
Definition: waveparser.c:44
char * LPSTR
Definition: xmlstorage.h:182
#define E_FAIL
Definition: ddrawi.h:102
static PullPin * impl_PullPin_from_IPin(IPin *iface)
Definition: pin.h:132
#define lstrcpynW
Definition: compat.h:405
Definition: pin.h:70
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR wcsOutputPinName[]
Definition: waveparser.c:39
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
DWORD nAvgBytesPerSec
Definition: waveparser.c:46
BaseFilter filter
Definition: parser.h:33
unsigned long DWORD
Definition: ntddk_ex.h:95
LONGLONG llDuration
Definition: strmbase.h:284
HRESULT Parser_AddPin(ParserImpl *This, const PIN_INFO *piOutput, ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *amt)
Definition: parser.c:446
ParserImpl Parser
Definition: waveparser.c:43
#define FOURCC_RIFF
Definition: mmsystem.h:564
IBaseFilter IBaseFilter_iface
Definition: strmbase.h:163
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
unsigned char BYTE
Definition: mem.h:68
Definition: _list.h:228
LONGLONG llCurrent
Definition: strmbase.h:284
static WAVEParserImpl * impl_from_IBaseFilter(IBaseFilter *iface)
Definition: waveparser.c:55
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define list
Definition: rosglue.h:35
SourceSeeking sourceSeeking
Definition: parser.h:41
static const WCHAR props[]
Definition: wbemdisp.c:288
#define MEDIATIME_FROM_BYTES(x)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
LONGLONG EndOfFile
Definition: waveparser.c:45

Referenced by WAVEParser_create().

◆ WAVEParser_QueryAccept()

static HRESULT WAVEParser_QueryAccept ( LPVOID  iface,
const AM_MEDIA_TYPE pmt 
)
static

Definition at line 184 of file waveparser.c.

185 {
186  if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Stream))
187  return S_FALSE;
188  if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_WAVE))
189  return S_OK;
190  if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_AU) || IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_AIFF))
191  FIXME("AU and AIFF files not supported yet!\n");
192  return S_FALSE;
193 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by WAVEParser_create().

◆ WAVEParser_Sample()

static HRESULT WAVEParser_Sample ( LPVOID  iface,
IMediaSample pSample,
DWORD_PTR  cookie 
)
static

Definition at line 82 of file waveparser.c.

83 {
84  WAVEParserImpl *This = iface;
85  LPBYTE pbSrcStream = NULL;
86  ULONG cbSrcStream = 0;
87  REFERENCE_TIME tStart, tStop;
88  HRESULT hr;
89  IMediaSample *newsample = NULL;
90  Parser_OutputPin *pOutputPin;
91  PullPin *pin = This->Parser.pInputPin;
92 
93  IMediaSample_GetPointer(pSample, &pbSrcStream);
94  hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
95 
96  cbSrcStream = IMediaSample_GetActualDataLength(pSample);
97 
98  /* Flush occurring */
99  if (cbSrcStream == 0)
100  {
101  TRACE(".. Why do I need you?\n");
102  return S_OK;
103  }
104 
105  pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
106 
107  if (SUCCEEDED(hr))
108  hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0);
109 
110  if (SUCCEEDED(hr))
111  {
112  LONGLONG rtSampleStart = pin->rtNext;
113  /* Add 4 for the next header, which should hopefully work */
114  LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(newsample));
115 
116  if (rtSampleStop > pin->rtStop)
117  rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign));
118 
119  IMediaSample_SetTime(newsample, &rtSampleStart, &rtSampleStop);
120 
121  pin->rtCurrent = pin->rtNext;
122  pin->rtNext = rtSampleStop;
123 
124  IMediaSample_SetPreroll(newsample, FALSE);
125  IMediaSample_SetDiscontinuity(newsample, FALSE);
126  IMediaSample_SetSyncPoint(newsample, TRUE);
127 
128  hr = IAsyncReader_Request(pin->pReader, newsample, 0);
129  }
130 
131  if (SUCCEEDED(hr))
132  {
133  REFERENCE_TIME tAviStart, tAviStop;
134 
135  IMediaSample_SetSyncPoint(pSample, TRUE);
136  pOutputPin->dwSamplesProcessed++;
137 
138  tAviStart = bytepos_to_duration(This, tStart);
139  tAviStop = bytepos_to_duration(This, tStart + MEDIATIME_FROM_BYTES(IMediaSample_GetActualDataLength(pSample)));
140 
141  IMediaSample_SetTime(pSample, &tAviStart, &tAviStop);
142 
143  hr = BaseOutputPinImpl_Deliver(&pOutputPin->pin, pSample);
144  if (hr != S_OK && hr != S_FALSE && hr != VFW_E_WRONG_STATE)
145  ERR("Error sending sample (%x)\n", hr);
146  else if (hr != S_OK)
147  /* Unset progression if denied! */
148  This->Parser.pInputPin->rtCurrent = tStart;
149  }
150 
151  if (tStop >= This->EndOfFile || (bytepos_to_duration(This, tStop) >= This->Parser.sourceSeeking.llStop) || hr == VFW_E_NOT_CONNECTED)
152  {
153  unsigned int i;
154 
155  TRACE("End of file reached\n");
156 
157  for (i = 0; i < This->Parser.cStreams; i++)
158  {
159  IPin* ppin;
160  HRESULT hr;
161 
162  TRACE("Send End Of Stream to output pin %u\n", i);
163 
164  hr = IPin_ConnectedTo(This->Parser.ppPins[i+1], &ppin);
165  if (SUCCEEDED(hr))
166  {
167  hr = IPin_EndOfStream(ppin);
168  IPin_Release(ppin);
169  }
170  if (FAILED(hr))
171  {
172  ERR("%x\n", hr);
173  break;
174  }
175  }
176 
177  /* Force the pullpin thread to stop */
178  hr = S_FALSE;
179  }
180 
181  return hr;
182 }
#define TRUE
Definition: types.h:120
static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
Definition: waveparser.c:60
HRESULT hr
Definition: shlfolder.c:183
BaseOutputPin pin
Definition: parser.h:46
Definition: regsvr.c:103
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
Definition: glfuncs.h:248
Definition: pin.h:70
unsigned char * LPBYTE
Definition: typedefs.h:52
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define ALIGNUP(value, boundary)
Definition: pin.c:33
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
LONG HRESULT
Definition: typedefs.h:77
#define BYTES_FROM_MEDIATIME(time)
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static Parser_OutputPin * unsafe_impl_Parser_OutputPin_from_IPin(IPin *iface)
Definition: parser.h:81
Definition: axcore.idl:91
HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample *pSample)
Definition: pin.c:574
unsigned int ULONG
Definition: retypes.h:1
#define MEDIATIME_FROM_BYTES(x)
#define VFW_E_WRONG_STATE
Definition: vfwmsgs.h:78
LONGLONG dwSamplesProcessed
Definition: parser.h:49
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by WAVEParser_create().

◆ WAVEParserImpl_seek()

static HRESULT WINAPI WAVEParserImpl_seek ( IMediaSeeking iface)
static

Definition at line 195 of file waveparser.c.

196 {
198  PullPin *pPin = This->Parser.pInputPin;
199  IPin *victim = NULL;
200  LONGLONG newpos, curpos, endpos, bytepos;
201 
202  newpos = This->Parser.sourceSeeking.llCurrent;
203  curpos = bytepos_to_duration(This, pPin->rtCurrent);
204  endpos = bytepos_to_duration(This, This->EndOfFile);
205  bytepos = duration_to_bytepos(This, newpos);
206 
207  if (newpos > endpos)
208  {
209  WARN("Requesting position %x%08x beyond end of stream %x%08x\n", (DWORD)(newpos>>32), (DWORD)newpos, (DWORD)(endpos>>32), (DWORD)endpos);
210  return E_INVALIDARG;
211  }
212 
213  if (curpos/1000000 == newpos/1000000)
214  {
215  TRACE("Requesting position %x%08x same as current position %x%08x\n", (DWORD)(newpos>>32), (DWORD)newpos, (DWORD)(curpos>>32), (DWORD)curpos);
216  return S_OK;
217  }
218 
219  TRACE("Moving sound to %08u bytes!\n", (DWORD)BYTES_FROM_MEDIATIME(bytepos));
220 
222  IPin_BeginFlush(&pPin->pin.IPin_iface);
223 
224  /* Make sure this is done while stopped, BeginFlush takes care of this */
225  EnterCriticalSection(&This->Parser.filter.csFilter);
226  IPin_ConnectedTo(This->Parser.ppPins[1], &victim);
227  if (victim)
228  {
229  IPin_NewSegment(victim, newpos, endpos, pPin->dRate);
230  IPin_Release(victim);
231  }
232 
233  pPin->rtStart = pPin->rtCurrent = bytepos;
235  LeaveCriticalSection(&This->Parser.filter.csFilter);
236 
237  TRACE("Done flushing\n");
238  IPin_EndFlush(&pPin->pin.IPin_iface);
240 
241  return S_OK;
242 }
static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
Definition: waveparser.c:60
IPin IPin_iface
Definition: strmbase.h:35
static LONGLONG duration_to_bytepos(WAVEParserImpl *This, LONGLONG duration)
Definition: waveparser.c:69
#define WARN(fmt,...)
Definition: debug.h:111
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
REFERENCE_TIME rtCurrent
Definition: pin.h:76
Definition: pin.h:70
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
CRITICAL_SECTION thread_lock
Definition: pin.h:94
int64_t LONGLONG
Definition: typedefs.h:66
#define TRACE(s)
Definition: solgame.cpp:4
REFERENCE_TIME rtStart
Definition: pin.h:76
unsigned long DWORD
Definition: ntddk_ex.h:95
BasePin pin
Definition: pin.h:73
#define BYTES_FROM_MEDIATIME(time)
static WAVEParserImpl * impl_from_IMediaSeeking(IMediaSeeking *iface)
Definition: waveparser.c:50
#define S_OK
Definition: intsafe.h:59
static Parser_OutputPin * unsafe_impl_Parser_OutputPin_from_IPin(IPin *iface)
Definition: parser.h:81
Definition: axcore.idl:91
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
double dRate
Definition: pin.h:86
LONGLONG dwSamplesProcessed
Definition: parser.h:49

Referenced by WAVEParser_create().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ WAVEParser_Vtbl

const IBaseFilterVtbl WAVEParser_Vtbl
static
Initial value:
=
{
}
HRESULT WINAPI Parser_Pause(IBaseFilter *iface)
Definition: parser.c:279
HRESULT WINAPI Parser_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID *ppv)
Definition: parser.c:142
HRESULT WINAPI Parser_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
Definition: parser.c:313
HRESULT WINAPI Parser_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *pGraph, LPCWSTR pName)
Definition: parser.c:424
HRESULT WINAPI Parser_GetSyncSource(IBaseFilter *iface, IReferenceClock **ppClock)
Definition: parser.c:397
HRESULT WINAPI Parser_FindPin(IBaseFilter *iface, LPCWSTR Id, IPin **ppPin)
Definition: parser.c:409
HRESULT WINAPI Parser_EnumPins(IBaseFilter *iface, IEnumPins **ppEnum)
Definition: parser.c:404
ULONG WINAPI Parser_Release(IBaseFilter *iface)
Definition: parser.c:213
HRESULT WINAPI Parser_Stop(IBaseFilter *iface)
Definition: parser.c:241
HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter *iface, LPWSTR *pVendorInfo)
Definition: parser.c:429
HRESULT WINAPI Parser_GetState(IBaseFilter *iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
Definition: parser.c:361
HRESULT WINAPI Parser_SetSyncSource(IBaseFilter *iface, IReferenceClock *pClock)
Definition: parser.c:383
HRESULT WINAPI Parser_GetClassID(IBaseFilter *iface, CLSID *pClsid)
Definition: parser.c:228
ULONG WINAPI Parser_AddRef(IBaseFilter *iface)
Definition: parser.c:171
HRESULT WINAPI Parser_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *pInfo)
Definition: parser.c:419

Definition at line 400 of file waveparser.c.

Referenced by WAVEParser_create().

◆ wcsOutputPinName

const WCHAR wcsOutputPinName[] = {'o','u','t','p','u','t',' ','p','i','n',0}
static

Definition at line 39 of file waveparser.c.

Referenced by createtestfilter(), and WAVEParser_InputPin_PreConnect().