ReactOS 0.4.17-dev-934-g091855f
mpegaudio.c File Reference
#include "dshow.h"
#include "mmreg.h"
#include "ks.h"
#include "ksmedia.h"
#include "wine/strmbase.h"
#include "wine/test.h"
Include dependency graph for mpegaudio.c:

Go to the source code of this file.

Classes

struct  testqc
 
struct  testfilter
 

Macros

#define COBJMACROS
 
#define check_interface(a, b, c)   check_interface_(__LINE__, a, b, c)
 

Functions

static IBaseFilter * create_mpeg_audio_codec (void)
 
static BOOL compare_media_types (const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
 
static void init_pcm_mt (AM_MEDIA_TYPE *mt, WAVEFORMATEX *format, WORD channels, DWORD sample_rate, WORD depth)
 
static ULONG get_refcount (void *iface)
 
static void check_interface_ (unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
 
static void test_interfaces (void)
 
static HRESULT WINAPI outer_QueryInterface (IUnknown *iface, REFIID iid, void **out)
 
static ULONG WINAPI outer_AddRef (IUnknown *iface)
 
static ULONG WINAPI outer_Release (IUnknown *iface)
 
static void test_aggregation (void)
 
static void test_unconnected_filter_state (void)
 
static void test_enum_pins (void)
 
static void test_find_pin (void)
 
static void test_pin_info (void)
 
static void test_enum_media_types (void)
 
static void test_media_types (void)
 
static struct testqc * impl_from_IQualityControl (IQualityControl *iface)
 
static HRESULT WINAPI testqc_QueryInterface (IQualityControl *iface, REFIID iid, void **out)
 
static ULONG WINAPI testqc_AddRef (IQualityControl *iface)
 
static ULONG WINAPI testqc_Release (IQualityControl *iface)
 
static HRESULT WINAPI testqc_Notify (IQualityControl *iface, IBaseFilter *sender, Quality q)
 
static HRESULT WINAPI testqc_SetSink (IQualityControl *iface, IQualityControl *sink)
 
static struct testqc * impl_from_qc_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI testqc_inner_QueryInterface (IUnknown *iface, REFIID iid, void **out)
 
static ULONG WINAPI testqc_inner_AddRef (IUnknown *iface)
 
static ULONG WINAPI testqc_inner_Release (IUnknown *iface)
 
static void testqc_init (struct testqc *qc, IUnknown *outer)
 
static struct testfilter * impl_from_strmbase_filter (struct strmbase_filter *iface)
 
static struct strmbase_pin * testfilter_get_pin (struct strmbase_filter *iface, unsigned int index)
 
static void testfilter_destroy (struct strmbase_filter *iface)
 
static HRESULT testsource_query_interface (struct strmbase_pin *iface, REFIID iid, void **out)
 
static HRESULT WINAPI testsource_DecideAllocator (struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator)
 
static HRESULT testsink_query_interface (struct strmbase_pin *iface, REFIID iid, void **out)
 
static HRESULT testsink_get_media_type (struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
 
static HRESULT testsink_connect (struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
 
static HRESULT WINAPI testsink_Receive (struct strmbase_sink *iface, IMediaSample *sample)
 
static HRESULT testsink_new_segment (struct strmbase_sink *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
 
static HRESULT testsink_eos (struct strmbase_sink *iface)
 
static HRESULT testsink_begin_flush (struct strmbase_sink *iface)
 
static HRESULT testsink_end_flush (struct strmbase_sink *iface)
 
static void testfilter_init (struct testfilter *filter)
 
static void test_sink_allocator (IMemInputPin *input)
 
static void test_source_allocator (IFilterGraph2 *graph, IMediaControl *control, IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
 
static void test_quality_control (IFilterGraph2 *graph, IBaseFilter *filter, IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
 
static void test_sample_processing (IMediaControl *control, IMemInputPin *input, struct testfilter *sink)
 
static void test_streaming_events (IMediaControl *control, IPin *sink, IMemInputPin *input, struct testfilter *testsink)
 
static void test_connect_pin (void)
 
 START_TEST (mpegaudio)
 

Variables

static const MPEG1WAVEFORMAT mp1_format
 
static const AM_MEDIA_TYPE mp1_mt
 
static const MPEG1WAVEFORMAT mp2_format
 
static const AM_MEDIA_TYPE mp2_mt
 
static const MPEG1WAVEFORMAT mp3_format0
 
static const AM_MEDIA_TYPE mp3_mt0
 
static const MPEGLAYER3WAVEFORMAT mp3_format1
 
static const AM_MEDIA_TYPE mp3_mt1
 
static const WAVEFORMATEXTENSIBLE pcm16ex_format
 
static const AM_MEDIA_TYPE pcm16ex_mt
 
static const GUID test_iid = {0x33333333}
 
static LONG outer_ref = 1
 
static const IUnknownVtbl outer_vtbl
 
static IUnknown test_outer = {&outer_vtbl}
 
static const IQualityControlVtbl testqc_vtbl
 
static const IUnknownVtbl testqc_inner_vtbl
 
static const struct strmbase_filter_ops testfilter_ops
 
static const struct strmbase_source_ops testsource_ops
 
static const struct strmbase_sink_ops testsink_ops
 

Macro Definition Documentation

◆ check_interface

#define check_interface (   a,
  b,
  c 
)    check_interface_(__LINE__, a, b, c)

Definition at line 202 of file mpegaudio.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file mpegaudio.c.

Function Documentation

◆ check_interface_()

static void check_interface_ ( unsigned int  line,
void *  iface_ptr,
REFIID  iid,
BOOL  supported 
)
static

Definition at line 203 of file mpegaudio.c.

204{
205 IUnknown *iface = iface_ptr;
207 IUnknown *unk;
208
209 expected_hr = supported ? S_OK : E_NOINTERFACE;
210
211 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
212 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
213 if (SUCCEEDED(hr))
214 IUnknown_Release(unk);
215}
#define ok_(x1, x2)
Definition: atltest.h:61
HRESULT expected_hr
HRESULT hr
Definition: delayimp.cpp:582
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
Definition: parser.c:49
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ compare_media_types()

static BOOL compare_media_types ( const AM_MEDIA_TYPE *  a,
const AM_MEDIA_TYPE *  b 
)
inlinestatic

Definition at line 169 of file mpegaudio.c.

170{
171 return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat))
172 && !memcmp(a->pbFormat, b->pbFormat, a->cbFormat);
173}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define offsetof(TYPE, MEMBER)

Referenced by test_connect_pin().

◆ create_mpeg_audio_codec()

static IBaseFilter * create_mpeg_audio_codec ( void  )
static

Definition at line 160 of file mpegaudio.c.

161{
163 HRESULT hr = CoCreateInstance(&CLSID_CMpegAudioCodec, NULL, CLSCTX_INPROC_SERVER,
164 &IID_IBaseFilter, (void **)&filter);
165 ok(hr == S_OK, "Got hr %#lx.\n", hr);
166 return filter;
167}
#define ok(value,...)
Definition: atltest.h:57
const GUID IID_IBaseFilter
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
Definition: filter.c:165

Referenced by test_connect_pin(), test_enum_media_types(), test_enum_pins(), test_find_pin(), test_interfaces(), test_media_types(), test_pin_info(), and test_unconnected_filter_state().

◆ get_refcount()

static ULONG get_refcount ( void *  iface)
static

Definition at line 195 of file mpegaudio.c.

196{
197 IUnknown *unknown = iface;
198 IUnknown_AddRef(unknown);
199 return IUnknown_Release(unknown);
200}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674

Referenced by test_aggregation(), test_enum_pins(), and test_pin_info().

◆ impl_from_IQualityControl()

static struct testqc * impl_from_IQualityControl ( IQualityControl *  iface)
static

Definition at line 803 of file mpegaudio.c.

804{
805 return CONTAINING_RECORD(iface, struct testqc, IQualityControl_iface);
806}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by testqc_AddRef(), testqc_Notify(), testqc_QueryInterface(), and testqc_Release().

◆ impl_from_qc_IUnknown()

static struct testqc * impl_from_qc_IUnknown ( IUnknown *  iface)
static

Definition at line 851 of file mpegaudio.c.

852{
853 return CONTAINING_RECORD(iface, struct testqc, IUnknown_inner);
854}

Referenced by testqc_inner_AddRef(), testqc_inner_QueryInterface(), and testqc_inner_Release().

◆ impl_from_strmbase_filter()

◆ init_pcm_mt()

static void init_pcm_mt ( AM_MEDIA_TYPE *  mt,
WAVEFORMATEX *  format,
WORD  channels,
DWORD  sample_rate,
WORD  depth 
)
static

Definition at line 175 of file mpegaudio.c.

177{
178 memset(format, 0, sizeof(WAVEFORMATEX));
179 format->wFormatTag = WAVE_FORMAT_PCM;
180 format->nChannels = channels;
181 format->nSamplesPerSec = sample_rate;
182 format->wBitsPerSample = depth;
183 format->nBlockAlign = channels * depth / 8;
184 format->nAvgBytesPerSec = format->nBlockAlign * format->nSamplesPerSec;
185 memset(mt, 0, sizeof(AM_MEDIA_TYPE));
186 mt->majortype = MEDIATYPE_Audio;
187 mt->subtype = MEDIASUBTYPE_PCM;
188 mt->bFixedSizeSamples = TRUE;
189 mt->lSampleSize = format->nBlockAlign;
190 mt->formattype = FORMAT_WaveFormatEx;
191 mt->cbFormat = sizeof(WAVEFORMATEX);
192 mt->pbFormat = (BYTE *)format;
193}
unsigned int channels
Definition: audiorecord.c:89
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define TRUE
Definition: types.h:120
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define memset(x, y, z)
Definition: compat.h:39
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_connect_pin(), test_media_types(), and test_source_allocator().

◆ outer_AddRef()

static ULONG WINAPI outer_AddRef ( IUnknown *  iface)
static

Definition at line 284 of file mpegaudio.c.

285{
287}
#define InterlockedIncrement
Definition: armddk.h:53
static LONG outer_ref
Definition: mpegaudio.c:269

◆ outer_QueryInterface()

static HRESULT WINAPI outer_QueryInterface ( IUnknown *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 271 of file mpegaudio.c.

272{
273 if (IsEqualGUID(iid, &IID_IUnknown)
275 || IsEqualGUID(iid, &test_iid))
276 {
277 *out = (IUnknown *)0xdeadbeef;
278 return S_OK;
279 }
280 ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid));
281 return E_NOINTERFACE;
282}
const GUID IID_IUnknown
static const GUID test_iid
Definition: mpegaudio.c:268
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ outer_Release()

static ULONG WINAPI outer_Release ( IUnknown *  iface)
static

Definition at line 289 of file mpegaudio.c.

290{
292}
#define InterlockedDecrement
Definition: armddk.h:52

◆ START_TEST()

START_TEST ( mpegaudio  )

Definition at line 1847 of file mpegaudio.c.

1848{
1850
1852
1853 if (FAILED(CoCreateInstance(&CLSID_CMpegAudioCodec, NULL, CLSCTX_INPROC_SERVER,
1854 &IID_IBaseFilter, (void **)&filter)))
1855 {
1856 skip("Failed to create MPEG audio decoder instance.\n");
1857 return;
1858 }
1859 IBaseFilter_Release(filter);
1860
1865 test_find_pin();
1866 test_pin_info();
1870
1872}
#define skip(...)
Definition: atltest.h:64
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
#define FAILED(hr)
Definition: intsafe.h:51
static void test_aggregation(void)
Definition: mpegaudio.c:303
static void test_pin_info(void)
Definition: mpegaudio.c:581
static void test_find_pin(void)
Definition: mpegaudio.c:540
static void test_enum_media_types(void)
Definition: mpegaudio.c:650
static void test_interfaces(void)
Definition: mpegaudio.c:217
static void test_connect_pin(void)
Definition: mpegaudio.c:1532
static void test_media_types(void)
Definition: mpegaudio.c:725
static void test_enum_pins(void)
Definition: mpegaudio.c:419
static void test_unconnected_filter_state(void)
Definition: mpegaudio.c:362

◆ test_aggregation()

static void test_aggregation ( void  )
static

Definition at line 303 of file mpegaudio.c.

304{
305 IBaseFilter *filter, *filter2;
306 IUnknown *unk, *unk2;
307 HRESULT hr;
308 ULONG ref;
309
310 filter = (IBaseFilter *)0xdeadbeef;
311 hr = CoCreateInstance(&CLSID_CMpegAudioCodec, &test_outer, CLSCTX_INPROC_SERVER,
312 &IID_IBaseFilter, (void **)&filter);
313 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
314 ok(!filter, "Got interface %p.\n", filter);
315
316 hr = CoCreateInstance(&CLSID_CMpegAudioCodec, &test_outer, CLSCTX_INPROC_SERVER,
317 &IID_IUnknown, (void **)&unk);
318 ok(hr == S_OK, "Got hr %#lx.\n", hr);
319 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
320 ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
321 ref = get_refcount(unk);
322 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
323
324 ref = IUnknown_AddRef(unk);
325 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
326 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
327
328 ref = IUnknown_Release(unk);
329 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
330 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
331
332 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
333 ok(hr == S_OK, "Got hr %#lx.\n", hr);
334 ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
335 IUnknown_Release(unk2);
336
337 hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
338 ok(hr == S_OK, "Got hr %#lx.\n", hr);
339
340 hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
341 ok(hr == S_OK, "Got hr %#lx.\n", hr);
342 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
343
344 hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
345 ok(hr == S_OK, "Got hr %#lx.\n", hr);
346 ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
347
348 hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
349 ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
350 ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
351
352 hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
353 ok(hr == S_OK, "Got hr %#lx.\n", hr);
354 ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
355
356 IBaseFilter_Release(filter);
357 ref = IUnknown_Release(unk);
358 ok(!ref, "Got unexpected refcount %ld.\n", ref);
359 ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
360}
static ULONG get_refcount(void *iface)
Definition: mpegaudio.c:195
static IUnknown test_outer
Definition: mpegaudio.c:301
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_connect_pin()

static void test_connect_pin ( void  )
static

Definition at line 1532 of file mpegaudio.c.

1533{
1535 struct testfilter testsource, testsink;
1536 AM_MEDIA_TYPE mt, source_mt, *pmt;
1537 WAVEFORMATEX source_format;
1538 IPin *sink, *source, *peer;
1539 IEnumMediaTypes *enummt;
1540 WAVEFORMATEX req_format;
1541 IMediaControl *control;
1542 IMemInputPin *meminput;
1543 AM_MEDIA_TYPE req_mt;
1545 unsigned int i;
1546 HRESULT hr;
1547 ULONG ref;
1548
1549 CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
1550 &IID_IFilterGraph2, (void **)&graph);
1551 testfilter_init(&testsource);
1553 IFilterGraph2_AddFilter(graph, &testsink.filter.IBaseFilter_iface, L"sink");
1554 IFilterGraph2_AddFilter(graph, &testsource.filter.IBaseFilter_iface, L"source");
1555 IFilterGraph2_AddFilter(graph, filter, L"MPEG audio decoder");
1556 IBaseFilter_FindPin(filter, L"In", &sink);
1557 IBaseFilter_FindPin(filter, L"Out", &source);
1558 IPin_QueryInterface(sink, &IID_IMemInputPin, (void **)&meminput);
1559 IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
1560
1563
1564 /* Test sink connection. */
1565
1566 peer = (IPin *)0xdeadbeef;
1567 hr = IPin_ConnectedTo(sink, &peer);
1568 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1569 ok(!peer, "Got peer %p.\n", peer);
1570
1571 hr = IPin_ConnectionMediaType(sink, &mt);
1572 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1573
1574 hr = IMediaControl_Pause(control);
1575 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1576 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &mp1_mt);
1577 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1578 hr = IMediaControl_Stop(control);
1579 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1580
1581 req_mt = mp1_mt;
1582 req_mt.subtype = MEDIASUBTYPE_PCM;
1583 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
1584 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1585
1586 hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &mp1_mt);
1587 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1588
1589 hr = IPin_ConnectedTo(sink, &peer);
1590 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1591 ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
1592 IPin_Release(peer);
1593
1594 hr = IPin_ConnectionMediaType(sink, &mt);
1595 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1596 ok(compare_media_types(&mt, &mp1_mt), "Media types didn't match.\n");
1597 ok(compare_media_types(&testsource.source.pin.mt, &mp1_mt), "Media types didn't match.\n");
1598 FreeMediaType(&mt);
1599
1600 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1601 hr = IPin_QueryAccept(source, &req_mt);
1602 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1603
1604 init_pcm_mt(&req_mt, &req_format, 1, 32000, 8);
1605 hr = IPin_QueryAccept(source, &req_mt);
1606 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1607
1608 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1609 req_mt.majortype = GUID_NULL;
1610 hr = IPin_QueryAccept(source, &req_mt);
1611 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1612
1613 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1614 req_mt.subtype = GUID_NULL;
1615 hr = IPin_QueryAccept(source, &req_mt);
1616 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1617
1618 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1619 req_mt.formattype = GUID_NULL;
1620 hr = IPin_QueryAccept(source, &req_mt);
1621 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1622
1623 init_pcm_mt(&req_mt, &req_format, 2, 32000, 16);
1624 hr = IPin_QueryAccept(source, &req_mt);
1625 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1626
1627 init_pcm_mt(&req_mt, &req_format, 1, 16000, 16);
1628 hr = IPin_QueryAccept(source, &req_mt);
1629 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1630
1631 init_pcm_mt(&req_mt, &req_format, 1, 32000, 24);
1632 hr = IPin_QueryAccept(source, &req_mt);
1633 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1634
1635 hr = IPin_QueryAccept(source, &pcm16ex_mt);
1636 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1637
1638 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1639 req_format.nBlockAlign = 333;
1640 hr = IPin_QueryAccept(source, &req_mt);
1641 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1642
1643 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1644 req_format.nAvgBytesPerSec = 333;
1645 hr = IPin_QueryAccept(source, &req_mt);
1646 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1647
1648 hr = IMediaControl_Pause(control);
1649 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1650 hr = IFilterGraph2_Disconnect(graph, sink);
1651 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1652 hr = IMediaControl_Stop(control);
1653 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1654
1655 hr = IPin_EnumMediaTypes(source, &enummt);
1656 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1657
1658 for (i = 0; i < 2; ++i)
1659 {
1660 WAVEFORMATEX expect_format;
1661 AM_MEDIA_TYPE expect_mt;
1662
1663 init_pcm_mt(&expect_mt, &expect_format, 1, 32000, i ? 8 : 16);
1664
1665 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1666 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1667 if (hr != S_OK)
1668 break;
1669 ok(!memcmp(pmt, &expect_mt, offsetof(AM_MEDIA_TYPE, cbFormat)),
1670 "%u: Media types didn't match.\n", i);
1671 ok(!memcmp(pmt->pbFormat, &expect_format, sizeof(WAVEFORMATEX)),
1672 "%u: Format blocks didn't match.\n", i);
1673
1674 DeleteMediaType(pmt);
1675 }
1676
1677 hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
1678 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1679
1680 IEnumMediaTypes_Release(enummt);
1681
1682 test_sink_allocator(meminput);
1683
1684 /* Test source connection. */
1685
1686 peer = (IPin *)0xdeadbeef;
1687 hr = IPin_ConnectedTo(source, &peer);
1688 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1689 ok(!peer, "Got peer %p.\n", peer);
1690
1691 hr = IPin_ConnectionMediaType(source, &mt);
1692 ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
1693
1694 /* Exact connection. */
1695
1696 hr = IMediaControl_Pause(control);
1697 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1698 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1699 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1700 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1701 hr = IMediaControl_Stop(control);
1702 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1703
1704 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1705 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1706 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1707
1708 hr = IPin_ConnectedTo(source, &peer);
1709 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1710 ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
1711 IPin_Release(peer);
1712
1713 hr = IPin_ConnectionMediaType(source, &mt);
1714 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1715 ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
1716 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1717 FreeMediaType(&mt);
1718
1719 hr = IMediaControl_Pause(control);
1720 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1721 hr = IFilterGraph2_Disconnect(graph, source);
1722 ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
1723 hr = IMediaControl_Stop(control);
1724 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1725
1728
1729 hr = IFilterGraph2_Disconnect(graph, source);
1730 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1731 hr = IFilterGraph2_Disconnect(graph, source);
1732 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1733 ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
1734 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1735
1736 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1737 req_mt.lSampleSize = 999;
1738 req_mt.bTemporalCompression = TRUE;
1739 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1740 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1741 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1742 IFilterGraph2_Disconnect(graph, source);
1743 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1744
1745 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1746 req_mt.formattype = FORMAT_None;
1747 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1748 ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
1749
1750 /* Connection with wildcards. */
1751
1752 init_pcm_mt(&source_mt, &source_format, 1, 32000, 16);
1753
1754 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1755 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1756 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1757 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1758 IFilterGraph2_Disconnect(graph, source);
1759 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1760
1761 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1762 req_mt.majortype = GUID_NULL;
1763 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1764 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1765 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1766 IFilterGraph2_Disconnect(graph, source);
1767 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1768
1769 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1770 req_mt.majortype = GUID_NULL;
1771 req_mt.subtype = GUID_NULL;
1772 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1773 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1774 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1775 IFilterGraph2_Disconnect(graph, source);
1776 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1777
1778 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1779 req_mt.majortype = GUID_NULL;
1780 req_mt.subtype = GUID_NULL;
1781 req_mt.formattype = FORMAT_None;
1782 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1783 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1784
1785 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1786 req_mt.formattype = GUID_NULL;
1787 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1788 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1789 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1790 IFilterGraph2_Disconnect(graph, source);
1791 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1792
1793 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1794 req_mt.subtype = GUID_NULL;
1795 req_mt.formattype = GUID_NULL;
1796 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1797 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1798 ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
1799 IFilterGraph2_Disconnect(graph, source);
1800 IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
1801
1802 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1803 req_mt.majortype = MEDIATYPE_Video;
1804 req_mt.subtype = GUID_NULL;
1805 req_mt.formattype = GUID_NULL;
1806 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
1807 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1808
1809 /* Test enumeration of sink media types. */
1810
1811 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1812 req_mt.majortype = MEDIATYPE_Video;
1813 req_mt.subtype = GUID_NULL;
1814 req_mt.formattype = GUID_NULL;
1815 testsink.mt = &req_mt;
1816 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1817 ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
1818
1819 init_pcm_mt(&req_mt, &req_format, 1, 32000, 16);
1820 req_mt.lSampleSize = 444;
1821 testsink.mt = &req_mt;
1822 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
1823 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1824 ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
1825
1826 hr = IFilterGraph2_Disconnect(graph, sink);
1827 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1828 hr = IFilterGraph2_Disconnect(graph, sink);
1829 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1830 ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
1831 IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
1832
1833 IMemInputPin_Release(meminput);
1834 IPin_Release(sink);
1835 IPin_Release(source);
1836 IMediaControl_Release(control);
1837 ref = IFilterGraph2_Release(graph);
1838 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1839 ref = IBaseFilter_Release(filter);
1840 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1841 ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
1842 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1843 ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
1844 ok(!ref, "Got outstanding refcount %ld.\n", ref);
1845}
#define L(x)
Definition: resources.c:13
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
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: axcore.idl:92
#define GUID_NULL
Definition: ks.h:106
static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
Definition: mpegaudio.c:169
static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
Definition: mpegaudio.c:1128
static const AM_MEDIA_TYPE pcm16ex_mt
Definition: mpegaudio.c:148
static const AM_MEDIA_TYPE mp1_mt
Definition: mpegaudio.c:44
static void test_quality_control(IFilterGraph2 *graph, IBaseFilter *filter, IPin *sink, IPin *source, struct testfilter *testsource, struct testfilter *testsink)
Definition: mpegaudio.c:1235
static void test_streaming_events(IMediaControl *control, IPin *sink, IMemInputPin *input, struct testfilter *testsink)
Definition: mpegaudio.c:1439
static void init_pcm_mt(AM_MEDIA_TYPE *mt, WAVEFORMATEX *format, WORD channels, DWORD sample_rate, WORD depth)
Definition: mpegaudio.c:175
static void test_sink_allocator(IMemInputPin *input)
Definition: mpegaudio.c:1078
static void test_sample_processing(IMediaControl *control, IMemInputPin *input, struct testfilter *sink)
Definition: mpegaudio.c:1336
static void testfilter_init(struct testfilter *filter)
Definition: mpegaudio.c:1069
static IBaseFilter * create_mpeg_audio_codec(void)
Definition: mpegaudio.c:160
void WINAPI FreeMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:165
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:193
DWORD nAvgBytesPerSec
Definition: audioclient.idl:43
Definition: dialog.c:52
Definition: graph.c:32
IBaseFilter * filter
Definition: amstream.c:2175
AM_MEDIA_TYPE source_mt
const AM_MEDIA_TYPE * mt
Definition: avidec.c:799
IFilterGraph * graph
Definition: filtergraph.c:850
struct strmbase_source source
Definition: amstream.c:1020
struct strmbase_sink pin
Definition: filesource.c:1211
struct strmbase_filter filter
Definition: filesource.c:1210
const AM_MEDIA_TYPE * mt
Definition: filesource.c:1214
#define VFW_E_TYPE_NOT_ACCEPTED
Definition: vfwmsgs.h:81
#define VFW_E_NOT_STOPPED
Definition: vfwmsgs.h:75
#define VFW_E_NO_ACCEPTABLE_TYPES
Definition: vfwmsgs.h:46
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define S_FALSE
Definition: winerror.h:3451

