From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/mf/tests/mf.c | 42 +- dlls/winegstreamer/Makefile.in | 1 + dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/main.c | 13 + dlls/winegstreamer/mfplat.c | 20 +- dlls/winegstreamer/resampler.c | 606 +++++++++++++++++++ dlls/winegstreamer/winegstreamer_classes.idl | 6 + 7 files changed, 681 insertions(+), 8 deletions(-) create mode 100644 dlls/winegstreamer/resampler.c
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 13f0e38b0b8..990b29302de 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -254,9 +254,7 @@ static BOOL create_transform(GUID category, MFT_REGISTER_TYPE_INFO *input_type, if (IsEqualGUID(expect_class_id, class_ids + i)) break; } - todo_wine_if(IsEqualGUID(class_ids, &CLSID_WINEAudioConverter)) ok(i < count, "failed to find %s transform\n", debugstr_w(expect_name)); - if (i == count) return FALSE; *class_id = class_ids[i]; CoTaskMemFree(class_ids); ok(IsEqualGUID(class_id, expect_class_id), "got class id %s\n", debugstr_guid(class_id)); @@ -7566,15 +7564,16 @@ static void test_audio_convert(void) check_interface(transform, &IID_IMFTransform, TRUE); check_interface(transform, &IID_IMediaObject, TRUE); check_interface(transform, &IID_IPropertyStore, TRUE); - todo_wine check_interface(transform, &IID_IPropertyBag, TRUE); /* check_interface(transform, &IID_IWMResamplerProps, TRUE); */
/* check default media types */
hr = IMFTransform_GetInputStreamInfo(transform, 0, &input_info); + todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetInputStreamInfo returned %#lx\n", hr); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); + todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputStreamInfo returned %#lx\n", hr);
i = -1; @@ -7587,7 +7586,9 @@ static void test_audio_convert(void) ok(ret == 0, "Release returned %lu\n", ret); winetest_pop_context(); } + todo_wine ok(hr == MF_E_NO_MORE_TYPES, "GetOutputAvailableType returned %#lx\n", hr); + todo_wine ok(i == 4, "%lu output media types\n", i);
i = -1; @@ -7602,7 +7603,9 @@ static void test_audio_convert(void) ok(ret == 0, "Release returned %lu\n", ret); winetest_pop_context(); } + todo_wine ok(hr == MF_E_NO_MORE_TYPES, "GetInputAvailableType returned %#lx\n", hr); + todo_wine ok(i == 2, "%lu input media types\n", i);
/* setting output media type first doesn't work */ @@ -7611,6 +7614,7 @@ static void test_audio_convert(void) ok(hr == S_OK, "MFCreateMediaType returned %#lx\n", hr); init_media_type(media_type, output_type_desc, -1); hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "SetOutputType returned %#lx.\n", hr); ret = IMFMediaType_Release(media_type); ok(ret == 0, "Release returned %lu\n", ret); @@ -7620,25 +7624,31 @@ static void test_audio_convert(void) hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "MFCreateMediaType returned %#lx\n", hr); hr = IMFTransform_SetInputType(transform, 0, media_type, 0); + todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "SetInputType returned %#lx.\n", hr); init_media_type(media_type, input_type_desc, 1); hr = IMFTransform_SetInputType(transform, 0, media_type, 0); + todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "SetInputType returned %#lx.\n", hr); init_media_type(media_type, input_type_desc, 2); for (i = 2; i < ARRAY_SIZE(input_type_desc) - 1; ++i) { hr = IMFTransform_SetInputType(transform, 0, media_type, 0); + todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "SetInputType returned %#lx.\n", hr); init_media_type(media_type, input_type_desc, i + 1); } hr = IMFTransform_SetInputType(transform, 0, media_type, 0); + todo_wine ok(hr == S_OK, "SetInputType returned %#lx.\n", hr); ret = IMFMediaType_Release(media_type); ok(ret == 0, "Release returned %lu\n", ret);
hr = IMFTransform_GetInputStreamInfo(transform, 0, &input_info); + todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetInputStreamInfo returned %#lx\n", hr); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); + todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "GetOutputStreamInfo returned %#lx\n", hr);
/* check new output media types */ @@ -7653,7 +7663,9 @@ static void test_audio_convert(void) ok(ret == 0, "Release returned %lu\n", ret); winetest_pop_context(); } + todo_wine ok(hr == MF_E_NO_MORE_TYPES, "GetOutputAvailableType returned %#lx\n", hr); + todo_wine ok(i == 4, "%lu output media types\n", i);
/* check required output media type attributes */ @@ -7661,36 +7673,50 @@ static void test_audio_convert(void) hr = MFCreateMediaType(&media_type); ok(hr == S_OK, "MFCreateMediaType returned %#lx\n", hr); hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "SetOutputType returned %#lx.\n", hr); init_media_type(media_type, output_type_desc, 1); hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine ok(hr == MF_E_ATTRIBUTENOTFOUND, "SetOutputType returned %#lx.\n", hr); init_media_type(media_type, output_type_desc, 2); for (i = 2; i < ARRAY_SIZE(output_type_desc) - 1; ++i) { hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine ok(hr == MF_E_INVALIDMEDIATYPE, "SetOutputType returned %#lx.\n", hr); init_media_type(media_type, output_type_desc, i + 1); } hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); + todo_wine ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr); ret = IMFMediaType_Release(media_type); ok(ret == 0, "Release returned %lu\n", ret);
memset(&input_info, 0xcd, sizeof(input_info)); hr = IMFTransform_GetInputStreamInfo(transform, 0, &input_info); + todo_wine ok(hr == S_OK, "GetInputStreamInfo returned %#lx\n", hr); + todo_wine ok(input_info.hnsMaxLatency == 0, "got hnsMaxLatency %s\n", wine_dbgstr_longlong(input_info.hnsMaxLatency)); + todo_wine ok(input_info.dwFlags == 0, "got dwFlags %#lx\n", input_info.dwFlags); + todo_wine ok(input_info.cbSize == 8, "got cbSize %lu\n", input_info.cbSize); + todo_wine ok(input_info.cbMaxLookahead == 0, "got cbMaxLookahead %#lx\n", input_info.cbMaxLookahead); + todo_wine ok(input_info.cbAlignment == 1, "got cbAlignment %#lx\n", input_info.cbAlignment);
memset(&output_info, 0xcd, sizeof(output_info)); hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info); + todo_wine ok(hr == S_OK, "GetOutputStreamInfo returned %#lx\n", hr); + todo_wine ok(output_info.dwFlags == 0, "got dwFlags %#lx\n", output_info.dwFlags); + todo_wine ok(output_info.cbSize == 4, "got cbSize %#lx\n", output_info.cbSize); + todo_wine ok(output_info.cbAlignment == 1, "got cbAlignment %#lx\n", output_info.cbAlignment);
resource = FindResourceW(NULL, L"audiodata.bin", (const WCHAR *)RT_RCDATA); @@ -7705,10 +7731,13 @@ static void test_audio_convert(void) hr = IMFSample_SetSampleDuration(sample, 10000000); ok(hr == S_OK, "SetSampleDuration returned %#lx\n", hr); hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine ok(hr == S_OK, "ProcessInput returned %#lx\n", hr); hr = IMFTransform_ProcessMessage(transform, MFT_MESSAGE_COMMAND_DRAIN, 0); + todo_wine ok(hr == S_OK, "ProcessMessage returned %#lx\n", hr); hr = IMFTransform_ProcessInput(transform, 0, sample, 0); + todo_wine ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr); IMFSample_Release(sample);
@@ -7764,9 +7793,12 @@ static void test_audio_convert(void) }
hr = IMFSample_GetSampleTime(sample, &time); + todo_wine ok(hr == S_OK, "GetSampleTime returned %#lx\n", hr); + todo_wine_if(i != 0) ok(time == i * 928798, "got time %I64d\n", time); hr = IMFSample_GetSampleDuration(sample, &duration); + todo_wine ok(hr == S_OK, "GetSampleDuration returned %#lx\n", hr); todo_wine ok(duration == 897506, "got duration %I64d\n", duration); @@ -7774,6 +7806,7 @@ static void test_audio_convert(void) ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); todo_wine ok(length == 15832, "got length %lu\n", length); + todo_wine ok(audioconv_data_len == 16084, "got remaining length %lu\n", audioconv_data_len); check_sample_pcm16(sample, audioconv_data, output_file, FALSE); audioconv_data_len -= length; @@ -7788,6 +7821,7 @@ static void test_audio_convert(void) todo_wine ok(output.dwStatus == MFT_OUTPUT_DATA_BUFFER_INCOMPLETE || broken(output.dwStatus == 0) /* win7 */, "got dwStatus %#lx\n", output.dwStatus); + todo_wine ok(status == 0, "got status %#lx\n", status);
if (hr == S_OK) @@ -7819,9 +7853,11 @@ static void test_audio_convert(void) memset(&output, 0, sizeof(output)); output.pSample = sample; hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status); + todo_wine ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr); ok(output.pSample == sample, "got pSample %p\n", output.pSample); ok(output.dwStatus == 0, "got dwStatus %#lx\n", output.dwStatus); + todo_wine ok(status == 0, "got status %#lx\n", status); hr = IMFSample_GetTotalLength(sample, &length); ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr); diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 6e3517dcb36..f365608ed6a 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -14,6 +14,7 @@ C_SRCS = \ mfplat.c \ quartz_parser.c \ quartz_transform.c \ + resampler.c \ wg_allocator.c \ wg_format.c \ wg_parser.c \ diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index e1abe7018da..c539084fa89 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -111,6 +111,7 @@ HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out); HRESULT mpeg_splitter_create(IUnknown *outer, IUnknown **out); HRESULT wave_parser_create(IUnknown *outer, IUnknown **out); HRESULT wma_decoder_create(IUnknown *outer, IUnknown **out); +HRESULT resampler_create(IUnknown *outer, IUnknown **out);
bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool wm); bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 5075b3118cd..fedf4e48538 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -437,6 +437,7 @@ static struct class_factory mpeg_audio_codec_cf = {{&class_factory_vtbl}, mpeg_a static struct class_factory mpeg_splitter_cf = {{&class_factory_vtbl}, mpeg_splitter_create}; static struct class_factory wave_parser_cf = {{&class_factory_vtbl}, wave_parser_create}; static struct class_factory wma_decoder_cf = {{&class_factory_vtbl}, wma_decoder_create}; +static struct class_factory resampler_cf = {{&class_factory_vtbl}, resampler_create};
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) { @@ -463,6 +464,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &wave_parser_cf; else if (IsEqualGUID(clsid, &CLSID_WMADecMediaObject)) factory = &wma_decoder_cf; + else if (IsEqualGUID(clsid, &CLSID_CResamplerMediaObject)) + factory = &resampler_cf; else { FIXME("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid)); @@ -657,6 +660,11 @@ static const REGFILTER2 reg_decodebin_parser =
HRESULT WINAPI DllRegisterServer(void) { + DMO_PARTIAL_MEDIATYPE audio_convert_types[2] = + { + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_PCM}, + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_IEEE_FLOAT}, + }; DMO_PARTIAL_MEDIATYPE wma_decoder_output[2] = { {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_PCM}, @@ -696,6 +704,9 @@ HRESULT WINAPI DllRegisterServer(void) if (FAILED(hr = DMORegister(L"WMA Decoder DMO", &CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER, 0, ARRAY_SIZE(wma_decoder_input), wma_decoder_input, ARRAY_SIZE(wma_decoder_output), wma_decoder_output))) return hr; + if (FAILED(hr = DMORegister(L"Resampler DMO", &CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT, + 0, ARRAY_SIZE(audio_convert_types), audio_convert_types, ARRAY_SIZE(audio_convert_types), audio_convert_types))) + return hr;
return mfplat_DllRegisterServer(); } @@ -722,6 +733,8 @@ HRESULT WINAPI DllUnregisterServer(void)
IFilterMapper2_Release(mapper);
+ if (FAILED(hr = DMOUnregister(&CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT))) + return hr; if (FAILED(hr = DMOUnregister(&CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER))) return hr;
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index c5ca4b15c0f..ee0a5d25056 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -440,7 +440,7 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
HRESULT mfplat_DllRegisterServer(void) { - MFT_REGISTER_TYPE_INFO audio_converter_supported_types[] = + MFT_REGISTER_TYPE_INFO resampler_types[] = { {MFMediaType_Audio, MFAudioFormat_PCM}, {MFMediaType_Audio, MFAudioFormat_Float}, @@ -541,10 +541,10 @@ HRESULT mfplat_DllRegisterServer(void) MFT_CATEGORY_AUDIO_EFFECT, L"Audio Converter", MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(audio_converter_supported_types), - audio_converter_supported_types, - ARRAY_SIZE(audio_converter_supported_types), - audio_converter_supported_types, + ARRAY_SIZE(resampler_types), + resampler_types, + ARRAY_SIZE(resampler_types), + resampler_types, }, { CLSID_WMADecMediaObject, @@ -576,6 +576,16 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(video_processor_output_types), video_processor_output_types, }, + { + CLSID_CResamplerMediaObject, + MFT_CATEGORY_AUDIO_EFFECT, + L"Resampler MFT", + MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(resampler_types), + resampler_types, + ARRAY_SIZE(resampler_types), + resampler_types, + }, };
unsigned int i; diff --git a/dlls/winegstreamer/resampler.c b/dlls/winegstreamer/resampler.c new file mode 100644 index 00000000000..554c76d6085 --- /dev/null +++ b/dlls/winegstreamer/resampler.c @@ -0,0 +1,606 @@ +/* Copyright 2022 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "gst_private.h" + +#include "mfapi.h" +#include "mferror.h" +#include "mfobjects.h" +#include "mftransform.h" +#include "wmcodecdsp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mfplat); +WINE_DECLARE_DEBUG_CHANNEL(winediag); + +struct resampler +{ + IUnknown IUnknown_inner; + IMFTransform IMFTransform_iface; + IMediaObject IMediaObject_iface; + IPropertyBag IPropertyBag_iface; + IPropertyStore IPropertyStore_iface; + IUnknown *outer; + LONG refcount; +}; + +static inline struct resampler *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, struct resampler, IUnknown_inner); +} + +static HRESULT WINAPI unknown_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + struct resampler *impl = impl_from_IUnknown(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown)) + *out = &impl->IUnknown_inner; + else if (IsEqualGUID(iid, &IID_IMFTransform)) + *out = &impl->IMFTransform_iface; + else if (IsEqualGUID(iid, &IID_IMediaObject)) + *out = &impl->IMediaObject_iface; + else if (IsEqualIID(iid, &IID_IPropertyBag)) + *out = &impl->IPropertyBag_iface; + else if (IsEqualIID(iid, &IID_IPropertyStore)) + *out = &impl->IPropertyStore_iface; + else + { + *out = NULL; + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static ULONG WINAPI unknown_AddRef(IUnknown *iface) +{ + struct resampler *impl = impl_from_IUnknown(iface); + ULONG refcount = InterlockedIncrement(&impl->refcount); + + TRACE("iface %p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI unknown_Release(IUnknown *iface) +{ + struct resampler *impl = impl_from_IUnknown(iface); + ULONG refcount = InterlockedDecrement(&impl->refcount); + + TRACE("iface %p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + free(impl); + + return refcount; +} + +static const IUnknownVtbl unknown_vtbl = +{ + unknown_QueryInterface, + unknown_AddRef, + unknown_Release, +}; + +static struct resampler *impl_from_IMFTransform(IMFTransform *iface) +{ + return CONTAINING_RECORD(iface, struct resampler, IMFTransform_iface); +} + +static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, void **out) +{ + return IUnknown_QueryInterface(impl_from_IMFTransform(iface)->outer, iid, out); +} + +static ULONG WINAPI transform_AddRef(IMFTransform *iface) +{ + return IUnknown_AddRef(impl_from_IMFTransform(iface)->outer); +} + +static ULONG WINAPI transform_Release(IMFTransform *iface) +{ + return IUnknown_Release(impl_from_IMFTransform(iface)->outer); +} + +static HRESULT WINAPI transform_GetStreamLimits(IMFTransform *iface, DWORD *input_minimum, + DWORD *input_maximum, DWORD *output_minimum, DWORD *output_maximum) +{ + FIXME("iface %p, input_minimum %p, input_maximum %p, output_minimum %p, output_maximum %p stub!\n", + iface, input_minimum, input_maximum, output_minimum, output_maximum); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetStreamCount(IMFTransform *iface, DWORD *inputs, DWORD *outputs) +{ + FIXME("iface %p, inputs %p, outputs %p stub!\n", iface, inputs, outputs); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetStreamIDs(IMFTransform *iface, DWORD input_size, DWORD *inputs, + DWORD output_size, DWORD *outputs) +{ + FIXME("iface %p, input_size %lu, inputs %p, output_size %lu, outputs %p stub!\n", iface, + input_size, inputs, output_size, outputs); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id, MFT_INPUT_STREAM_INFO *info) +{ + FIXME("iface %p, id %#lx, info %p stub!\n", iface, id, info); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) +{ + FIXME("iface %p, id %#lx, info %p stub!\n", iface, id, info); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) +{ + FIXME("iface %p, attributes %p stub!\n", iface, attributes); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetInputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) +{ + FIXME("iface %p, id %#lx, attributes %p stub!\n", iface, id, attributes); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) +{ + FIXME("iface %p, id %#lx, attributes %p stub!\n", iface, id, attributes); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_DeleteInputStream(IMFTransform *iface, DWORD id) +{ + FIXME("iface %p, id %#lx stub!\n", iface, id); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD streams, DWORD *ids) +{ + FIXME("iface %p, streams %lu, ids %p stub!\n", iface, streams, ids); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, + IMFMediaType **type) +{ + FIXME("iface %p, id %#lx, index %lu, type %p stub!\n", iface, id, index, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index, + IMFMediaType **type) +{ + FIXME("iface %p, id %#lx, index %lu, type %p stub!\n", iface, id, index, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) +{ + FIXME("iface %p, id %#lx, type %p, flags %#lx stub!\n", iface, id, type, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) +{ + FIXME("iface %p, id %#lx, type %p, flags %#lx stub!\n", iface, id, type, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) +{ + FIXME("iface %p, id %#lx, type %p stub!\n", iface, id, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) +{ + FIXME("iface %p, id %#lx, type %p stub!\n", iface, id, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags) +{ + FIXME("iface %p, id %#lx, flags %p stub!\n", iface, id, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_GetOutputStatus(IMFTransform *iface, DWORD *flags) +{ + FIXME("iface %p, flags %p stub!\n", iface, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper) +{ + FIXME("iface %p, lower %I64d, upper %I64d stub!\n", iface, lower, upper); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFMediaEvent *event) +{ + FIXME("iface %p, id %#lx, event %p stub!\n", iface, id, event); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) +{ + FIXME("iface %p, message %#x, param %p stub!\n", iface, message, (void *)param); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) +{ + FIXME("iface %p, id %#lx, sample %p, flags %#lx stub!\n", iface, id, sample, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, + MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status) +{ + FIXME("iface %p, flags %#lx, count %lu, samples %p, status %p stub!\n", iface, flags, count, samples, status); + return E_NOTIMPL; +} + +static const IMFTransformVtbl transform_vtbl = +{ + transform_QueryInterface, + transform_AddRef, + transform_Release, + transform_GetStreamLimits, + transform_GetStreamCount, + transform_GetStreamIDs, + transform_GetInputStreamInfo, + transform_GetOutputStreamInfo, + transform_GetAttributes, + transform_GetInputStreamAttributes, + transform_GetOutputStreamAttributes, + transform_DeleteInputStream, + transform_AddInputStreams, + transform_GetInputAvailableType, + transform_GetOutputAvailableType, + transform_SetInputType, + transform_SetOutputType, + transform_GetInputCurrentType, + transform_GetOutputCurrentType, + transform_GetInputStatus, + transform_GetOutputStatus, + transform_SetOutputBounds, + transform_ProcessEvent, + transform_ProcessMessage, + transform_ProcessInput, + transform_ProcessOutput, +}; + +static inline struct resampler *impl_from_IMediaObject(IMediaObject *iface) +{ + return CONTAINING_RECORD(iface, struct resampler, IMediaObject_iface); +} + +static HRESULT WINAPI media_object_QueryInterface(IMediaObject *iface, REFIID iid, void **obj) +{ + return IUnknown_QueryInterface(impl_from_IMediaObject(iface)->outer, iid, obj); +} + +static ULONG WINAPI media_object_AddRef(IMediaObject *iface) +{ + return IUnknown_AddRef(impl_from_IMediaObject(iface)->outer); +} + +static ULONG WINAPI media_object_Release(IMediaObject *iface) +{ + return IUnknown_Release(impl_from_IMediaObject(iface)->outer); +} + +static HRESULT WINAPI media_object_GetStreamCount(IMediaObject *iface, DWORD *input, DWORD *output) +{ + FIXME("iface %p, input %p, output %p stub!\n", iface, input, output); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetInputStreamInfo(IMediaObject *iface, DWORD index, DWORD *flags) +{ + FIXME("iface %p, index %lu, flags %p stub!\n", iface, index, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetOutputStreamInfo(IMediaObject *iface, DWORD index, DWORD *flags) +{ + FIXME("iface %p, index %lu, flags %p stub!\n", iface, index, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetInputType(IMediaObject *iface, DWORD index, DWORD type_index, + DMO_MEDIA_TYPE *type) +{ + FIXME("iface %p, index %lu, type_index %lu, type %p stub!\n", iface, index, type_index, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetOutputType(IMediaObject *iface, DWORD index, DWORD type_index, + DMO_MEDIA_TYPE *type) +{ + FIXME("iface %p, index %lu, type_index %lu, type %p stub!\n", iface, index, type_index, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index, + const DMO_MEDIA_TYPE *type, DWORD flags) +{ + FIXME("iface %p, index %lu, type %p, flags %#lx stub!\n", iface, index, type, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD index, + const DMO_MEDIA_TYPE *type, DWORD flags) +{ + FIXME("iface %p, index %lu, type %p, flags %#lx stub!\n", iface, index, type, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetInputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) +{ + FIXME("iface %p, index %lu, type %p stub!\n", iface, index, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetOutputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) +{ + FIXME("iface %p, index %lu, type %p stub!\n", iface, index, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetInputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, + DWORD *lookahead, DWORD *alignment) +{ + FIXME("iface %p, index %lu, size %p, lookahead %p, alignment %p stub!\n", iface, index, size, + lookahead, alignment); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetOutputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, DWORD *alignment) +{ + FIXME("iface %p, index %lu, size %p, alignment %p stub!\n", iface, index, size, alignment); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetInputMaxLatency(IMediaObject *iface, DWORD index, REFERENCE_TIME *latency) +{ + FIXME("iface %p, index %lu, latency %p stub!\n", iface, index, latency); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_SetInputMaxLatency(IMediaObject *iface, DWORD index, REFERENCE_TIME latency) +{ + FIXME("iface %p, index %lu, latency %s stub!\n", iface, index, wine_dbgstr_longlong(latency)); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_Flush(IMediaObject *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_Discontinuity(IMediaObject *iface, DWORD index) +{ + FIXME("iface %p, index %lu stub!\n", iface, index); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_AllocateStreamingResources(IMediaObject *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_FreeStreamingResources(IMediaObject *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_GetInputStatus(IMediaObject *iface, DWORD index, DWORD *flags) +{ + FIXME("iface %p, index %lu, flags %p stub!\n", iface, index, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_ProcessInput(IMediaObject *iface, DWORD index, + IMediaBuffer *buffer, DWORD flags, REFERENCE_TIME timestamp, REFERENCE_TIME timelength) +{ + FIXME("iface %p, index %lu, buffer %p, flags %#lx, timestamp %s, timelength %s stub!\n", iface, + index, buffer, flags, wine_dbgstr_longlong(timestamp), wine_dbgstr_longlong(timelength)); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_ProcessOutput(IMediaObject *iface, DWORD flags, DWORD count, + DMO_OUTPUT_DATA_BUFFER *buffers, DWORD *status) +{ + FIXME("iface %p, flags %#lx, count %lu, buffers %p, status %p stub!\n", iface, flags, count, buffers, status); + return E_NOTIMPL; +} + +static HRESULT WINAPI media_object_Lock(IMediaObject *iface, LONG lock) +{ + FIXME("iface %p, lock %ld stub!\n", iface, lock); + return E_NOTIMPL; +} + +static const IMediaObjectVtbl media_object_vtbl = +{ + media_object_QueryInterface, + media_object_AddRef, + media_object_Release, + media_object_GetStreamCount, + media_object_GetInputStreamInfo, + media_object_GetOutputStreamInfo, + media_object_GetInputType, + media_object_GetOutputType, + media_object_SetInputType, + media_object_SetOutputType, + media_object_GetInputCurrentType, + media_object_GetOutputCurrentType, + media_object_GetInputSizeInfo, + media_object_GetOutputSizeInfo, + media_object_GetInputMaxLatency, + media_object_SetInputMaxLatency, + media_object_Flush, + media_object_Discontinuity, + media_object_AllocateStreamingResources, + media_object_FreeStreamingResources, + media_object_GetInputStatus, + media_object_ProcessInput, + media_object_ProcessOutput, + media_object_Lock, +}; + +static inline struct resampler *impl_from_IPropertyBag(IPropertyBag *iface) +{ + return CONTAINING_RECORD(iface, struct resampler, IPropertyBag_iface); +} + +static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID iid, void **out) +{ + return IUnknown_QueryInterface(impl_from_IPropertyBag(iface)->outer, iid, out); +} + +static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface) +{ + return IUnknown_AddRef(impl_from_IPropertyBag(iface)->outer); +} + +static ULONG WINAPI property_bag_Release(IPropertyBag *iface) +{ + return IUnknown_Release(impl_from_IPropertyBag(iface)->outer); +} + +static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *prop_name, VARIANT *value, + IErrorLog *error_log) +{ + FIXME("iface %p, prop_name %s, value %p, error_log %p stub!\n", iface, debugstr_w(prop_name), value, error_log); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *prop_name, VARIANT *value) +{ + FIXME("iface %p, prop_name %s, value %p stub!\n", iface, debugstr_w(prop_name), value); + return S_OK; +} + +static const IPropertyBagVtbl property_bag_vtbl = +{ + property_bag_QueryInterface, + property_bag_AddRef, + property_bag_Release, + property_bag_Read, + property_bag_Write, +}; + +static inline struct resampler *impl_from_IPropertyStore(IPropertyStore *iface) +{ + return CONTAINING_RECORD(iface, struct resampler, IPropertyStore_iface); +} + +static HRESULT WINAPI property_store_QueryInterface(IPropertyStore *iface, REFIID iid, void **out) +{ + return IUnknown_QueryInterface(impl_from_IPropertyStore(iface)->outer, iid, out); +} + +static ULONG WINAPI property_store_AddRef(IPropertyStore *iface) +{ + return IUnknown_AddRef(impl_from_IPropertyStore(iface)->outer); +} + +static ULONG WINAPI property_store_Release(IPropertyStore *iface) +{ + return IUnknown_Release(impl_from_IPropertyStore(iface)->outer); +} + +static HRESULT WINAPI property_store_GetCount(IPropertyStore *iface, DWORD *count) +{ + FIXME("iface %p, count %p stub!\n", iface, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_store_GetAt(IPropertyStore *iface, DWORD index, PROPERTYKEY *key) +{ + FIXME("iface %p, index %lu, key %p stub!\n", iface, index, key); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_store_GetValue(IPropertyStore *iface, REFPROPERTYKEY key, PROPVARIANT *value) +{ + FIXME("iface %p, key %p, value %p stub!\n", iface, key, value); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_store_SetValue(IPropertyStore *iface, REFPROPERTYKEY key, REFPROPVARIANT value) +{ + FIXME("iface %p, key %p, value %p stub!\n", iface, key, value); + return E_NOTIMPL; +} + +static HRESULT WINAPI property_store_Commit(IPropertyStore *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static const IPropertyStoreVtbl property_store_vtbl = +{ + property_store_QueryInterface, + property_store_AddRef, + property_store_Release, + property_store_GetCount, + property_store_GetAt, + property_store_GetValue, + property_store_SetValue, + property_store_Commit, +}; + +HRESULT resampler_create(IUnknown *outer, IUnknown **out) +{ + struct resampler *impl; + + TRACE("outer %p, out %p.\n", outer, out); + + if (!(impl = calloc(1, sizeof(*impl)))) + return E_OUTOFMEMORY; + + impl->IUnknown_inner.lpVtbl = &unknown_vtbl; + impl->IMFTransform_iface.lpVtbl = &transform_vtbl; + impl->IMediaObject_iface.lpVtbl = &media_object_vtbl; + impl->IPropertyBag_iface.lpVtbl = &property_bag_vtbl; + impl->IPropertyStore_iface.lpVtbl = &property_store_vtbl; + impl->refcount = 1; + impl->outer = outer ? outer : &impl->IUnknown_inner; + + *out = &impl->IUnknown_inner; + TRACE("Created %p\n", *out); + return S_OK; +} diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 037f0573b34..77a9f801fa3 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -86,3 +86,9 @@ coclass CWMADecMediaObject {}; uuid(62ce7e72-4c71-4d20-b15d-452831a87d9d) ] coclass CMSH264DecoderMFT {} + +[ + threading(both), + uuid(f447b69e-1884-4a7e-8055-346f74d6edb3) +] +coclass CResamplerMediaObject {}