From: Zebediah Figura zfigura@codeweavers.com
Needed by the Microsoft Silverlight configuration tool.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36230 --- dlls/qcap/audiorecord.c | 58 ++++++++++++++++++++++++++++++++--- dlls/qcap/tests/audiorecord.c | 44 +++++++++++--------------- 2 files changed, 71 insertions(+), 31 deletions(-)
diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index 3a9339fcc2d..b573368e261 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -42,6 +42,8 @@ struct audio_record FILTER_STATE state; CONDITION_VARIABLE state_cv; CRITICAL_SECTION state_cs; + + AM_MEDIA_TYPE format; };
static struct audio_record *impl_from_strmbase_filter(struct strmbase_filter *filter) @@ -213,15 +215,52 @@ static ULONG WINAPI stream_config_Release(IAMStreamConfig *iface)
static HRESULT WINAPI stream_config_SetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE *mt) { - FIXME("iface %p, mt %p, stub!\n", iface, mt); + struct audio_record *filter = impl_from_IAMStreamConfig(iface); + HRESULT hr; + + TRACE("iface %p, mt %p.\n", iface, mt); strmbase_dump_media_type(mt); - return E_NOTIMPL; + + if (!mt) + return E_POINTER; + + EnterCriticalSection(&filter->filter.filter_cs); + + if ((hr = CopyMediaType(&filter->format, mt))) + { + LeaveCriticalSection(&filter->filter.filter_cs); + return hr; + } + + LeaveCriticalSection(&filter->filter.filter_cs); + + return S_OK; }
-static HRESULT WINAPI stream_config_GetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE **mt) +static HRESULT WINAPI stream_config_GetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE **ret_mt) { - FIXME("iface %p, mt %p, stub!\n", iface, mt); - return E_NOTIMPL; + struct audio_record *filter = impl_from_IAMStreamConfig(iface); + AM_MEDIA_TYPE *mt; + HRESULT hr; + + TRACE("iface %p, mt %p.\n", iface, ret_mt); + + if (!(mt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)))) + return E_OUTOFMEMORY; + + EnterCriticalSection(&filter->filter.filter_cs); + + if ((hr = CopyMediaType(mt, &filter->format))) + { + LeaveCriticalSection(&filter->filter.filter_cs); + CoTaskMemFree(mt); + return hr; + } + + LeaveCriticalSection(&filter->filter.filter_cs); + + *ret_mt = mt; + return S_OK; }
static HRESULT WINAPI stream_config_GetNumberOfCapabilities(IAMStreamConfig *iface, @@ -306,6 +345,7 @@ static void audio_record_destroy(struct strmbase_filter *iface) filter->state_cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&filter->state_cs); CloseHandle(filter->event); + FreeMediaType(&filter->format); strmbase_source_cleanup(&filter->source); strmbase_filter_cleanup(&filter->filter); free(filter); @@ -596,6 +636,7 @@ static const IPersistPropertyBagVtbl PersistPropertyBagVtbl = HRESULT audio_record_create(IUnknown *outer, IUnknown **out) { struct audio_record *object; + HRESULT hr;
if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -606,6 +647,13 @@ HRESULT audio_record_create(IUnknown *outer, IUnknown **out) return E_OUTOFMEMORY; }
+ if ((hr = fill_media_type(0, &object->format))) + { + CloseHandle(object->event); + free(object); + return hr; + } + object->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl; strmbase_filter_init(&object->filter, outer, &CLSID_AudioRecord, &filter_ops);
diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index b73cbba3548..c2a57d75593 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -1009,26 +1009,21 @@ static void test_stream_config(IBaseFilter *filter) IEnumMediaTypes_Release(enummt);
hr = IAMStreamConfig_GetFormat(config, &mt); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - { - hr = IAMStreamConfig_GetStreamCaps(config, 0, &mt2, (BYTE *)&caps); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - { - ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); - DeleteMediaType(mt2); - } - - hr = IAMStreamConfig_SetFormat(config, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#lx.\n", hr); - - mt->majortype = MEDIATYPE_Video; - hr = IAMStreamConfig_SetFormat(config, mt); - todo_wine ok(hr == VFW_E_INVALIDMEDIATYPE, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
- DeleteMediaType(mt); - } + hr = IAMStreamConfig_GetStreamCaps(config, 0, &mt2, (BYTE *)&caps); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); + DeleteMediaType(mt2); + + hr = IAMStreamConfig_SetFormat(config, NULL); + ok(hr == E_POINTER, "Got hr %#lx.\n", hr); + + mt->majortype = MEDIATYPE_Video; + hr = IAMStreamConfig_SetFormat(config, mt); + todo_wine ok(hr == VFW_E_INVALIDMEDIATYPE, "Got hr %#lx.\n", hr); + + DeleteMediaType(mt);
for (i = 0; i < count; ++i) { @@ -1038,15 +1033,12 @@ static void test_stream_config(IBaseFilter *filter) ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IAMStreamConfig_SetFormat(config, mt); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IAMStreamConfig_GetFormat(config, &mt2); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - { - ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); - DeleteMediaType(mt2); - } + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(compare_media_types(mt, mt2), "Media types didn't match.\n"); + DeleteMediaType(mt2);
DeleteMediaType(mt);
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/qcap/audiorecord.c | 60 +++++++++++++++++++++++++++++++++++ dlls/qcap/tests/audiorecord.c | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index b573368e261..e650c73916a 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -30,6 +30,7 @@ struct audio_record
struct strmbase_source source; IAMStreamConfig IAMStreamConfig_iface; + IKsPropertySet IKsPropertySet_iface;
unsigned int id; HWAVEIN device; @@ -57,6 +58,8 @@ static HRESULT audio_record_source_query_interface(struct strmbase_pin *iface, R
if (IsEqualGUID(iid, &IID_IAMStreamConfig)) *out = &filter->IAMStreamConfig_iface; + else if (IsEqualGUID(iid, &IID_IKsPropertySet)) + *out = &filter->IKsPropertySet_iface; else return E_NOINTERFACE;
@@ -324,6 +327,62 @@ static const IAMStreamConfigVtbl stream_config_vtbl = stream_config_GetStreamCaps, };
+static struct audio_record *impl_from_IKsPropertySet(IKsPropertySet *iface) +{ + return CONTAINING_RECORD(iface, struct audio_record, IKsPropertySet_iface); +} + +static HRESULT WINAPI property_set_QueryInterface(IKsPropertySet *iface, REFIID iid, void **out) +{ + struct audio_record *filter = impl_from_IKsPropertySet(iface); + return IPin_QueryInterface(&filter->source.pin.IPin_iface, iid, out); +} + +static ULONG WINAPI property_set_AddRef(IKsPropertySet *iface) +{ + struct audio_record *filter = impl_from_IKsPropertySet(iface); + return IPin_AddRef(&filter->source.pin.IPin_iface); +} + +static ULONG WINAPI property_set_Release(IKsPropertySet *iface) +{ + struct audio_record *filter = impl_from_IKsPropertySet(iface); + return IPin_Release(&filter->source.pin.IPin_iface); +} + +static HRESULT WINAPI property_set_Set(IKsPropertySet *iface, const GUID *set, DWORD id, + void *instance, DWORD instance_size, void *data, DWORD size) +{ + FIXME("iface %p, set %s, id %lu, instance %p, instance_size %lu, data %p, size %lu, stub!\n", + iface, debugstr_guid(set), id, instance, instance_size, data, size); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_set_Get(IKsPropertySet *iface, const GUID *set, DWORD id, + void *instance, DWORD instance_size, void *data, DWORD size, DWORD *ret_size) +{ + FIXME("iface %p, set %s, id %lu, instance %p, instance_size %lu, data %p, size %lu, ret_size %p.\n", + iface, debugstr_guid(set), id, instance, instance_size, data, size, ret_size); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_set_QuerySupported(IKsPropertySet *iface, + const GUID *set, DWORD id, DWORD *support) +{ + FIXME("iface %p, set %s, id %lu, support %p, stub!\n", iface, debugstr_guid(set), id, support); + return E_NOTIMPL; +} + +static const IKsPropertySetVtbl property_set_vtbl = +{ + property_set_QueryInterface, + property_set_AddRef, + property_set_Release, + property_set_Set, + property_set_Get, + property_set_QuerySupported, +}; + static struct audio_record *impl_from_IPersistPropertyBag(IPersistPropertyBag *iface) { return CONTAINING_RECORD(iface, struct audio_record, IPersistPropertyBag_iface); @@ -659,6 +718,7 @@ HRESULT audio_record_create(IUnknown *outer, IUnknown **out)
strmbase_source_init(&object->source, &object->filter, L"Capture", &source_ops); object->IAMStreamConfig_iface.lpVtbl = &stream_config_vtbl; + object->IKsPropertySet_iface.lpVtbl = &property_set_vtbl;
object->state = State_Stopped; InitializeConditionVariable(&object->state_cv); diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index c2a57d75593..77b63277460 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -101,7 +101,7 @@ static void test_interfaces(IBaseFilter *filter) ok(hr == S_OK, "Got hr %#lx.\n", hr);
check_interface(pin, &IID_IAMStreamConfig, TRUE); - todo_wine check_interface(pin, &IID_IKsPropertySet, TRUE); + check_interface(pin, &IID_IKsPropertySet, TRUE); check_interface(pin, &IID_IPin, TRUE); todo_wine check_interface(pin, &IID_IQualityControl, TRUE); check_interface(pin, &IID_IUnknown, TRUE);
From: Zebediah Figura zfigura@codeweavers.com
Needed by the Microsoft Silverlight configuration tool.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36230 --- dlls/qcap/audiorecord.c | 30 +++++++++++++++++++++++++++--- dlls/qcap/tests/audiorecord.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index e650c73916a..0a17eb08057 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -361,9 +361,33 @@ static HRESULT WINAPI property_set_Set(IKsPropertySet *iface, const GUID *set, D static HRESULT WINAPI property_set_Get(IKsPropertySet *iface, const GUID *set, DWORD id, void *instance, DWORD instance_size, void *data, DWORD size, DWORD *ret_size) { - FIXME("iface %p, set %s, id %lu, instance %p, instance_size %lu, data %p, size %lu, ret_size %p.\n", - iface, debugstr_guid(set), id, instance, instance_size, data, size, ret_size); - return E_NOTIMPL; + struct audio_record *filter = impl_from_IKsPropertySet(iface); + + TRACE("filter %p, set %s, id %lu, instance %p, instance_size %lu, data %p, size %lu, ret_size %p.\n", + filter, debugstr_guid(set), id, instance, instance_size, data, size, ret_size); + + if (!IsEqualGUID(set, &ROPSETID_Pin)) + { + FIXME("Unknown set %s, returning E_PROP_SET_UNSUPPORTED.\n", debugstr_guid(set)); + return E_PROP_SET_UNSUPPORTED; + } + + if (id != AMPROPERTY_PIN_CATEGORY) + { + FIXME("Unknown id %lu, returning E_PROP_ID_UNSUPPORTED.\n", id); + return E_PROP_ID_UNSUPPORTED; + } + + if (instance || instance_size) + FIXME("Unexpected instance data %p, size %lu.\n", instance, instance_size); + + *ret_size = sizeof(GUID); + + if (size < sizeof(GUID)) + return E_UNEXPECTED; + + *(GUID *)data = PIN_CATEGORY_CAPTURE; + return S_OK; }
static HRESULT WINAPI property_set_QuerySupported(IKsPropertySet *iface, diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index 77b63277460..3e2194436a9 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -951,6 +951,36 @@ static void test_connect_pin(IBaseFilter *filter) ok(!ref, "Got outstanding refcount %ld.\n", ref); }
+static void test_property_set(IBaseFilter *filter) +{ + IKsPropertySet *set; + GUID category; + IPin *source; + DWORD size; + HRESULT hr; + + IBaseFilter_FindPin(filter, L"Capture", &source); + IPin_QueryInterface(source, &IID_IKsPropertySet, (void **)&set); + + size = 0xdeadbeef; + memset(&category, 0xcc, sizeof(category)); + hr = IKsPropertySet_Get(set, &ROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, + NULL, 0, &category, sizeof(category) - 1, &size); + ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr); + ok(size == sizeof(GUID), "Got size %lu.\n", size); + + size = 0xdeadbeef; + memset(&category, 0xcc, sizeof(category)); + hr = IKsPropertySet_Get(set, &ROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, + NULL, 0, &category, sizeof(category) + 1, &size); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(IsEqualGUID(&category, &PIN_CATEGORY_CAPTURE), "Got category %s.\n", debugstr_guid(&category)); + ok(size == sizeof(GUID), "Got size %lu.\n", size); + + IKsPropertySet_Release(set); + IPin_Release(source); +} + static void test_stream_config(IBaseFilter *filter) { AUDIO_STREAM_CONFIG_CAPS caps; @@ -1116,6 +1146,7 @@ START_TEST(audiorecord) test_pin_info(filter); test_media_types(filter); test_connect_pin(filter); + test_property_set(filter); /* This calls SetFormat() and hence should be run last. */ test_stream_config(filter);
From: Zebediah Figura zfigura@codeweavers.com
Needed by the Microsoft Silverlight configuration tool.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36230 --- dlls/qcap/audiorecord.c | 54 ++++++++++++++++++++++++++++++++++- dlls/qcap/tests/audiorecord.c | 1 + 2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index 0a17eb08057..291ca4452b3 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -29,6 +29,7 @@ struct audio_record IPersistPropertyBag IPersistPropertyBag_iface;
struct strmbase_source source; + IAMBufferNegotiation IAMBufferNegotiation_iface; IAMStreamConfig IAMStreamConfig_iface; IKsPropertySet IKsPropertySet_iface;
@@ -56,7 +57,9 @@ static HRESULT audio_record_source_query_interface(struct strmbase_pin *iface, R { struct audio_record *filter = impl_from_strmbase_filter(iface->filter);
- if (IsEqualGUID(iid, &IID_IAMStreamConfig)) + if (IsEqualGUID(iid, &IID_IAMBufferNegotiation)) + *out = &filter->IAMBufferNegotiation_iface; + else if (IsEqualGUID(iid, &IID_IAMStreamConfig)) *out = &filter->IAMStreamConfig_iface; else if (IsEqualGUID(iid, &IID_IKsPropertySet)) *out = &filter->IKsPropertySet_iface; @@ -327,6 +330,54 @@ static const IAMStreamConfigVtbl stream_config_vtbl = stream_config_GetStreamCaps, };
+static struct audio_record *impl_from_IAMBufferNegotiation(IAMBufferNegotiation *iface) +{ + return CONTAINING_RECORD(iface, struct audio_record, IAMBufferNegotiation_iface); +} + +static HRESULT WINAPI buffer_negotiation_QueryInterface(IAMBufferNegotiation *iface, REFIID iid, void **out) +{ + struct audio_record *filter = impl_from_IAMBufferNegotiation(iface); + return IPin_QueryInterface(&filter->source.pin.IPin_iface, iid, out); +} + +static ULONG WINAPI buffer_negotiation_AddRef(IAMBufferNegotiation *iface) +{ + struct audio_record *filter = impl_from_IAMBufferNegotiation(iface); + return IPin_AddRef(&filter->source.pin.IPin_iface); +} + +static ULONG WINAPI buffer_negotiation_Release(IAMBufferNegotiation *iface) +{ + struct audio_record *filter = impl_from_IAMBufferNegotiation(iface); + return IPin_Release(&filter->source.pin.IPin_iface); +} + +static HRESULT WINAPI buffer_negotiation_SuggestAllocatorProperties( + IAMBufferNegotiation *iface, const ALLOCATOR_PROPERTIES *props) +{ + FIXME("iface %p, props %p, stub!\n", iface, props); + TRACE("Requested %ld buffers, size %ld, alignment %ld, prefix %ld.\n", + props->cBuffers, props->cbBuffer, props->cbAlign, props->cbPrefix); + return E_NOTIMPL; +} + +static HRESULT WINAPI buffer_negotiation_GetAllocatorProperties( + IAMBufferNegotiation *iface, ALLOCATOR_PROPERTIES *props) +{ + FIXME("iface %p, props %p, stub!\n", iface, props); + return E_NOTIMPL; +} + +static const IAMBufferNegotiationVtbl buffer_negotiation_vtbl = +{ + buffer_negotiation_QueryInterface, + buffer_negotiation_AddRef, + buffer_negotiation_Release, + buffer_negotiation_SuggestAllocatorProperties, + buffer_negotiation_GetAllocatorProperties, +}; + static struct audio_record *impl_from_IKsPropertySet(IKsPropertySet *iface) { return CONTAINING_RECORD(iface, struct audio_record, IKsPropertySet_iface); @@ -741,6 +792,7 @@ HRESULT audio_record_create(IUnknown *outer, IUnknown **out) strmbase_filter_init(&object->filter, outer, &CLSID_AudioRecord, &filter_ops);
strmbase_source_init(&object->source, &object->filter, L"Capture", &source_ops); + object->IAMBufferNegotiation_iface.lpVtbl = &buffer_negotiation_vtbl; object->IAMStreamConfig_iface.lpVtbl = &stream_config_vtbl; object->IKsPropertySet_iface.lpVtbl = &property_set_vtbl;
diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index 3e2194436a9..a5669612351 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -100,6 +100,7 @@ static void test_interfaces(IBaseFilter *filter) hr = IBaseFilter_FindPin(filter, L"Capture", &pin); ok(hr == S_OK, "Got hr %#lx.\n", hr);
+ check_interface(pin, &IID_IAMBufferNegotiation, TRUE); check_interface(pin, &IID_IAMStreamConfig, TRUE); check_interface(pin, &IID_IKsPropertySet, TRUE); check_interface(pin, &IID_IPin, TRUE);
From: Zebediah Figura zfigura@codeweavers.com
Needed by the Microsoft Silverlight configuration tool.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36230 --- dlls/qcap/audiorecord.c | 31 ++++++++++++++++----- dlls/qcap/tests/audiorecord.c | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 6 deletions(-)
diff --git a/dlls/qcap/audiorecord.c b/dlls/qcap/audiorecord.c index 291ca4452b3..5ece56e97ec 100644 --- a/dlls/qcap/audiorecord.c +++ b/dlls/qcap/audiorecord.c @@ -46,6 +46,7 @@ struct audio_record CRITICAL_SECTION state_cs;
AM_MEDIA_TYPE format; + ALLOCATOR_PROPERTIES props; };
static struct audio_record *impl_from_strmbase_filter(struct strmbase_filter *filter) @@ -158,12 +159,18 @@ static HRESULT WINAPI audio_record_source_DecideBufferSize(struct strmbase_sourc MMRESULT ret; HRESULT hr;
- props->cBuffers = 4; + props->cBuffers = (filter->props.cBuffers == -1) ? 4 : filter->props.cBuffers; /* This is the algorithm that native uses. The alignment to an even number * doesn't make much sense, and may be a bug. */ - props->cbBuffer = (format->nAvgBytesPerSec / 2) & ~1; - props->cbAlign = 1; - props->cbPrefix = 0; + if (filter->props.cbBuffer == -1) + props->cbBuffer = (format->nAvgBytesPerSec / 2) & ~1; + else + props->cbBuffer = filter->props.cbBuffer & ~1; + if (filter->props.cbAlign == -1 || filter->props.cbAlign == 0) + props->cbAlign = 1; + else + props->cbAlign = filter->props.cbAlign; + props->cbPrefix = (filter->props.cbPrefix == -1) ? 0 : filter->props.cbPrefix;
if (FAILED(hr = IMemAllocator_SetProperties(allocator, props, &ret_props))) return hr; @@ -356,10 +363,17 @@ static ULONG WINAPI buffer_negotiation_Release(IAMBufferNegotiation *iface) static HRESULT WINAPI buffer_negotiation_SuggestAllocatorProperties( IAMBufferNegotiation *iface, const ALLOCATOR_PROPERTIES *props) { - FIXME("iface %p, props %p, stub!\n", iface, props); + struct audio_record *filter = impl_from_IAMBufferNegotiation(iface); + + TRACE("filter %p, props %p.\n", filter, props); TRACE("Requested %ld buffers, size %ld, alignment %ld, prefix %ld.\n", props->cBuffers, props->cbBuffer, props->cbAlign, props->cbPrefix); - return E_NOTIMPL; + + EnterCriticalSection(&filter->state_cs); + filter->props = *props; + LeaveCriticalSection(&filter->state_cs); + + return S_OK; }
static HRESULT WINAPI buffer_negotiation_GetAllocatorProperties( @@ -788,6 +802,11 @@ HRESULT audio_record_create(IUnknown *outer, IUnknown **out) return hr; }
+ object->props.cBuffers = -1; + object->props.cbBuffer = -1; + object->props.cbAlign = -1; + object->props.cbPrefix = -1; + object->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl; strmbase_filter_init(&object->filter, outer, &CLSID_AudioRecord, &filter_ops);
diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index a5669612351..ed6c54648d0 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -618,6 +618,7 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control, IPin *source, struct testfilter *testsink) { ALLOCATOR_PROPERTIES props, req_props = {2, 3200, 32, 0}; + IAMBufferNegotiation *negotiation; IMemAllocator *allocator; IMediaSample *sample; WAVEFORMATEX format; @@ -692,6 +693,56 @@ static void test_source_allocator(IFilterGraph2 *graph, IMediaControl *control,
IFilterGraph2_Disconnect(graph, source); IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface); + + /* Test IAMBufferNegotiation. *This* is respected. */ + + IPin_QueryInterface(source, &IID_IAMBufferNegotiation, (void **)&negotiation); + + hr = IAMBufferNegotiation_SuggestAllocatorProperties(negotiation, &req_props); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + init_pcm_mt(&mt, &format, 1, 32000, 16); + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + todo_wine ok(testsink->sink.pAllocator && testsink->sink.pAllocator != allocator, + "Got unexpected allocator %p.\n", testsink->sink.pAllocator); + hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(props.cBuffers == req_props.cBuffers, "Got %ld buffers.\n", props.cBuffers); + ok(props.cbBuffer == req_props.cbBuffer, "Got size %ld.\n", props.cbBuffer); + ok(props.cbAlign == req_props.cbAlign, "Got alignment %ld.\n", props.cbAlign); + ok(props.cbPrefix == req_props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix); + + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface); + + for (req_props.cbBuffer = 32000; req_props.cbBuffer < 32050; ++req_props.cbBuffer) + { + req_props.cBuffers = -1; + req_props.cbAlign = 0; + hr = IAMBufferNegotiation_SuggestAllocatorProperties(negotiation, &req_props); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + init_pcm_mt(&mt, &format, 1, 32000, 8); + hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &mt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + todo_wine ok(testsink->sink.pAllocator && testsink->sink.pAllocator != allocator, + "Got unexpected allocator %p.\n", testsink->sink.pAllocator); + hr = IMemAllocator_GetProperties(testsink->sink.pAllocator, &props); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(props.cBuffers == 4, "Got %ld buffers.\n", props.cBuffers); + ok(props.cbBuffer == (req_props.cbBuffer & ~1), + "Got size %ld for %ld.\n", props.cbBuffer, req_props.cbBuffer); + ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign); + ok(props.cbPrefix == req_props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix); + + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface); + } + + IAMBufferNegotiation_Release(negotiation); }
static void test_filter_state(IFilterGraph2 *graph, IMediaControl *control,
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=132912
Your paranoid android.
=== debian11b (64 bit WoW report) ===
qcap: audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950. audiorecord.c:731: Test succeeded inside todo block: Got unexpected allocator 0000000001562950.