Referenced by START_TEST().

◆ test_enum_media_types()

static void test_enum_media_types ( void  )
static

Definition at line 650 of file mpegaudio.c.

651{
653 IEnumMediaTypes *enum1, *enum2;
654 AM_MEDIA_TYPE *mts[1];
655 ULONG ref, count;
656 HRESULT hr;
657 IPin *pin;
658
659 IBaseFilter_FindPin(filter, L"In", &pin);
660
661 hr = IPin_EnumMediaTypes(pin, &enum1);
662 ok(hr == S_OK, "Got hr %#lx.\n", hr);
663
664 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
665 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
666
667 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
668 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
669 ok(!count, "Got count %lu.\n", count);
670
671 hr = IEnumMediaTypes_Reset(enum1);
672 ok(hr == S_OK, "Got hr %#lx.\n", hr);
673
674 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
675 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
676
677 hr = IEnumMediaTypes_Clone(enum1, &enum2);
678 ok(hr == S_OK, "Got hr %#lx.\n", hr);
679
680 hr = IEnumMediaTypes_Skip(enum1, 1);
681 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
682
683 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
684 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
685
686 IEnumMediaTypes_Release(enum1);
687 IEnumMediaTypes_Release(enum2);
688 IPin_Release(pin);
689
690 IBaseFilter_FindPin(filter, L"Out", &pin);
691
692 hr = IPin_EnumMediaTypes(pin, &enum1);
693 ok(hr == S_OK, "Got hr %#lx.\n", hr);
694
695 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
696 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
697
698 hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
699 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
700 ok(!count, "Got count %lu.\n", count);
701
702 hr = IEnumMediaTypes_Reset(enum1);
703 ok(hr == S_OK, "Got hr %#lx.\n", hr);
704
705 hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
706 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
707
708 hr = IEnumMediaTypes_Clone(enum1, &enum2);
709 ok(hr == S_OK, "Got hr %#lx.\n", hr);
710
711 hr = IEnumMediaTypes_Skip(enum1, 1);
712 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
713
714 hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
715 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
716
717 IEnumMediaTypes_Release(enum1);
718 IEnumMediaTypes_Release(enum2);
719 IPin_Release(pin);
720
721 ref = IBaseFilter_Release(filter);
722 ok(!ref, "Got outstanding refcount %ld.\n", ref);
723}
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by START_TEST().

