ReactOS 0.4.17-dev-934-g091855f
acmwrapper.c File Reference
#include "quartz_private.h"
#include "uuids.h"
#include "mmreg.h"
#include "windef.h"
#include "winbase.h"
#include "dshow.h"
#include "strmif.h"
#include "vfwmsgs.h"
#include "msacm.h"
#include <assert.h>
#include "wine/debug.h"
Include dependency graph for acmwrapper.c:

Go to the source code of this file.

Classes

struct  acm_wrapper
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static struct acm_wrapper * impl_from_strmbase_filter (struct strmbase_filter *iface)
 
static HRESULT acm_wrapper_sink_query_interface (struct strmbase_pin *iface, REFIID iid, void **out)
 
static HRESULT acm_wrapper_sink_query_accept (struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI acm_wrapper_sink_Receive (struct strmbase_sink *iface, IMediaSample *pSample)
 
static BOOL is_audio_subtype (const GUID *guid)
 
static HRESULT acm_wrapper_sink_connect (struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
 
static void acm_wrapper_sink_disconnect (struct strmbase_sink *iface)
 
static HRESULT acm_wrapper_source_query_interface (struct strmbase_pin *iface, REFIID iid, void **out)
 
static HRESULT acm_wrapper_source_query_accept (struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
 
static HRESULT acm_wrapper_source_get_media_type (struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI acm_wrapper_source_DecideBufferSize (struct strmbase_source *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
 
static struct acm_wrapper * impl_from_source_IQualityControl (IQualityControl *iface)
 
static HRESULT WINAPI acm_wrapper_source_qc_QueryInterface (IQualityControl *iface, REFIID iid, void **out)
 
static ULONG WINAPI acm_wrapper_source_qc_AddRef (IQualityControl *iface)
 
static ULONG WINAPI acm_wrapper_source_qc_Release (IQualityControl *iface)
 
static HRESULT WINAPI acm_wrapper_source_qc_Notify (IQualityControl *iface, IBaseFilter *sender, Quality q)
 
static HRESULT WINAPI acm_wrapper_source_qc_SetSink (IQualityControl *iface, IQualityControl *sink)
 
static struct strmbase_pin * acm_wrapper_get_pin (struct strmbase_filter *iface, unsigned int index)
 
static void acm_wrapper_destroy (struct strmbase_filter *iface)
 
static HRESULT acm_wrapper_init_stream (struct strmbase_filter *iface)
 
static HRESULT acm_wrapper_cleanup_stream (struct strmbase_filter *iface)
 
HRESULT acm_wrapper_create (IUnknown *outer, IUnknown **out)
 

Variables

static const struct strmbase_sink_ops sink_ops
 
static const struct strmbase_source_ops source_ops
 
static const IQualityControlVtbl source_qc_vtbl
 
static const struct strmbase_filter_ops filter_ops
 

Function Documentation

◆ acm_wrapper_cleanup_stream()

static HRESULT acm_wrapper_cleanup_stream ( struct strmbase_filter *  iface)
static

Definition at line 496 of file acmwrapper.c.

497{
499
500 if (filter->source.pin.peer)
501 IMemAllocator_Decommit(filter->source.pAllocator);
502 return S_OK;
503}
static struct acm_wrapper * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: acmwrapper.c:57
#define S_OK
Definition: intsafe.h:52
Definition: filter.c:165

◆ acm_wrapper_create()

HRESULT acm_wrapper_create ( IUnknown *  outer,
IUnknown **  out 
)

Definition at line 513 of file acmwrapper.c.

514{
515 struct acm_wrapper *object;
516
517 if (!(object = calloc(1, sizeof(*object))))
518 return E_OUTOFMEMORY;
519
520 strmbase_filter_init(&object->filter, outer, &CLSID_ACMWrapper, &filter_ops);
521
522 strmbase_sink_init(&object->sink, &object->filter, L"In", &sink_ops, NULL);
523 wcscpy(object->sink.pin.name, L"Input");
524
525 strmbase_source_init(&object->source, &object->filter, L"Out", &source_ops);
526 wcscpy(object->source.pin.name, L"Output");
527
528 object->source_IQualityControl_iface.lpVtbl = &source_qc_vtbl;
529 strmbase_passthrough_init(&object->passthrough, (IUnknown *)&object->source.pin.IPin_iface);
530 ISeekingPassThru_Init(&object->passthrough.ISeekingPassThru_iface, FALSE,
531 &object->sink.pin.IPin_iface);
532
533 object->lasttime_real = object->lasttime_sent = -1;
534
535 TRACE("Created ACM wrapper %p.\n", object);
536 *out = &object->filter.IUnknown_inner;
537
538 return S_OK;
539}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
static const IQualityControlVtbl source_qc_vtbl
Definition: acmwrapper.c:445
static const struct strmbase_source_ops source_ops
Definition: acmwrapper.c:378
static const struct strmbase_sink_ops sink_ops
Definition: acmwrapper.c:314
static const struct strmbase_filter_ops filter_ops
Definition: acmwrapper.c:505
#define L(x)
Definition: resources.c:13
static IUnknown * outer
Definition: compobj.c:82
#define calloc
Definition: rosglue.h:14
wcscpy
#define TRACE(s)
Definition: solgame.cpp:4
void strmbase_source_init(struct strmbase_source *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_source_ops *func_table)
Definition: pin.c:765
void strmbase_sink_init(struct strmbase_sink *pin, struct strmbase_filter *filter, const WCHAR *name, const struct strmbase_sink_ops *ops, IMemAllocator *allocator)
Definition: pin.c:1168
void strmbase_passthrough_init(struct strmbase_passthrough *passthrough, IUnknown *outer)
Definition: pospass.c:725
void strmbase_filter_init(struct strmbase_filter *filter, IUnknown *outer, const CLSID *clsid, const struct strmbase_filter_ops *func_table)
Definition: filter.c:517
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ acm_wrapper_destroy()

static void acm_wrapper_destroy ( struct strmbase_filter *  iface)
static

Definition at line 465 of file acmwrapper.c.

466{
468
469 if (filter->sink.pin.peer)
470 IPin_Disconnect(filter->sink.pin.peer);
471 IPin_Disconnect(&filter->sink.pin.IPin_iface);
472
473 if (filter->source.pin.peer)
474 IPin_Disconnect(filter->source.pin.peer);
475 IPin_Disconnect(&filter->source.pin.IPin_iface);
476
480
481 FreeMediaType(&filter->mt);
483 free(filter);
484}
#define free
Definition: debug_ros.c:5
void WINAPI FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:165
void strmbase_passthrough_cleanup(struct strmbase_passthrough *passthrough)
Definition: pospass.c:738
void strmbase_sink_cleanup(struct strmbase_sink *pin)
Definition: pin.c:1185
void strmbase_filter_cleanup(struct strmbase_filter *filter)
Definition: filter.c:540
void strmbase_source_cleanup(struct strmbase_source *pin)
Definition: pin.c:778
IBaseFilter * filter
Definition: filtergraph.c:75

◆ acm_wrapper_get_pin()

static struct strmbase_pin * acm_wrapper_get_pin ( struct strmbase_filter *  iface,
unsigned int  index 
)
static

Definition at line 454 of file acmwrapper.c.

455{
457
458 if (index == 0)
459 return &filter->sink.pin;
460 else if (index == 1)
461 return &filter->source.pin;
462 return NULL;
463}
GLuint index
Definition: glext.h:6031

◆ acm_wrapper_init_stream()

static HRESULT acm_wrapper_init_stream ( struct strmbase_filter *  iface)
static

Definition at line 486 of file acmwrapper.c.

487{
489 HRESULT hr;
490
491 if (filter->source.pin.peer && FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
492 ERR("Failed to commit allocator, hr %#lx.\n", hr);
493 return S_OK;
494}
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT hr
Definition: delayimp.cpp:582
#define FAILED(hr)
Definition: intsafe.h:51

◆ acm_wrapper_sink_connect()

static HRESULT acm_wrapper_sink_connect ( struct strmbase_sink *  iface,
IPin *  peer,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 270 of file acmwrapper.c.

271{
272 struct acm_wrapper *filter = impl_from_strmbase_filter(iface->pin.filter);
273 const WAVEFORMATEX *wfx = (WAVEFORMATEX *)mt->pbFormat;
274 HACMSTREAM drv;
276
277 if (!IsEqualGUID(&mt->majortype, &MEDIATYPE_Audio) || !is_audio_subtype(&mt->subtype)
278 || !IsEqualGUID(&mt->formattype, &FORMAT_WaveFormatEx) || !wfx
281
282 CopyMediaType(&filter->mt, mt);
283 filter->mt.subtype.Data1 = WAVE_FORMAT_PCM;
284 filter->pWfOut = (WAVEFORMATEX *)filter->mt.pbFormat;
285 filter->pWfOut->wFormatTag = WAVE_FORMAT_PCM;
286 filter->pWfOut->wBitsPerSample = 16;
287 filter->pWfOut->nBlockAlign = filter->pWfOut->wBitsPerSample * filter->pWfOut->nChannels / 8;
288 filter->pWfOut->cbSize = 0;
289 filter->pWfOut->nAvgBytesPerSec = filter->pWfOut->nChannels * filter->pWfOut->nSamplesPerSec
290 * (filter->pWfOut->wBitsPerSample / 8);
291
292 if ((res = acmStreamOpen(&drv, NULL, (WAVEFORMATEX *)wfx, filter->pWfOut, NULL, 0, 0, 0)))
293 {
294 ERR("Failed to open stream, error %u.\n", res);
295 FreeMediaType(&filter->mt);
297 }
298
299 filter->has = drv;
300
301 return S_OK;
302}
#define WAVE_FORMAT_PCM
Definition: constants.h:425
static BOOL is_audio_subtype(const GUID *guid)
Definition: acmwrapper.c:265
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: stream.c:149
GLuint res
Definition: glext.h:9613
#define WAVE_FORMAT_EXTENSIBLE
Definition: ksmedia.h:651
if(dx< 0)
Definition: linetemp.h:194
UINT MMRESULT
Definition: mmsystem.h:964
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: mediatype.c:150
AM_MEDIA_TYPE mt
Definition: acmwrapper.c:49
struct strmbase_pin pin
Definition: strmbase.h:106
#define VFW_E_TYPE_NOT_ACCEPTED
Definition: vfwmsgs.h:81

◆ acm_wrapper_sink_disconnect()

static void acm_wrapper_sink_disconnect ( struct strmbase_sink *  iface)
static

Definition at line 304 of file acmwrapper.c.

305{
306 struct acm_wrapper *filter = impl_from_strmbase_filter(iface->pin.filter);
307
308 if (filter->has)
309 acmStreamClose(filter->has, 0);
310 filter->has = 0;
311 filter->lasttime_real = filter->lasttime_sent = -1;
312}
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
Definition: stream.c:65

◆ acm_wrapper_sink_query_accept()

static HRESULT acm_wrapper_sink_query_accept ( struct strmbase_pin *  iface,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 75 of file acmwrapper.c.

76{
77 return S_OK;
78}

◆ acm_wrapper_sink_query_interface()

static HRESULT acm_wrapper_sink_query_interface ( struct strmbase_pin *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 62 of file acmwrapper.c.

63{
65
66 if (IsEqualGUID(iid, &IID_IMemInputPin))
67 *out = &filter->sink.IMemInputPin_iface;
68 else
69 return E_NOINTERFACE;
70
71 IUnknown_AddRef((IUnknown *)*out);
72 return S_OK;
73}
struct strmbase_filter * filter
Definition: strmbase.h:58
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ acm_wrapper_sink_Receive()

static HRESULT WINAPI acm_wrapper_sink_Receive ( struct strmbase_sink *  iface,
IMediaSample *  pSample 
)
static

Definition at line 80 of file acmwrapper.c.

81{
82 struct acm_wrapper *This = impl_from_strmbase_filter(iface->pin.filter);
83 IMediaSample* pOutSample = NULL;
84 DWORD cbDstStream, cbSrcStream;
85 LPBYTE pbDstStream;
86 LPBYTE pbSrcStream = NULL;
88 BOOL unprepare_header = FALSE, preroll;
90 HRESULT hr;
91 LONGLONG tStart = -1, tStop = -1, tMed;
92 LONGLONG mtStart = -1, mtStop = -1, mtMed;
93
94 /* We do not expect pin connection state to change while the filter is
95 * running. This guarantee is necessary, since otherwise we would have to
96 * take the filter lock, and we can't take the filter lock from a streaming
97 * thread. */
98 if (!This->source.pMemInputPin)
99 {
100 WARN("Source is not connected, returning VFW_E_NOT_CONNECTED.\n");
101 return VFW_E_NOT_CONNECTED;
102 }
103
104 if (This->filter.state == State_Stopped)
105 return VFW_E_WRONG_STATE;
106
107 if (This->sink.flushing)
108 return S_FALSE;
109
110 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
111 if (FAILED(hr))
112 {
113 ERR("Failed to get input buffer pointer, hr %#lx.\n", hr);
114 return hr;
115 }
116
117 preroll = (IMediaSample_IsPreroll(pSample) == S_OK);
118
119 IMediaSample_GetTime(pSample, &tStart, &tStop);
120 if (IMediaSample_GetMediaTime(pSample, &mtStart, &mtStop) != S_OK)
121 mtStart = mtStop = -1;
122 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
123
124 /* Prevent discontinuities when codecs 'absorb' data but not give anything back in return */
125 if (IMediaSample_IsDiscontinuity(pSample) == S_OK)
126 {
127 This->lasttime_real = tStart;
128 This->lasttime_sent = tStart;
129 }
130 else if (This->lasttime_real == tStart)
131 tStart = This->lasttime_sent;
132 else
133 WARN("Discontinuity\n");
134
135 tMed = tStart;
136 mtMed = mtStart;
137
138 ash.pbSrc = pbSrcStream;
139 ash.cbSrcLength = cbSrcStream;
140
141 while(hr == S_OK && ash.cbSrcLength)
142 {
143 if (FAILED(hr = IMemAllocator_GetBuffer(This->source.pAllocator, &pOutSample, NULL, NULL, 0)))
144 {
145 ERR("Failed to get sample, hr %#lx.\n", hr);
146 return hr;
147 }
148 IMediaSample_SetPreroll(pOutSample, preroll);
149
150 hr = IMediaSample_SetActualDataLength(pOutSample, 0);
151 assert(hr == S_OK);
152
153 hr = IMediaSample_GetPointer(pOutSample, &pbDstStream);
154 if (FAILED(hr)) {
155 ERR("Failed to get output buffer pointer, hr %#lx.\n", hr);
156 goto error;
157 }
158 cbDstStream = IMediaSample_GetSize(pOutSample);
159
160 ash.cbStruct = sizeof(ash);
161 ash.fdwStatus = 0;
162 ash.dwUser = 0;
163 ash.pbDst = pbDstStream;
164 ash.cbDstLength = cbDstStream;
165
166 if ((res = acmStreamPrepareHeader(This->has, &ash, 0))) {
167 ERR("Cannot prepare header %d\n", res);
168 goto error;
169 }
170 unprepare_header = TRUE;
171
172 if (IMediaSample_IsDiscontinuity(pSample) == S_OK)
173 {
175 IMediaSample_SetDiscontinuity(pOutSample, TRUE);
176 /* One sample could be converted to multiple packets */
177 IMediaSample_SetDiscontinuity(pSample, FALSE);
178 }
179 else
180 {
181 res = acmStreamConvert(This->has, &ash, 0);
182 IMediaSample_SetDiscontinuity(pOutSample, FALSE);
183 }
184
185 if (res)
186 {
188 ERR("Cannot convert data header %d\n", res);
189 goto error;
190 }
191
192 TRACE("used in %lu/%lu, used out %lu/%lu\n", ash.cbSrcLengthUsed, ash.cbSrcLength, ash.cbDstLengthUsed, ash.cbDstLength);
193
194 hr = IMediaSample_SetActualDataLength(pOutSample, ash.cbDstLengthUsed);
195 assert(hr == S_OK);
196
197 /* Bug in acm codecs? It apparently uses the input, but doesn't necessarily output immediately */
198 if (!ash.cbSrcLengthUsed)
199 {
200 WARN("Sample was skipped? Outputted: %lu\n", ash.cbDstLengthUsed);
201 ash.cbSrcLength = 0;
202 goto error;
203 }
204
205 TRACE("Sample start time: %s.\n", debugstr_time(tStart));
206 if (ash.cbSrcLengthUsed == cbSrcStream)
207 {
208 IMediaSample_SetTime(pOutSample, &tStart, &tStop);
209 tStart = tMed = tStop;
210 }
211 else if (tStop != tStart)
212 {
213 tMed = tStop - tStart;
214 tMed = tStart + tMed * ash.cbSrcLengthUsed / cbSrcStream;
215 IMediaSample_SetTime(pOutSample, &tStart, &tMed);
216 tStart = tMed;
217 }
218 else
219 {
220 ERR("No valid timestamp found\n");
221 IMediaSample_SetTime(pOutSample, NULL, NULL);
222 }
223
224 if (mtStart < 0) {
225 IMediaSample_SetMediaTime(pOutSample, NULL, NULL);
226 } else if (ash.cbSrcLengthUsed == cbSrcStream) {
227 IMediaSample_SetMediaTime(pOutSample, &mtStart, &mtStop);
228 mtStart = mtMed = mtStop;
229 } else if (mtStop >= mtStart) {
230 mtMed = mtStop - mtStart;
231 mtMed = mtStart + mtMed * ash.cbSrcLengthUsed / cbSrcStream;
232 IMediaSample_SetMediaTime(pOutSample, &mtStart, &mtMed);
233 mtStart = mtMed;
234 } else {
235 IMediaSample_SetMediaTime(pOutSample, NULL, NULL);
236 }
237
238 TRACE("Sample stop time: %s\n", debugstr_time(tStart));
239
240 hr = IMemInputPin_Receive(This->source.pMemInputPin, pOutSample);
241 if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) {
242 if (FAILED(hr))
243 ERR("Failed to send sample, hr %#lx.\n", hr);
244 goto error;
245 }
246
247error:
248 if (unprepare_header && (res = acmStreamUnprepareHeader(This->has, &ash, 0)))
249 ERR("Cannot unprepare header %d\n", res);
250 unprepare_header = FALSE;
251 ash.pbSrc += ash.cbSrcLengthUsed;
252 ash.cbSrcLength -= ash.cbSrcLengthUsed;
253
254 IMediaSample_Release(pOutSample);
255 pOutSample = NULL;
256
257 }
258
259 This->lasttime_real = tStop;
260 This->lasttime_sent = tMed;
261
262 return hr;
263}
#define WARN(fmt,...)
Definition: precomp.h:61
#define TRUE
Definition: types.h:120
MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare)
Definition: stream.c:299
MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert)
Definition: stream.c:89
MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare)
Definition: stream.c:449
#define assert(_expr)
Definition: assert.h:32
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define error(str)
Definition: mkdosfs.c:1605
#define MMSYSERR_MOREDATA
Definition: mmsystem.h:117
#define ACM_STREAMCONVERTF_START
Definition: msacm.h:206
static const char * debugstr_time(REFERENCE_TIME time)
Definition: strmbase.h:32
DWORD fdwStatus
Definition: msacm.h:551
DWORD cbSrcLengthUsed
Definition: msacm.h:555
DWORD cbStruct
Definition: msacm.h:550
LPBYTE pbDst
Definition: msacm.h:557
DWORD_PTR dwUser
Definition: msacm.h:552
DWORD cbDstLength
Definition: msacm.h:558
DWORD cbSrcLength
Definition: msacm.h:554
DWORD cbDstLengthUsed
Definition: msacm.h:559
LPBYTE pbSrc
Definition: msacm.h:553
unsigned char * LPBYTE
Definition: typedefs.h:53
int64_t LONGLONG
Definition: typedefs.h:68
#define VFW_E_WRONG_STATE
Definition: vfwmsgs.h:78
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define S_FALSE
Definition: winerror.h:3451

◆ acm_wrapper_source_DecideBufferSize()

static HRESULT WINAPI acm_wrapper_source_DecideBufferSize ( struct strmbase_source *  iface,
IMemAllocator *  pAlloc,
ALLOCATOR_PROPERTIES *  ppropInputRequest 
)
static

Definition at line 360 of file acmwrapper.c.

362{
363 struct acm_wrapper *filter = impl_from_strmbase_filter(iface->pin.filter);
365
366 if (!ppropInputRequest->cbAlign)
367 ppropInputRequest->cbAlign = 1;
368
369 if (ppropInputRequest->cbBuffer < filter->pWfOut->nAvgBytesPerSec / 2)
370 ppropInputRequest->cbBuffer = filter->pWfOut->nAvgBytesPerSec / 2;
371
372 if (!ppropInputRequest->cBuffers)
373 ppropInputRequest->cBuffers = 1;
374
375 return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual);
376}
struct strmbase_pin pin
Definition: strmbase.h:79

◆ acm_wrapper_source_get_media_type()

static HRESULT acm_wrapper_source_get_media_type ( struct strmbase_pin *  iface,
unsigned int  index,
AM_MEDIA_TYPE *  mt 
)
static

Definition at line 349 of file acmwrapper.c.

351{
353
354 if (index)
355 return VFW_S_NO_MORE_ITEMS;
356 CopyMediaType(mt, &filter->mt);
357 return S_OK;
358}
#define VFW_S_NO_MORE_ITEMS
Definition: vfwmsgs.h:19

◆ acm_wrapper_source_qc_AddRef()

static ULONG WINAPI acm_wrapper_source_qc_AddRef ( IQualityControl *  iface)
static

Definition at line 400 of file acmwrapper.c.

401{
403 return IPin_AddRef(&filter->source.pin.IPin_iface);
404}
static struct acm_wrapper * impl_from_source_IQualityControl(IQualityControl *iface)
Definition: acmwrapper.c:388

◆ acm_wrapper_source_qc_Notify()

static HRESULT WINAPI acm_wrapper_source_qc_Notify ( IQualityControl *  iface,
IBaseFilter *  sender,
Quality  q 
)
static

Definition at line 412 of file acmwrapper.c.

414{
416 IQualityControl *peer;
417 HRESULT hr = S_OK;
418
419 TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n",
420 filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp));
421
422 if (filter->source_qc_sink)
423 return IQualityControl_Notify(filter->source_qc_sink, &filter->filter.IBaseFilter_iface, q);
424
425 if (filter->sink.pin.peer
426 && SUCCEEDED(IPin_QueryInterface(filter->sink.pin.peer, &IID_IQualityControl, (void **)&peer)))
427 {
428 hr = IQualityControl_Notify(peer, &filter->filter.IBaseFilter_iface, q);
429 IQualityControl_Release(peer);
430 }
431 return hr;
432}
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ acm_wrapper_source_qc_QueryInterface()

static HRESULT WINAPI acm_wrapper_source_qc_QueryInterface ( IQualityControl *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 393 of file acmwrapper.c.

395{
397 return IPin_QueryInterface(&filter->source.pin.IPin_iface, iid, out);
398}

◆ acm_wrapper_source_qc_Release()

static ULONG WINAPI acm_wrapper_source_qc_Release ( IQualityControl *  iface)
static

Definition at line 406 of file acmwrapper.c.

407{
409 return IPin_Release(&filter->source.pin.IPin_iface);
410}

◆ acm_wrapper_source_qc_SetSink()

static HRESULT WINAPI acm_wrapper_source_qc_SetSink ( IQualityControl *  iface,
IQualityControl *  sink 
)
static

Definition at line 434 of file acmwrapper.c.

435{
437
438 TRACE("filter %p, sink %p.\n", filter, sink);
439
440 filter->source_qc_sink = sink;
441
442 return S_OK;
443}
GLsizei GLenum GLboolean sink
Definition: glext.h:5672

◆ acm_wrapper_source_query_accept()

static HRESULT acm_wrapper_source_query_accept ( struct strmbase_pin *  iface,
const AM_MEDIA_TYPE *  mt 
)
static

Definition at line 338 of file acmwrapper.c.

339{
341
342 if (IsEqualGUID(&mt->majortype, &filter->mt.majortype)
343 && (IsEqualGUID(&mt->subtype, &filter->mt.subtype)
344 || IsEqualGUID(&filter->mt.subtype, &GUID_NULL)))
345 return S_OK;
346 return S_FALSE;
347}
#define GUID_NULL
Definition: ks.h:106

◆ acm_wrapper_source_query_interface()

static HRESULT acm_wrapper_source_query_interface ( struct strmbase_pin *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 323 of file acmwrapper.c.

324{
326
327 if (IsEqualGUID(iid, &IID_IQualityControl))
328 *out = &filter->source_IQualityControl_iface;
329 else if (IsEqualGUID(iid, &IID_IMediaSeeking))
330 *out = &filter->passthrough.IMediaSeeking_iface;
331 else
332 return E_NOINTERFACE;
333
334 IUnknown_AddRef((IUnknown *)*out);
335 return S_OK;
336}
IMediaSeeking IMediaSeeking_iface
Definition: filter.c:167

◆ impl_from_source_IQualityControl()

static struct acm_wrapper * impl_from_source_IQualityControl ( IQualityControl *  iface)
static

Definition at line 388 of file acmwrapper.c.

389{
390 return CONTAINING_RECORD(iface, struct acm_wrapper, source_IQualityControl_iface);
391}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by acm_wrapper_source_qc_AddRef(), acm_wrapper_source_qc_Notify(), acm_wrapper_source_qc_QueryInterface(), acm_wrapper_source_qc_Release(), and acm_wrapper_source_qc_SetSink().

◆ impl_from_strmbase_filter()

◆ is_audio_subtype()

static BOOL is_audio_subtype ( const GUID *  guid)
static

Definition at line 265 of file acmwrapper.c.

266{
267 return !memcmp(&guid->Data2, &MEDIATYPE_Audio.Data2, sizeof(GUID) - sizeof(int));
268}
GUID guid
Definition: version.c:147
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807

Referenced by acm_wrapper_sink_connect().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ filter_ops

const struct strmbase_filter_ops filter_ops
static
Initial value:
=
{
.filter_get_pin = acm_wrapper_get_pin,
.filter_destroy = acm_wrapper_destroy,
.filter_init_stream = acm_wrapper_init_stream,
.filter_cleanup_stream = acm_wrapper_cleanup_stream,
}
static HRESULT acm_wrapper_init_stream(struct strmbase_filter *iface)
Definition: acmwrapper.c:486
static struct strmbase_pin * acm_wrapper_get_pin(struct strmbase_filter *iface, unsigned int index)
Definition: acmwrapper.c:454
static HRESULT acm_wrapper_cleanup_stream(struct strmbase_filter *iface)
Definition: acmwrapper.c:496
static void acm_wrapper_destroy(struct strmbase_filter *iface)
Definition: acmwrapper.c:465

Definition at line 505 of file acmwrapper.c.

Referenced by acm_wrapper_create().

◆ sink_ops

const struct strmbase_sink_ops sink_ops
static
Initial value:
=
{
.base.pin_query_interface = acm_wrapper_sink_query_interface,
.base.pin_query_accept = acm_wrapper_sink_query_accept,
.pfnReceive = acm_wrapper_sink_Receive,
.sink_connect = acm_wrapper_sink_connect,
.sink_disconnect = acm_wrapper_sink_disconnect,
}
static HRESULT acm_wrapper_sink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
Definition: acmwrapper.c:75
static HRESULT acm_wrapper_sink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: acmwrapper.c:270
static HRESULT WINAPI acm_wrapper_sink_Receive(struct strmbase_sink *iface, IMediaSample *pSample)
Definition: acmwrapper.c:80
static HRESULT acm_wrapper_sink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: acmwrapper.c:62
static void acm_wrapper_sink_disconnect(struct strmbase_sink *iface)
Definition: acmwrapper.c:304

Definition at line 314 of file acmwrapper.c.

Referenced by acm_wrapper_create().

◆ source_ops

const struct strmbase_source_ops source_ops
static
Initial value:
=
{
.base.pin_query_interface = acm_wrapper_source_query_interface,
.base.pin_query_accept = acm_wrapper_source_query_accept,
.base.pin_get_media_type = acm_wrapper_source_get_media_type,
.pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
.pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator,
.pfnDecideBufferSize = acm_wrapper_source_DecideBufferSize,
}
static HRESULT WINAPI acm_wrapper_source_DecideBufferSize(struct strmbase_source *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
Definition: acmwrapper.c:360
static HRESULT acm_wrapper_source_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
Definition: acmwrapper.c:349
static HRESULT acm_wrapper_source_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: acmwrapper.c:323
static HRESULT acm_wrapper_source_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
Definition: acmwrapper.c:338
HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(struct strmbase_source *pin, IMemInputPin *peer, IMemAllocator **allocator)
Definition: pin.c:680
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *pin, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: pin.c:710

Definition at line 378 of file acmwrapper.c.

Referenced by acm_wrapper_create().

◆ source_qc_vtbl

const IQualityControlVtbl source_qc_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI acm_wrapper_source_qc_Release(IQualityControl *iface)
Definition: acmwrapper.c:406
static HRESULT WINAPI acm_wrapper_source_qc_Notify(IQualityControl *iface, IBaseFilter *sender, Quality q)
Definition: acmwrapper.c:412
static HRESULT WINAPI acm_wrapper_source_qc_QueryInterface(IQualityControl *iface, REFIID iid, void **out)
Definition: acmwrapper.c:393
static ULONG WINAPI acm_wrapper_source_qc_AddRef(IQualityControl *iface)
Definition: acmwrapper.c:400
static HRESULT WINAPI acm_wrapper_source_qc_SetSink(IQualityControl *iface, IQualityControl *sink)
Definition: acmwrapper.c:434

Definition at line 445 of file acmwrapper.c.

Referenced by acm_wrapper_create().