◆ test_enum_pins()

static void test_enum_pins ( void  )
static

Definition at line 419 of file mpegaudio.c.

420{
422 IEnumPins *enum1, *enum2;
423 ULONG count, ref;
424 IPin *pins[3];
425 HRESULT hr;
426
428 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
429
430 hr = IBaseFilter_EnumPins(filter, NULL);
431 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
432
433 hr = IBaseFilter_EnumPins(filter, &enum1);
434 ok(hr == S_OK, "Got hr %#lx.\n", hr);
436 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
437 ref = get_refcount(enum1);
438 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
439
440 hr = IEnumPins_Next(enum1, 1, NULL, NULL);
441 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
442
443 hr = IEnumPins_Next(enum1, 1, pins, NULL);
444 ok(hr == S_OK, "Got hr %#lx.\n", hr);
446 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
447 ref = get_refcount(pins[0]);
448 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
449 ref = get_refcount(enum1);
450 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
451 IPin_Release(pins[0]);
453 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
454
455 hr = IEnumPins_Next(enum1, 1, pins, NULL);
456 ok(hr == S_OK, "Got hr %#lx.\n", hr);
458 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
459 ref = get_refcount(pins[0]);
460 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
461 ref = get_refcount(enum1);
462 ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
463 IPin_Release(pins[0]);
465 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
466
467 hr = IEnumPins_Next(enum1, 1, pins, NULL);
468 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
469
470 hr = IEnumPins_Reset(enum1);
471 ok(hr == S_OK, "Got hr %#lx.\n", hr);
472
473 hr = IEnumPins_Next(enum1, 1, pins, &count);
474 ok(hr == S_OK, "Got hr %#lx.\n", hr);
475 ok(count == 1, "Got count %lu.\n", count);
476 IPin_Release(pins[0]);
477
478 hr = IEnumPins_Next(enum1, 1, pins, &count);
479 ok(hr == S_OK, "Got hr %#lx.\n", hr);
480 ok(count == 1, "Got count %lu.\n", count);
481 IPin_Release(pins[0]);
482
483 hr = IEnumPins_Next(enum1, 1, pins, &count);
484 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
485 ok(!count, "Got count %lu.\n", count);
486
487 hr = IEnumPins_Reset(enum1);
488 ok(hr == S_OK, "Got hr %#lx.\n", hr);
489
490 hr = IEnumPins_Next(enum1, 2, pins, NULL);
491 ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
492
493 hr = IEnumPins_Next(enum1, 2, pins, &count);
494 ok(hr == S_OK, "Got hr %#lx.\n", hr);
495 ok(count == 2, "Got count %lu.\n", count);
496 IPin_Release(pins[0]);
497 IPin_Release(pins[1]);
498
499 hr = IEnumPins_Next(enum1, 2, pins, &count);
500 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
501 ok(!count, "Got count %lu.\n", count);
502
503 hr = IEnumPins_Reset(enum1);
504 ok(hr == S_OK, "Got hr %#lx.\n", hr);
505
506 hr = IEnumPins_Next(enum1, 3, pins, &count);
507 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
508 ok(count == 2, "Got count %lu.\n", count);
509 IPin_Release(pins[0]);
510 IPin_Release(pins[1]);
511
512 hr = IEnumPins_Reset(enum1);
513 ok(hr == S_OK, "Got hr %#lx.\n", hr);
514
515 hr = IEnumPins_Clone(enum1, &enum2);
516 ok(hr == S_OK, "Got hr %#lx.\n", hr);
517
518 hr = IEnumPins_Skip(enum1, 3);
519 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
520
521 hr = IEnumPins_Skip(enum1, 2);
522 ok(hr == S_OK, "Got hr %#lx.\n", hr);
523
524 hr = IEnumPins_Skip(enum1, 1);
525 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
526
527 hr = IEnumPins_Next(enum1, 1, pins, NULL);
528 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
529
530 hr = IEnumPins_Next(enum2, 1, pins, NULL);
531 ok(hr == S_OK, "Got hr %#lx.\n", hr);
532 IPin_Release(pins[0]);
533
534 IEnumPins_Release(enum2);
535 IEnumPins_Release(enum1);
536 ref = IBaseFilter_Release(filter);
537 ok(!ref, "Got outstanding refcount %ld.\n", ref);
538}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_POINTER
Definition: winerror.h:3480

Referenced by START_TEST().

◆ test_find_pin()

static void test_find_pin ( void  )
static

Definition at line 540 of file mpegaudio.c.

541{
544 IPin *pin, *pin2;
545 HRESULT hr;
546 ULONG ref;
547
548 hr = IBaseFilter_EnumPins(filter, &enum_pins);
549 ok(hr == S_OK, "Got hr %#lx.\n", hr);
550
551 hr = IBaseFilter_FindPin(filter, L"In", &pin);
552 ok(hr == S_OK, "Got hr %#lx.\n", hr);
553 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
554 ok(hr == S_OK, "Got hr %#lx.\n", hr);
555 ok(pin == pin2, "Pins didn't match.\n");
556 IPin_Release(pin);
557 IPin_Release(pin2);
558
559 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
560 ok(hr == S_OK, "Got hr %#lx.\n", hr);
561 hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
562 ok(hr == S_OK, "Got hr %#lx.\n", hr);
563 ok(pin == pin2, "Pins didn't match.\n");
564 IPin_Release(pin);
565 IPin_Release(pin2);
566
567 hr = IBaseFilter_FindPin(filter, L"XForm In", &pin);
568 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
569 hr = IBaseFilter_FindPin(filter, L"XForm Out", &pin);
570 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
571 hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
572 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
573 hr = IBaseFilter_FindPin(filter, L"output pin", &pin);
574 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
575
576 IEnumPins_Release(enum_pins);
577 ref = IBaseFilter_Release(filter);
578 ok(!ref, "Got outstanding refcount %ld.\n", ref);
579}
#define VFW_E_NOT_FOUND
Definition: vfwmsgs.h:61

Referenced by START_TEST().

◆ test_interfaces()

static void test_interfaces ( void  )
static

Definition at line 217 of file mpegaudio.c.

218{
220 IPin *pin;
221
223 check_interface(filter, &IID_IMediaFilter, TRUE);
224 check_interface(filter, &IID_IMpegAudioDecoder, TRUE);
227
228 check_interface(filter, &IID_IAMFilterMiscFlags, FALSE);
229 check_interface(filter, &IID_IBasicAudio, FALSE);
230 check_interface(filter, &IID_IBasicVideo, FALSE);
232 check_interface(filter, &IID_IMediaPosition, FALSE);
233 check_interface(filter, &IID_IMediaSeeking, FALSE);
235 check_interface(filter, &IID_IQualityControl, FALSE);
236 check_interface(filter, &IID_IQualProp, FALSE);
237 check_interface(filter, &IID_IReferenceClock, FALSE);
238 check_interface(filter, &IID_IVideoWindow, FALSE);
240
241 IBaseFilter_FindPin(filter, L"In", &pin);
242
243 check_interface(pin, &IID_IMemInputPin, TRUE);
245 check_interface(pin, &IID_IQualityControl, TRUE);
247
248 check_interface(pin, &IID_IMediaPosition, FALSE);
249 check_interface(pin, &IID_IMediaSeeking, FALSE);
250
251 IPin_Release(pin);
252
253 IBaseFilter_FindPin(filter, L"Out", &pin);
254
256 check_interface(pin, &IID_IMediaPosition, TRUE);
257 check_interface(pin, &IID_IMediaSeeking, TRUE);
258 check_interface(pin, &IID_IQualityControl, TRUE);
260
262
263 IPin_Release(pin);
264
265 IBaseFilter_Release(filter);
266}
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
const GUID IID_IAsyncReader
#define FALSE
Definition: types.h:117
#define check_interface(a, b, c)
Definition: mpegaudio.c:202
const GUID IID_IPin
Definition: pincontrol.cpp:15
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11

Referenced by START_TEST().

◆ test_media_types()

static void test_media_types ( void  )
static

Definition at line 725 of file mpegaudio.c.

726{
729 AM_MEDIA_TYPE mt;
730 HRESULT hr;
731 ULONG ref;
732 IPin *pin;
733
734 IBaseFilter_FindPin(filter, L"In", &pin);
735
736 hr = IPin_QueryAccept(pin, &mp1_mt);
737 ok(hr == S_OK, "Got hr %#lx.\n", hr);
738
739 hr = IPin_QueryAccept(pin, &mp2_mt);
740 ok(hr == S_OK, "Got hr %#lx.\n", hr);
741
742 mt = mp2_mt;
743 mt.subtype = MEDIASUBTYPE_MPEG1Packet;
744 hr = IPin_QueryAccept(pin, &mt);
745 ok(hr == S_OK, "Got hr %#lx.\n", hr);
746
747 mt = mp2_mt;
748 mt.subtype = MEDIASUBTYPE_MPEG1Payload;
749 hr = IPin_QueryAccept(pin, &mt);
750 ok(hr == S_OK, "Got hr %#lx.\n", hr);
751
752 mt = mp2_mt;
753 mt.subtype = GUID_NULL;
754 hr = IPin_QueryAccept(pin, &mt);
755 ok(hr == S_OK, "Got hr %#lx.\n", hr);
756
757 hr = IPin_QueryAccept(pin, &mp3_mt0);
758 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
759
760 hr = IPin_QueryAccept(pin, &mp3_mt1);
761 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
762
763 mt = mp2_mt;
764 mt.majortype = GUID_NULL;
765 hr = IPin_QueryAccept(pin, &mt);
766 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
767
768 mt = mp2_mt;
769 mt.subtype = MEDIASUBTYPE_PCM;
770 hr = IPin_QueryAccept(pin, &mt);
771 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
772
773 mt = mp2_mt;
774 mt.formattype = GUID_NULL;
775 hr = IPin_QueryAccept(pin, &mt);
776 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
777
778 IPin_Release(pin);
779
780 IBaseFilter_FindPin(filter, L"Out", &pin);
781
782 init_pcm_mt(&mt, &format, 1, 32000, 16);
783 hr = IPin_QueryAccept(pin, &mt);
784 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
785
786 IPin_Release(pin);
787
788 ref = IBaseFilter_Release(filter);
789 ok(!ref, "Got outstanding refcount %ld.\n", ref);
790}
static const AM_MEDIA_TYPE mp3_mt1
Definition: mpegaudio.c:121
static const AM_MEDIA_TYPE mp2_mt
Definition: mpegaudio.c:70
static const AM_MEDIA_TYPE mp3_mt0
Definition: mpegaudio.c:96

Referenced by START_TEST().

◆ test_pin_info()

static void test_pin_info ( void  )
static

Definition at line 581 of file mpegaudio.c.

582{
586 HRESULT hr;
587 WCHAR *id;
588 ULONG ref;
589 IPin *pin;
590
591 hr = IBaseFilter_FindPin(filter, L"In", &pin);
592 ok(hr == S_OK, "Got hr %#lx.\n", hr);
594 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
595 ref = get_refcount(pin);
596 ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
597
598 hr = IPin_QueryPinInfo(pin, &info);
599 ok(hr == S_OK, "Got hr %#lx.\n", hr);
600 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
601 ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
602 ok(!wcscmp(info.achName, L"XForm In"), "Got name %s.\n", debugstr_w(info.achName));
604 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
605 ref = get_refcount(pin);
606 ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
607 IBaseFilter_Release(info.pFilter);
608
609 hr = IPin_QueryDirection(pin, &dir);
610 ok(hr == S_OK, "Got hr %#lx.\n", hr);
611 ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
612
613 hr = IPin_QueryId(pin, &id);
614 ok(hr == S_OK, "Got hr %#lx.\n", hr);
615 ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id));
616 CoTaskMemFree(id);
617
618 hr = IPin_QueryInternalConnections(pin, NULL, NULL);
619 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
620
621 IPin_Release(pin);
622
623 hr = IBaseFilter_FindPin(filter, L"Out", &pin);
624 ok(hr == S_OK, "Got hr %#lx.\n", hr);
625 hr = IPin_QueryPinInfo(pin, &info);
626 ok(hr == S_OK, "Got hr %#lx.\n", hr);
627 ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
628 ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
629 ok(!wcscmp(info.achName, L"XForm Out"), "Got name %s.\n", debugstr_w(info.achName));
630 IBaseFilter_Release(info.pFilter);
631
632 hr = IPin_QueryDirection(pin, &dir);
633 ok(hr == S_OK, "Got hr %#lx.\n", hr);
634 ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
635
636 hr = IPin_QueryId(pin, &id);
637 ok(hr == S_OK, "Got hr %#lx.\n", hr);
638 ok(!wcscmp(id, L"Out"), "Got id %s.\n", wine_dbgstr_w(id));
639 CoTaskMemFree(id);
640
641 hr = IPin_QueryInternalConnections(pin, NULL, NULL);
642 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
643
644 IPin_Release(pin);
645
646 ref = IBaseFilter_Release(filter);
647 ok(!ref, "Got outstanding refcount %ld.\n", ref);
648}
unsigned int dir
Definition: maze.c:112
enum _PinDirection PIN_DIRECTION
@ PINDIR_OUTPUT
Definition: axcore.idl:42
@ PINDIR_INPUT
Definition: axcore.idl:41
#define E_NOTIMPL
Definition: ddrawi.h:99
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
GLuint id
Definition: glext.h:5910
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
short WCHAR
Definition: pedump.c:58

Referenced by START_TEST().

◆ test_quality_control()

static void test_quality_control ( IFilterGraph2 *  graph,
IBaseFilter *  filter,
IPin *  sink,
IPin *  source,
struct testfilter *  testsource,
struct testfilter *  testsink 
)
static

Definition at line 1235 of file mpegaudio.c.

1237{
1238 struct testqc testsource_qc;
1239 IQualityControl *source_qc;
1240 IQualityControl *sink_qc;
1241 Quality quality = {0};
1242 struct testqc qc;
1243 HRESULT hr;
1244
1245 testqc_init(&testsource_qc, testsource->filter.outer_unk);
1246 testqc_init(&qc, NULL);
1247
1248 hr = IPin_QueryInterface(sink, &IID_IQualityControl, (void **)&sink_qc);
1249 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1250 hr = IPin_QueryInterface(source, &IID_IQualityControl, (void **)&source_qc);
1251 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1252
1253 hr = IQualityControl_Notify(sink_qc, &testsink->filter.IBaseFilter_iface, quality);
1254 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1255
1256 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1257 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1258
1259 hr = IQualityControl_SetSink(sink_qc, &qc.IQualityControl_iface);
1260 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1261 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1262 memset(&qc.notify_quality, 0xaa, sizeof(qc.notify_quality));
1263 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1264 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1265 ok(qc.notify_sender == filter, "Got sender %p.\n", qc.notify_sender);
1266 ok(!memcmp(&qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n");
1267 hr = IQualityControl_SetSink(sink_qc, NULL);
1268 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1269
1270 hr = IQualityControl_SetSink(source_qc, &qc.IQualityControl_iface);
1271 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1272 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1273 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1274 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1275 ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender);
1276 hr = IQualityControl_SetSink(source_qc, NULL);
1277 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1278
1279 hr = IFilterGraph2_ConnectDirect(graph, &testsource->source.pin.IPin_iface, sink, &mp2_mt);
1280 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1281
1282 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1283 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1284
1285 testsource->qc = &testsource_qc;
1286
1287 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1288 hr = IQualityControl_Notify(sink_qc, &testsink->filter.IBaseFilter_iface, quality);
1289 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1290 ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender);
1291
1292 testsource_qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1293 memset(&testsource_qc.notify_quality, 0xaa, sizeof(testsource_qc.notify_quality));
1294 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1295 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1296 ok(testsource_qc.notify_sender == filter, "Got sender %p.\n", testsource_qc.notify_sender);
1297 ok(!memcmp(&testsource_qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n");
1298
1299 testsource_qc.notify_hr = E_FAIL;
1300 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1301 ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
1302 testsource_qc.notify_hr = S_OK;
1303
1304 hr = IQualityControl_SetSink(sink_qc, &qc.IQualityControl_iface);
1305 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1306 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1307 memset(&qc.notify_quality, 0xaa, sizeof(qc.notify_quality));
1308 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1309 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1310 ok(qc.notify_sender == filter, "Got sender %p.\n", qc.notify_sender);
1311 ok(!memcmp(&qc.notify_quality, &quality, sizeof(quality)), "Quality didn't match.\n");
1312 hr = IQualityControl_SetSink(sink_qc, NULL);
1313 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1314
1315 hr = IQualityControl_SetSink(source_qc, &qc.IQualityControl_iface);
1316 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1317 qc.notify_sender = (IBaseFilter *)0xdeadbeef;
1318 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1319 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1320 ok(qc.notify_sender == (IBaseFilter *)0xdeadbeef, "Got sender %p.\n", qc.notify_sender);
1321 hr = IQualityControl_SetSink(source_qc, NULL);
1322 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1323
1324 IFilterGraph2_Disconnect(graph, sink);
1325 IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface);
1326
1327 hr = IQualityControl_Notify(source_qc, &testsink->filter.IBaseFilter_iface, quality);
1328 ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
1329
1330 IQualityControl_Release(source_qc);
1331 IQualityControl_Release(sink_qc);
1332
1333 testsource->qc = NULL;
1334}
#define E_FAIL
Definition: ddrawi.h:102
int quality
Definition: jpeglib.h:994
static void testqc_init(struct testqc *qc, IUnknown *outer)
Definition: mpegaudio.c:890
struct testqc * qc
Definition: mpegaudio.c:903
struct strmbase_filter filter
Definition: amstream.c:1019

Referenced by test_connect_pin().

◆ test_sample_processing()

static void test_sample_processing ( IMediaControl *  control,
IMemInputPin *  input,
struct testfilter *  sink 
)
static

Definition at line 1336 of file mpegaudio.c.

1337{
1338 REFERENCE_TIME start, stop;
1341 HRESULT hr;
1342 BYTE *data;
1343 LONG size;
1344
1345 hr = IMemInputPin_ReceiveCanBlock(input);
1346 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1347
1348 hr = IMemInputPin_GetAllocator(input, &allocator);
1349 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1350
1351 hr = IMediaControl_Pause(control);
1352 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1353
1354 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1355 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
1356
1357 hr = IMemAllocator_Commit(allocator);
1358 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1359 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1360 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1361
1362 hr = IMediaSample_GetPointer(sample, &data);
1363 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1364 size = IMediaSample_GetSize(sample);
1365 ok(size == 256, "Got size %ld.\n", size);
1366 memset(data, 0, 48);
1367 data[0] = 0xff;
1368 data[1] = 0xff;
1369 data[2] = 0x18;
1370 data[3] = 0xc4;
1371 hr = IMediaSample_SetActualDataLength(sample, 48);
1372 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1373
1374 hr = IMediaSample_SetTime(sample, NULL, NULL);
1375 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1376
1377 sink->expected_start_time = 0;
1378 sink->expected_stop_time = 120000;
1379 hr = IMemInputPin_Receive(input, sample);
1380 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1381 hr = IMemInputPin_Receive(input, sample);
1382 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1383 hr = IMemInputPin_Receive(input, sample);
1384 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1385 ok(sink->got_sample >= 1, "Got %u calls to Receive().\n", sink->got_sample);
1386 sink->got_sample = 0;
1387
1388 hr = IMediaControl_Stop(control);
1389 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1390 hr = IMediaControl_Pause(control);
1391 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1392
1393 start = 22222;
1394 hr = IMediaSample_SetTime(sample, &start, NULL);
1395 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1396
1397 sink->expected_start_time = 22222;
1398 sink->expected_stop_time = 142222;
1399 hr = IMemInputPin_Receive(input, sample);
1400 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1401 hr = IMemInputPin_Receive(input, sample);
1402 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1403 hr = IMemInputPin_Receive(input, sample);
1404 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1405 ok(sink->got_sample >= 1, "Got %u calls to Receive().\n", sink->got_sample);
1406 sink->got_sample = 0;
1407
1408 hr = IMediaControl_Stop(control);
1409 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1410 hr = IMediaControl_Pause(control);
1411 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1412
1413 start = 22222;
1414 stop = 33333;
1415 hr = IMediaSample_SetTime(sample, &start, &stop);
1416 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1417
1418 sink->expected_start_time = 22222;
1419 sink->expected_stop_time = 142222;
1420 hr = IMemInputPin_Receive(input, sample);
1421 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1422 hr = IMemInputPin_Receive(input, sample);
1423 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1424 hr = IMemInputPin_Receive(input, sample);
1425 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1426 ok(sink->got_sample >= 1, "Got %u calls to Receive().\n", sink->got_sample);
1427 sink->got_sample = 0;
1428
1429 hr = IMediaControl_Stop(control);
1430 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1431
1432 hr = IMemInputPin_Receive(input, sample);
1433 ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
1434
1435 IMediaSample_Release(sample);
1436 IMemAllocator_Release(allocator);
1437}
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
GLuint start
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum GLenum input
Definition: glext.h:9031
long LONG
Definition: pedump.c:60
Definition: wave.c:25
#define VFW_E_NOT_COMMITTED
Definition: vfwmsgs.h:56
#define VFW_E_WRONG_STATE
Definition: vfwmsgs.h:78

Referenced by test_connect_pin().

◆ test_sink_allocator()

static void test_sink_allocator ( IMemInputPin *  input)
static

Definition at line 1078 of file mpegaudio.c.

1079{
1080 IMemAllocator *req_allocator, *ret_allocator;
1081 ALLOCATOR_PROPERTIES props, ret_props;
1082 HRESULT hr;
1083
1084 hr = IMemInputPin_GetAllocatorRequirements(input, &props);
1085 ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
1086
1087 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
1088 todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
1089
1090 if (hr == S_OK)
1091 {
1092 hr = IMemAllocator_GetProperties(ret_allocator, &props);
1093 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1094 ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
1095 ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
1096 ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
1097 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1098
1099 hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
1100 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1101 IMemAllocator_Release(ret_allocator);
1102 }
1103
1104 hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
1105 ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
1106
1107 CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
1108 &IID_IMemAllocator, (void **)&req_allocator);
1109
1110 props.cBuffers = 1;
1111 props.cbBuffer = 256;
1112 props.cbAlign = 1;
1113 props.cbPrefix = 0;
1114 hr = IMemAllocator_SetProperties(req_allocator, &props, &ret_props);
1115 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1116
1117 hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
1118 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1119
1120 hr = IMemInputPin_GetAllocator(input, &ret_allocator);
1121 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1122 ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
1123
1124 IMemAllocator_Release(req_allocator);
1125 IMemAllocator_Release(ret_allocator);
1126}
#define todo_wine
Definition: minitest.h:80
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by test_connect_pin().

◆ test_source_allocator()

static void test_source_allocator ( IFilterGraph2 *  graph,
IMediaControl *  control,
IPin *  sink,
IPin *  source,
struct testfilter *  testsource,
struct testfilter *  testsink 
)
static

Definition at line 1128 of file mpegaudio.c.

1130{
1131 ALLOCATOR_PROPERTIES props, req_props = {2, 30000, 32, 0};
1135 AM_MEDIA_TYPE mt;
1136 HRESULT hr;
1137
1138 hr = IFilterGraph2_ConnectDirect(graph, &testsource->source.pin.IPin_iface, sink, &mp2_mt);
1139 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1140
1141 init_pcm_mt(&mt, &format, 1, 32000, 16);
1142 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt);
1143 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1144
1145 ok(!!testsink->sink.pAllocator, "Expected an allocator.\n");
1146 hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props);
1147 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1148 ok(props.cBuffers == 8, "Got %ld buffers.\n", props.cBuffers);
1149 ok(props.cbBuffer == 9216, "Got size %ld.\n", props.cbBuffer);
1150 ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
1151 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1152
1153 hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
1154 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
1155
1156 hr = IMediaControl_Pause(control);
1157 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1158
1159 hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
1160 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1161 if (hr == S_OK)
1162 IMediaSample_Release(sample);
1163
1164 hr = IMediaControl_Stop(control);
1165 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1166
1167 hr = IMemAllocator_GetBuffer(testsink->sink.pAllocator, &sample, NULL, NULL, 0);
1168 ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
1169
1170 IFilterGraph2_Disconnect(graph, source);
1171 IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
1172
1173 init_pcm_mt(&mt, &format, 1, 32000, 8);
1174 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt);
1175 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1176
1177 ok(!!testsink->sink.pAllocator, "Expected an allocator.\n");
1178 hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props);
1179 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1180 ok(props.cBuffers == 8, "Got %ld buffers.\n", props.cBuffers);
1181 ok(props.cbBuffer == 4608, "Got size %ld.\n", props.cbBuffer);
1182 ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
1183 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1184
1185 IFilterGraph2_Disconnect(graph, source);
1186 IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
1187
1188 CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
1189 &IID_IMemAllocator, (void **)&allocator);
1190 testsink->sink.pAllocator = allocator;
1191
1192 hr = IMemAllocator_SetProperties(allocator, &req_props, &props);
1193 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1194
1195 init_pcm_mt(&mt, &format, 1, 32000, 16);
1196 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt);
1197 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1198
1199 ok(testsink->sink.pAllocator == allocator, "Expected an allocator.\n");
1200 hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props);
1201 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1202 ok(props.cBuffers == 8, "Got %ld buffers.\n", props.cBuffers);
1203 ok(props.cbBuffer == 9216, "Got size %ld.\n", props.cbBuffer);
1204 ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
1205 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1206
1207 IFilterGraph2_Disconnect(graph, source);
1208 IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
1209
1210 IFilterGraph2_Disconnect(graph, sink);
1211 IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface);
1212
1213 hr = IFilterGraph2_ConnectDirect(graph, &testsource->source.pin.IPin_iface, sink, &mp1_mt);
1214 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1215
1216 init_pcm_mt(&mt, &format, 1, 32000, 16);
1217 hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt);
1218 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1219
1220 ok(!!testsink->sink.pAllocator, "Expected an allocator.\n");
1221 hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props);
1222 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1223 ok(props.cBuffers == 8, "Got %ld buffers.\n", props.cBuffers);
1224 ok(props.cbBuffer == 3072, "Got size %ld.\n", props.cbBuffer);
1225 ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
1226 ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
1227
1228 IFilterGraph2_Disconnect(graph, source);
1229 IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
1230
1231 IFilterGraph2_Disconnect(graph, sink);
1232 IFilterGraph2_Disconnect(graph, &testsource->source.pin.IPin_iface);
1233}

Referenced by test_connect_pin().

◆ test_streaming_events()

static void test_streaming_events ( IMediaControl *  control,
IPin *  sink,
IMemInputPin *  input,
struct testfilter *  testsink 
)
static

Definition at line 1439 of file mpegaudio.c.

1441{
1442 REFERENCE_TIME start, stop;
1445 HRESULT hr;
1446 BYTE *data;
1447
1448 hr = IMediaControl_Pause(control);
1449 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1450
1451 hr = IMemInputPin_GetAllocator(input, &allocator);
1452 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1453 hr = IMemAllocator_Commit(allocator);
1454 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1455 hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
1456 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1457 hr = IMediaSample_GetPointer(sample, &data);
1458 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1459 memset(data, 0, 48);
1460 data[0] = 0xff;
1461 data[1] = 0xff;
1462 data[2] = 0x18;
1463 data[3] = 0xc4;
1464 hr = IMediaSample_SetActualDataLength(sample, 48);
1465 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1466 start = 0;
1467 stop = 120000;
1468 hr = IMediaSample_SetTime(sample, &start, &stop);
1469 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1470
1471 ok(!testsink->got_new_segment, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
1472 hr = IPin_NewSegment(sink, 10000, 20000, 1.0);
1473 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1474 ok(testsink->got_new_segment == 1, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
1475
1476 ok(!testsink->got_eos, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1477 hr = IPin_EndOfStream(sink);
1478 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1479 ok(!testsink->got_sample, "Got %u calls to Receive().\n", testsink->got_sample);
1480 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1481 testsink->got_eos = 0;
1482
1483 hr = IPin_EndOfStream(sink);
1484 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1485 ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
1486
1487 testsink->expected_start_time = 0;
1488 testsink->expected_stop_time = 120000;
1489 hr = IMemInputPin_Receive(input, sample);
1490 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1491 hr = IMemInputPin_Receive(input, sample);
1492 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1493 hr = IMemInputPin_Receive(input, sample);
1494 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1495 ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample);
1496 testsink->got_sample = 0;
1497
1498 ok(!testsink->got_begin_flush, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
1499 hr = IPin_BeginFlush(sink);
1500 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1501 ok(testsink->got_begin_flush == 1, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
1502
1503 hr = IMemInputPin_Receive(input, sample);
1504 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1505
1506 hr = IPin_EndOfStream(sink);
1507 ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
1508
1509 ok(!testsink->got_end_flush, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
1510 hr = IPin_EndFlush(sink);
1511 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1512 ok(testsink->got_end_flush == 1, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
1513
1514 testsink->expected_start_time = 0;
1515 testsink->expected_stop_time = 120000;
1516 testsink->todo_time = TRUE;
1517 hr = IMemInputPin_Receive(input, sample);
1518 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1519 hr = IMemInputPin_Receive(input, sample);
1520 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1521 hr = IMemInputPin_Receive(input, sample);
1522 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1523 ok(testsink->got_sample >= 1, "Got %u calls to Receive().\n", testsink->got_sample);
1524 testsink->got_sample = 0;
1525
1526 hr = IMediaControl_Stop(control);
1527 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1528 IMediaSample_Release(sample);
1529 IMemAllocator_Release(allocator);
1530}

Referenced by test_connect_pin().

◆ test_unconnected_filter_state()

static void test_unconnected_filter_state ( void  )
static

Definition at line 362 of file mpegaudio.c.

363{
365 FILTER_STATE state;
366 HRESULT hr;
367 ULONG ref;
368
369 hr = IBaseFilter_GetState(filter, 0, &state);
370 ok(hr == S_OK, "Got hr %#lx.\n", hr);
371 ok(state == State_Stopped, "Got state %u.\n", state);
372
373 hr = IBaseFilter_Pause(filter);
374 ok(hr == S_OK, "Got hr %#lx.\n", hr);
375
376 hr = IBaseFilter_GetState(filter, 0, &state);
377 ok(hr == S_OK, "Got hr %#lx.\n", hr);
378 ok(state == State_Paused, "Got state %u.\n", state);
379
380 hr = IBaseFilter_Run(filter, 0);
381 ok(hr == S_OK, "Got hr %#lx.\n", hr);
382
383 hr = IBaseFilter_GetState(filter, 0, &state);
384 ok(hr == S_OK, "Got hr %#lx.\n", hr);
385 ok(state == State_Running, "Got state %u.\n", state);
386
387 hr = IBaseFilter_Pause(filter);
388 ok(hr == S_OK, "Got hr %#lx.\n", hr);
389
390 hr = IBaseFilter_GetState(filter, 0, &state);
391 ok(hr == S_OK, "Got hr %#lx.\n", hr);
392 ok(state == State_Paused, "Got state %u.\n", state);
393
394 hr = IBaseFilter_Stop(filter);
395 ok(hr == S_OK, "Got hr %#lx.\n", hr);
396
397 hr = IBaseFilter_GetState(filter, 0, &state);
398 ok(hr == S_OK, "Got hr %#lx.\n", hr);
399 ok(state == State_Stopped, "Got state %u.\n", state);
400
401 hr = IBaseFilter_Run(filter, 0);
402 ok(hr == S_OK, "Got hr %#lx.\n", hr);
403
404 hr = IBaseFilter_GetState(filter, 0, &state);
405 ok(hr == S_OK, "Got hr %#lx.\n", hr);
406 ok(state == State_Running, "Got state %u.\n", state);
407
408 hr = IBaseFilter_Stop(filter);
409 ok(hr == S_OK, "Got hr %#lx.\n", hr);
410
411 hr = IBaseFilter_GetState(filter, 0, &state);
412 ok(hr == S_OK, "Got hr %#lx.\n", hr);
413 ok(state == State_Stopped, "Got state %u.\n", state);
414
415 ref = IBaseFilter_Release(filter);
416 ok(!ref, "Got outstanding refcount %ld.\n", ref);
417}
static int state
Definition: maze.c:121

Referenced by START_TEST().

◆ testfilter_destroy()

static void testfilter_destroy ( struct strmbase_filter *  iface)
static

Definition at line 924 of file mpegaudio.c.

925{
930}
static struct testfilter * impl_from_strmbase_filter(struct strmbase_filter *iface)
Definition: mpegaudio.c:911
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

◆ testfilter_get_pin()

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

Definition at line 916 of file mpegaudio.c.

917{
919 if (!index)
920 return &filter->source.pin;
921 return NULL;
922}
GLuint index
Definition: glext.h:6031

◆ testfilter_init()

static void testfilter_init ( struct testfilter *  filter)
static

Definition at line 1069 of file mpegaudio.c.

1070{
1071 static const GUID clsid = {0xabacab};
1072 memset(filter, 0, sizeof(*filter));
1074 strmbase_source_init(&filter->source, &filter->filter, L"source", &testsource_ops);
1076}
static const struct strmbase_sink_ops testsink_ops
Definition: mpegaudio.c:1057
static const struct strmbase_source_ops testsource_ops
Definition: mpegaudio.c:957
static const struct strmbase_filter_ops testfilter_ops
Definition: mpegaudio.c:932
const CLSID * clsid
Definition: msctf.cpp:50
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_filter_init(struct strmbase_filter *filter, IUnknown *outer, const CLSID *clsid, const struct strmbase_filter_ops *func_table)
Definition: filter.c:517

Referenced by test_connect_pin().

◆ testqc_AddRef()

static ULONG WINAPI testqc_AddRef ( IQualityControl *  iface)
static

Definition at line 814 of file mpegaudio.c.

815{
816 struct testqc *qc = impl_from_IQualityControl(iface);
817 return IUnknown_AddRef(qc->outer_unk);
818}
static struct testqc * impl_from_IQualityControl(IQualityControl *iface)
Definition: mpegaudio.c:803
IUnknown * outer_unk
Definition: mpegaudio.c:796

◆ testqc_init()

static void testqc_init ( struct testqc *  qc,
IUnknown *  outer 
)
static

Definition at line 890 of file mpegaudio.c.

891{
892 memset(qc, 0, sizeof(*qc));
894 qc->IUnknown_inner.lpVtbl = &testqc_inner_vtbl;
895 qc->outer_unk = outer ? outer : &qc->IUnknown_inner;
896}
static IUnknown * outer
Definition: compobj.c:82
static const IUnknownVtbl testqc_inner_vtbl
Definition: mpegaudio.c:883
static const IQualityControlVtbl testqc_vtbl
Definition: mpegaudio.c:842
IUnknown IUnknown_inner
Definition: mpegaudio.c:795
IQualityControl IQualityControl_iface
Definition: mpegaudio.c:794

Referenced by test_quality_control().

◆ testqc_inner_AddRef()

static ULONG WINAPI testqc_inner_AddRef ( IUnknown *  iface)
static

Definition at line 871 of file mpegaudio.c.

872{
873 struct testqc *qc = impl_from_qc_IUnknown(iface);
874 return InterlockedIncrement(&qc->refcount);
875}
static struct testqc * impl_from_qc_IUnknown(IUnknown *iface)
Definition: mpegaudio.c:851
LONG refcount
Definition: mpegaudio.c:797

◆ testqc_inner_QueryInterface()

static HRESULT WINAPI testqc_inner_QueryInterface ( IUnknown *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 856 of file mpegaudio.c.

857{
858 struct testqc *qc = impl_from_qc_IUnknown(iface);
859
860 if (IsEqualIID(iid, &IID_IUnknown))
861 *out = iface;
862 else if (IsEqualIID(iid, &IID_IQualityControl))
864 else
865 return E_NOINTERFACE;
866
867 IUnknown_AddRef((IUnknown *)*out);
868 return S_OK;
869}
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ testqc_inner_Release()

static ULONG WINAPI testqc_inner_Release ( IUnknown *  iface)
static

Definition at line 877 of file mpegaudio.c.

878{
879 struct testqc *qc = impl_from_qc_IUnknown(iface);
880 return InterlockedDecrement(&qc->refcount);
881}

◆ testqc_Notify()

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

Definition at line 826 of file mpegaudio.c.

827{
828 struct testqc *qc = impl_from_IQualityControl(iface);
829
830 qc->notify_sender = sender;
831 qc->notify_quality = q;
832
833 return qc->notify_hr;
834}
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
HRESULT notify_hr
Definition: mpegaudio.c:800
Quality notify_quality
Definition: mpegaudio.c:799
IBaseFilter * notify_sender
Definition: mpegaudio.c:798

◆ testqc_QueryInterface()

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

Definition at line 808 of file mpegaudio.c.

809{
810 struct testqc *qc = impl_from_IQualityControl(iface);
811 return IUnknown_QueryInterface(qc->outer_unk, iid, out);
812}

◆ testqc_Release()

static ULONG WINAPI testqc_Release ( IQualityControl *  iface)
static

Definition at line 820 of file mpegaudio.c.

821{
822 struct testqc *qc = impl_from_IQualityControl(iface);
823 return IUnknown_Release(qc->outer_unk);
824}

◆ testqc_SetSink()

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

Definition at line 836 of file mpegaudio.c.

837{
838 ok(0, "Unexpected call.\n");
839 return E_NOTIMPL;
840}

◆ testsink_begin_flush()

static HRESULT testsink_begin_flush ( struct strmbase_sink *  iface)
static

Definition at line 1043 of file mpegaudio.c.

1044{
1045 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1046 ++filter->got_begin_flush;
1047 return S_OK;
1048}
struct strmbase_pin pin
Definition: strmbase.h:106

◆ testsink_connect()

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

Definition at line 988 of file mpegaudio.c.

989{
990 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
991 if (filter->mt && !IsEqualGUID(&mt->majortype, &filter->mt->majortype))
993 return S_OK;
994}

◆ testsink_end_flush()

static HRESULT testsink_end_flush ( struct strmbase_sink *  iface)
static

Definition at line 1050 of file mpegaudio.c.

1051{
1052 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1053 ++filter->got_end_flush;
1054 return S_OK;
1055}

◆ testsink_eos()

static HRESULT testsink_eos ( struct strmbase_sink *  iface)
static

Definition at line 1036 of file mpegaudio.c.

1037{
1038 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1039 ++filter->got_eos;
1040 return S_OK;
1041}

◆ testsink_get_media_type()

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

Definition at line 977 of file mpegaudio.c.

978{
980 if (!index && filter->mt)
981 {
982 CopyMediaType(mt, filter->mt);
983 return S_OK;
984 }
985 return VFW_S_NO_MORE_ITEMS;
986}
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: mediatype.c:150
struct strmbase_filter * filter
Definition: strmbase.h:58
#define VFW_S_NO_MORE_ITEMS
Definition: vfwmsgs.h:19

◆ testsink_new_segment()

static HRESULT testsink_new_segment ( struct strmbase_sink *  iface,
REFERENCE_TIME  start,
REFERENCE_TIME  stop,
double  rate 
)
static

Definition at line 1025 of file mpegaudio.c.

1027{
1028 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
1029 ++filter->got_new_segment;
1030 ok(start == 10000, "Got start %s.\n", wine_dbgstr_longlong(start));
1031 ok(stop == 20000, "Got stop %s.\n", wine_dbgstr_longlong(stop));
1032 ok(rate == 1.0, "Got rate %.16e.\n", rate);
1033 return S_OK;
1034}
unsigned int rate
Definition: audiorecord.c:87
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

◆ testsink_query_interface()

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

Definition at line 964 of file mpegaudio.c.

965{
967
968 if (IsEqualGUID(iid, &IID_IMemInputPin))
969 *out = &filter->sink.IMemInputPin_iface;
970 else
971 return E_NOINTERFACE;
972
973 IUnknown_AddRef((IUnknown *)*out);
974 return S_OK;
975}

◆ testsink_Receive()

static HRESULT WINAPI testsink_Receive ( struct strmbase_sink *  iface,
IMediaSample *  sample 
)
static

Definition at line 996 of file mpegaudio.c.

997{
998 struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
999 REFERENCE_TIME start, stop;
1000 HRESULT hr;
1001 LONG size;
1002
1003 ++filter->got_sample;
1004
1005 size = IMediaSample_GetSize(sample);
1006 ok(size == 3072, "Got size %lu.\n", size);
1007 size = IMediaSample_GetActualDataLength(sample);
1008 ok(size == 768, "Got valid size %lu.\n", size);
1009
1010 start = 0xdeadbeef;
1011 stop = 0xdeadbeef;
1012 hr = IMediaSample_GetTime(sample, &start, &stop);
1013 ok(hr == S_OK, "Got hr %#lx.\n", hr);
1014 if (filter->got_sample == 1)
1015 {
1016 todo_wine_if(filter->todo_time)
1019 ok(stop == filter->expected_stop_time, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
1020 }
1021
1022 return S_OK;
1023}
return
Definition: dirsup.c:529
GLdouble s
Definition: gl.h:2039
GLdouble n
Definition: glext.h:7729
#define todo_wine_if(is_todo)
Definition: minitest.h:81
__u16 time
Definition: mkdosfs.c:8
REFERENCE_TIME expected_stop_time
Definition: mpegaudio.c:907
REFERENCE_TIME expected_start_time
Definition: mpegaudio.c:906
BOOL todo_time
Definition: mpegaudio.c:908

◆ testsource_DecideAllocator()

static HRESULT WINAPI testsource_DecideAllocator ( struct strmbase_source *  iface,
IMemInputPin *  peer,
IMemAllocator **  allocator 
)
static

Definition at line 951 of file mpegaudio.c.

953{
954 return S_OK;
955}

◆ testsource_query_interface()

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

Definition at line 938 of file mpegaudio.c.

939{
941
942 if (IsEqualGUID(iid, &IID_IQualityControl) && filter->qc)
943 *out = &filter->qc->IQualityControl_iface;
944 else
945 return E_NOINTERFACE;
946
947 IUnknown_AddRef((IUnknown *)*out);
948 return S_OK;
949}

Variable Documentation

◆ mp1_format

const MPEG1WAVEFORMAT mp1_format
static
Initial value:
=
{
.wfx.wFormatTag = WAVE_FORMAT_MPEG,
.wfx.nChannels = 1,
.wfx.nSamplesPerSec = 32000,
.wfx.nBlockAlign = 48,
.wfx.nAvgBytesPerSec = 4000,
.wfx.cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX),
.fwHeadLayer = ACM_MPEG_LAYER1,
.dwHeadBitrate = 32000,
.fwHeadMode = ACM_MPEG_SINGLECHANNEL,
.fwHeadFlags = ACM_MPEG_ID_MPEG1,
}
#define WAVE_FORMAT_MPEG
Definition: mmreg.h:126
#define ACM_MPEG_SINGLECHANNEL
Definition: mmreg.h:423
#define ACM_MPEG_LAYER1
Definition: mmreg.h:416
struct mpeg1waveformat_tag MPEG1WAVEFORMAT
#define ACM_MPEG_ID_MPEG1
Definition: mmreg.h:428

Definition at line 30 of file mpegaudio.c.

◆ mp1_mt

const AM_MEDIA_TYPE mp1_mt
static
Initial value:
=
{
.majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.subtype = {0x00000050, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.bFixedSizeSamples = TRUE,
.lSampleSize = 1,
.formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
.cbFormat = sizeof(MPEG1WAVEFORMAT),
.pbFormat = (BYTE *)&mp1_format,
}
static const MPEG1WAVEFORMAT mp1_format
Definition: mpegaudio.c:30

Definition at line 44 of file mpegaudio.c.

Referenced by test_connect_pin(), test_media_types(), and test_source_allocator().

◆ mp2_format

const MPEG1WAVEFORMAT mp2_format
static
Initial value:
=
{
.wfx.wFormatTag = WAVE_FORMAT_MPEG,
.wfx.nChannels = 1,
.wfx.nSamplesPerSec = 32000,
.wfx.nBlockAlign = 144,
.wfx.nAvgBytesPerSec = 4000,
.wfx.cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX),
.fwHeadLayer = ACM_MPEG_LAYER2,
.dwHeadBitrate = 32000,
.fwHeadMode = ACM_MPEG_SINGLECHANNEL,
.fwHeadFlags = ACM_MPEG_ID_MPEG1,
}
#define ACM_MPEG_LAYER2
Definition: mmreg.h:417

Definition at line 56 of file mpegaudio.c.

◆ mp2_mt

const AM_MEDIA_TYPE mp2_mt
static
Initial value:
=
{
.majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.subtype = {0x00000050, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.bFixedSizeSamples = TRUE,
.lSampleSize = 1,
.formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
.cbFormat = sizeof(MPEG1WAVEFORMAT),
.pbFormat = (BYTE *)&mp2_format,
}
static const MPEG1WAVEFORMAT mp2_format
Definition: mpegaudio.c:56

Definition at line 70 of file mpegaudio.c.

Referenced by test_media_types(), test_quality_control(), and test_source_allocator().

◆ mp3_format0

const MPEG1WAVEFORMAT mp3_format0
static
Initial value:
=
{
.wfx.wFormatTag = WAVE_FORMAT_MPEG,
.wfx.nChannels = 1,
.wfx.nSamplesPerSec = 32000,
.wfx.nBlockAlign = 144,
.wfx.nAvgBytesPerSec = 4000,
.wfx.cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX),
.fwHeadLayer = ACM_MPEG_LAYER3,
.dwHeadBitrate = 32000,
.fwHeadMode = ACM_MPEG_SINGLECHANNEL,
.fwHeadFlags = ACM_MPEG_ID_MPEG1,
}
#define ACM_MPEG_LAYER3
Definition: mmreg.h:418

Definition at line 82 of file mpegaudio.c.

◆ mp3_format1

const MPEGLAYER3WAVEFORMAT mp3_format1
static
Initial value:
=
{
.wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3,
.wfx.nChannels = 1,
.wfx.nSamplesPerSec = 32000,
.wfx.nBlockAlign = 144,
.wfx.nAvgBytesPerSec = 4000,
.wfx.cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX),
.nBlockSize = 144,
.nFramesPerBlock = 1,
}
#define MPEGLAYER3_ID_MPEG
Definition: mmreg.h:442
#define WAVE_FORMAT_MPEGLAYER3
Definition: mmreg.h:127
struct mpeglayer3waveformat_tag MPEGLAYER3WAVEFORMAT

Definition at line 108 of file mpegaudio.c.

◆ mp3_mt0

const AM_MEDIA_TYPE mp3_mt0
static
Initial value:
=
{
.majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.subtype = {0x00000050, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.bFixedSizeSamples = TRUE,
.lSampleSize = 1,
.formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
.cbFormat = sizeof(MPEG1WAVEFORMAT),
.pbFormat = (BYTE *)&mp3_format0,
}
static const MPEG1WAVEFORMAT mp3_format0
Definition: mpegaudio.c:82

Definition at line 96 of file mpegaudio.c.

Referenced by test_media_types().

◆ mp3_mt1

const AM_MEDIA_TYPE mp3_mt1
static
Initial value:
=
{
.majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.subtype = {0x00000055, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.bFixedSizeSamples = TRUE,
.lSampleSize = 1,
.formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
.cbFormat = sizeof(MPEGLAYER3WAVEFORMAT),
.pbFormat = (BYTE *)&mp3_format1,
}
static const MPEGLAYER3WAVEFORMAT mp3_format1
Definition: mpegaudio.c:108

Definition at line 121 of file mpegaudio.c.

Referenced by test_media_types().

◆ outer_ref

LONG outer_ref = 1
static

Definition at line 269 of file mpegaudio.c.

Referenced by outer_AddRef(), outer_Release(), and test_aggregation().

◆ outer_vtbl

const IUnknownVtbl outer_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI outer_AddRef(IUnknown *iface)
Definition: mpegaudio.c:284
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: mpegaudio.c:271
static ULONG WINAPI outer_Release(IUnknown *iface)
Definition: mpegaudio.c:289

Definition at line 294 of file mpegaudio.c.

◆ pcm16ex_format

const WAVEFORMATEXTENSIBLE pcm16ex_format
static
Initial value:
=
{
.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE,
.Format.nChannels = 1,
.Format.nSamplesPerSec = 32000,
.Format.wBitsPerSample = 16,
.Format.nBlockAlign = 2,
.Format.nAvgBytesPerSec = 64000,
.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX),
.Samples.wValidBitsPerSample = 16,
.dwChannelMask = KSAUDIO_SPEAKER_STEREO,
.SubFormat = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
}
#define WAVE_FORMAT_EXTENSIBLE
Definition: ksmedia.h:651
#define KSAUDIO_SPEAKER_STEREO
Definition: ksmedia.h:1454

Definition at line 133 of file mpegaudio.c.

◆ pcm16ex_mt

const AM_MEDIA_TYPE pcm16ex_mt
static
Initial value:
=
{
.majortype = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.subtype = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}},
.bFixedSizeSamples = TRUE,
.lSampleSize = 2,
.formattype = {0x05589f81, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}},
.cbFormat = sizeof(WAVEFORMATEXTENSIBLE),
.pbFormat = (BYTE *)&pcm16ex_format,
}
static const WAVEFORMATEXTENSIBLE pcm16ex_format
Definition: mpegaudio.c:133

Definition at line 148 of file mpegaudio.c.

Referenced by test_connect_pin().

◆ test_iid

const GUID test_iid = {0x33333333}
static

Definition at line 268 of file mpegaudio.c.

Referenced by outer_QueryInterface(), and test_aggregation().

◆ test_outer

IUnknown test_outer = {&outer_vtbl}
static

Definition at line 301 of file mpegaudio.c.

Referenced by test_aggregation().

◆ testfilter_ops

const struct strmbase_filter_ops testfilter_ops
static
Initial value:
=
{
.filter_get_pin = testfilter_get_pin,
.filter_destroy = testfilter_destroy,
}
static void testfilter_destroy(struct strmbase_filter *iface)
Definition: mpegaudio.c:924
static struct strmbase_pin * testfilter_get_pin(struct strmbase_filter *iface, unsigned int index)
Definition: mpegaudio.c:916

Definition at line 932 of file mpegaudio.c.

Referenced by testfilter_init().

◆ testqc_inner_vtbl

const IUnknownVtbl testqc_inner_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI testqc_inner_AddRef(IUnknown *iface)
Definition: mpegaudio.c:871
static ULONG WINAPI testqc_inner_Release(IUnknown *iface)
Definition: mpegaudio.c:877
static HRESULT WINAPI testqc_inner_QueryInterface(IUnknown *iface, REFIID iid, void **out)
Definition: mpegaudio.c:856

Definition at line 883 of file mpegaudio.c.

Referenced by testqc_init().

◆ testqc_vtbl

const IQualityControlVtbl testqc_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI testqc_Release(IQualityControl *iface)
Definition: mpegaudio.c:820
static HRESULT WINAPI testqc_SetSink(IQualityControl *iface, IQualityControl *sink)
Definition: mpegaudio.c:836
static HRESULT WINAPI testqc_QueryInterface(IQualityControl *iface, REFIID iid, void **out)
Definition: mpegaudio.c:808
static ULONG WINAPI testqc_AddRef(IQualityControl *iface)
Definition: mpegaudio.c:814
static HRESULT WINAPI testqc_Notify(IQualityControl *iface, IBaseFilter *sender, Quality q)
Definition: mpegaudio.c:826

Definition at line 842 of file mpegaudio.c.

Referenced by testqc_init().

◆ testsink_ops

const struct strmbase_sink_ops testsink_ops
static
Initial value:
=
{
.base.pin_query_interface = testsink_query_interface,
.base.pin_get_media_type = testsink_get_media_type,
.sink_connect = testsink_connect,
.pfnReceive = testsink_Receive,
.sink_new_segment = testsink_new_segment,
.sink_eos = testsink_eos,
.sink_begin_flush = testsink_begin_flush,
.sink_end_flush = testsink_end_flush,
}
static HRESULT testsink_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: mpegaudio.c:964
static HRESULT testsink_begin_flush(struct strmbase_sink *iface)
Definition: mpegaudio.c:1043
static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: mpegaudio.c:988
static HRESULT testsink_eos(struct strmbase_sink *iface)
Definition: mpegaudio.c:1036
static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample *sample)
Definition: mpegaudio.c:996
static HRESULT testsink_new_segment(struct strmbase_sink *iface, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
Definition: mpegaudio.c:1025
static HRESULT testsink_get_media_type(struct strmbase_pin *iface, unsigned int index, AM_MEDIA_TYPE *mt)
Definition: mpegaudio.c:977
static HRESULT testsink_end_flush(struct strmbase_sink *iface)
Definition: mpegaudio.c:1050

Definition at line 1057 of file mpegaudio.c.

Referenced by testfilter_init().

◆ testsource_ops

const struct strmbase_source_ops testsource_ops
static
Initial value:
=
{
.base.pin_query_interface = testsource_query_interface,
.pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
.pfnDecideAllocator = testsource_DecideAllocator,
}
static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator)
Definition: mpegaudio.c:951
static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
Definition: mpegaudio.c:938
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *pin, IPin *peer, const AM_MEDIA_TYPE *mt)
Definition: pin.c:710

Definition at line 957 of file mpegaudio.c.

Referenced by testfilter_init().