From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/h264_decoder.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index fae4ede3b54..bc46936555a 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -397,6 +397,23 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR return create_output_media_type(decoder, decoder->output_types[index], NULL, type); }
+static HRESULT update_output_info_size(struct h264_decoder *decoder, UINT32 width, UINT32 height) +{ + HRESULT hr = E_FAIL; + UINT32 i, size; + + decoder->output_info.cbSize = 0; + + for (i = 0; i < decoder->output_type_count; ++i) + { + if (FAILED(hr = MFCalculateImageSize(decoder->output_types[i], width, height, &size))) + return hr; + decoder->output_info.cbSize = max(size, decoder->output_info.cbSize); + } + + return hr; +} + static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { struct h264_decoder *decoder = impl_from_IMFTransform(iface); @@ -436,7 +453,7 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM { if (FAILED(hr = IMFMediaType_SetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, frame_size))) WARN("Failed to update stream type frame size, hr %#lx\n", hr); - decoder->output_info.cbSize = (frame_size >> 32) * (UINT32)frame_size * 2; + return update_output_info_size(decoder, frame_size >> 32, frame_size); }
return S_OK; @@ -654,7 +671,8 @@ static HRESULT handle_stream_type_change(struct h264_decoder *decoder, const str
if (FAILED(hr = IMFMediaType_GetUINT64(decoder->stream_type, &MF_MT_FRAME_SIZE, &frame_size))) return hr; - decoder->output_info.cbSize = (frame_size >> 32) * (UINT32)frame_size * 2; + if (FAILED(hr = update_output_info_size(decoder, frame_size >> 32, frame_size))) + return hr; uninit_allocator(decoder);
return MF_E_TRANSFORM_STREAM_CHANGE;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/ir50_32/ir50.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ir50_32/ir50.c b/dlls/ir50_32/ir50.c index 65c93f7fe5e..69700359e99 100644 --- a/dlls/ir50_32/ir50.c +++ b/dlls/ir50_32/ir50.c @@ -252,7 +252,7 @@ static LRESULT IV50_Decompress( IMFTransform *decoder, ICDECOMPRESS *icd, DWORD mft_buf.pSample = out_sample;
hr = IMFTransform_ProcessOutput( decoder, 0, 1, &mft_buf, &mft_status ); - if ( SUCCEEDED(hr) && (mft_status & MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE) ) + if ( hr == MF_E_TRANSFORM_STREAM_CHANGE ) hr = IMFTransform_ProcessOutput( decoder, 0, 1, &mft_buf, &mft_status );
if ( SUCCEEDED(hr) )
From: Rémi Bernon rbernon@codeweavers.com
--- MAINTAINERS | 1 - dlls/winegstreamer/Makefile.in | 1 - dlls/winegstreamer/h264_decoder.c | 35 +- dlls/winegstreamer/video_decoder.c | 502 ----------------------------- 4 files changed, 34 insertions(+), 505 deletions(-) delete mode 100644 dlls/winegstreamer/video_decoder.c
diff --git a/MAINTAINERS b/MAINTAINERS index 2e259f12d70..47dac56947b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -222,7 +222,6 @@ F: dlls/winegstreamer/h264_decoder.c F: dlls/winegstreamer/media_source.c F: dlls/winegstreamer/mfplat.c F: dlls/winegstreamer/resampler.c -F: dlls/winegstreamer/video_decoder.c F: dlls/winegstreamer/video_processor.c F: dlls/winegstreamer/wg_sample.c F: dlls/winegstreamer/wg_transform.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 02b1b04fdf9..ecb0c3053ab 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -19,7 +19,6 @@ SOURCES = \ resampler.c \ rsrc.rc \ unixlib.c \ - video_decoder.c \ video_processor.c \ wg_allocator.c \ wg_format.c \ diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index bc46936555a..bd601db99c5 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -1,6 +1,7 @@ -/* H264 Decoder Transform +/* Generic Video Decoder Transform * * Copyright 2022 Rémi Bernon for CodeWeavers + * Copyright 2023 Shaun Ren for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -109,7 +110,10 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) attrs.low_latency = !!low_latency;
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) + { + ERR("Failed to create transform with input major_type %u.\n", input_format.major_type); return E_FAIL; + }
return S_OK; } @@ -898,3 +902,32 @@ HRESULT h264_decoder_create(REFIID riid, void **out) IMFTransform_Release(iface); return hr; } + +extern GUID MFVideoFormat_IV50; +static const GUID *const iv50_decoder_input_types[] = +{ + &MFVideoFormat_IV50, +}; +static const GUID *const iv50_decoder_output_types[] = +{ + &MFVideoFormat_YV12, + &MFVideoFormat_YUY2, + &MFVideoFormat_NV11, + &MFVideoFormat_NV12, + &MFVideoFormat_RGB32, + &MFVideoFormat_RGB24, + &MFVideoFormat_RGB565, + &MFVideoFormat_RGB555, + &MFVideoFormat_RGB8, +}; + +HRESULT WINAPI winegstreamer_create_video_decoder(IMFTransform **out) +{ + TRACE("out %p.\n", out); + + if (!init_gstreamer()) + return E_FAIL; + + return video_decoder_create_with_types(iv50_decoder_input_types, ARRAY_SIZE(iv50_decoder_input_types), + iv50_decoder_output_types, ARRAY_SIZE(iv50_decoder_output_types), out); +} diff --git a/dlls/winegstreamer/video_decoder.c b/dlls/winegstreamer/video_decoder.c deleted file mode 100644 index f24c25e03f2..00000000000 --- a/dlls/winegstreamer/video_decoder.c +++ /dev/null @@ -1,502 +0,0 @@ -/* Generic Video Decoder Transform - * - * Copyright 2022 Rémi Bernon for CodeWeavers - * Copyright 2023 Shaun Ren 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 "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(mfplat); - -DEFINE_MEDIATYPE_GUID(MFVideoFormat_IV50, MAKEFOURCC('I','V','5','0')); - -static const GUID *const input_types[] = -{ - &MFVideoFormat_IV50, -}; -static const GUID *const output_types[] = -{ - &MFVideoFormat_YV12, - &MFVideoFormat_YUY2, - &MFVideoFormat_NV11, - &MFVideoFormat_NV12, - &MFVideoFormat_RGB32, - &MFVideoFormat_RGB24, - &MFVideoFormat_RGB565, - &MFVideoFormat_RGB555, - &MFVideoFormat_RGB8, -}; - -struct video_decoder -{ - IMFTransform IMFTransform_iface; - LONG refcount; - - IMFMediaType *input_type; - IMFMediaType *output_type; - - struct wg_format wg_format; - wg_transform_t wg_transform; - struct wg_sample_queue *wg_sample_queue; -}; - -static struct video_decoder *impl_from_IMFTransform(IMFTransform *iface) -{ - return CONTAINING_RECORD(iface, struct video_decoder, IMFTransform_iface); -} - -static HRESULT try_create_wg_transform(struct video_decoder *decoder) -{ - struct wg_transform_attrs attrs = {0}; - struct wg_format input_format; - struct wg_format output_format; - - if (decoder->wg_transform) - wg_transform_destroy(decoder->wg_transform); - decoder->wg_transform = 0; - - mf_media_type_to_wg_format(decoder->input_type, &input_format); - if (input_format.major_type == WG_MAJOR_TYPE_UNKNOWN) - return MF_E_INVALIDMEDIATYPE; - - mf_media_type_to_wg_format(decoder->output_type, &output_format); - if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN) - return MF_E_INVALIDMEDIATYPE; - - if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) - { - ERR("Failed to create transform with input major_type %u.\n", input_format.major_type); - return E_FAIL; - } - - return S_OK; -} - -static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, void **out) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - - TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); - - if (IsEqualGUID(iid, &IID_IUnknown) || - IsEqualGUID(iid, &IID_IMFTransform)) - *out = &decoder->IMFTransform_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 transform_AddRef(IMFTransform *iface) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - ULONG refcount = InterlockedIncrement(&decoder->refcount); - - TRACE("iface %p increasing refcount to %lu.\n", decoder, refcount); - - return refcount; -} - -static ULONG WINAPI transform_Release(IMFTransform *iface) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - ULONG refcount = InterlockedDecrement(&decoder->refcount); - - TRACE("iface %p decreasing refcount to %lu.\n", decoder, refcount); - - if (!refcount) - { - if (decoder->wg_transform) - wg_transform_destroy(decoder->wg_transform); - if (decoder->input_type) - IMFMediaType_Release(decoder->input_type); - if (decoder->output_type) - IMFMediaType_Release(decoder->output_type); - - wg_sample_queue_destroy(decoder->wg_sample_queue); - free(decoder); - } - - return refcount; -} - -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.\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.\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.\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.\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.\n", iface, id, info); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) -{ - FIXME("iface %p, attributes %p semi-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.\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.\n", iface, id); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD streams, DWORD *ids) -{ - FIXME("iface %p, streams %lu, ids %p.\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 %#lx, type %p.\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 %#lx, type %p.\n", iface, id, index, type); - return E_NOTIMPL; -} - -static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - GUID major, subtype; - UINT64 frame_size; - HRESULT hr; - ULONG i; - - TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags); - - if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) || - FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) - return E_INVALIDARG; - - if (!IsEqualGUID(&major, &MFMediaType_Video)) - return MF_E_INVALIDMEDIATYPE; - - for (i = 0; i < ARRAY_SIZE(input_types); ++i) - if (IsEqualGUID(&subtype, input_types[i])) - break; - if (i == ARRAY_SIZE(input_types)) - return MF_E_INVALIDMEDIATYPE; - - if (FAILED(hr = IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size)) || - (frame_size >> 32) == 0 || (UINT32)frame_size == 0) - return MF_E_INVALIDMEDIATYPE; - - if (flags & MFT_SET_TYPE_TEST_ONLY) - return S_OK; - - if (decoder->output_type) - { - IMFMediaType_Release(decoder->output_type); - decoder->output_type = NULL; - } - - if (decoder->input_type) - IMFMediaType_Release(decoder->input_type); - IMFMediaType_AddRef((decoder->input_type = type)); - - return S_OK; -} - -static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - GUID major, subtype; - UINT64 frame_size; - struct wg_format output_format; - HRESULT hr; - ULONG i; - - TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags); - - if (!decoder->input_type) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) || - FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype))) - return hr; - - if (!IsEqualGUID(&major, &MFMediaType_Video)) - return MF_E_INVALIDMEDIATYPE; - - for (i = 0; i < ARRAY_SIZE(output_types); ++i) - if (IsEqualGUID(&subtype, output_types[i])) - break; - if (i == ARRAY_SIZE(output_types)) - return MF_E_INVALIDMEDIATYPE; - - if (FAILED(hr = IMFMediaType_GetUINT64(type, &MF_MT_FRAME_SIZE, &frame_size))) - return hr; - - if (flags & MFT_SET_TYPE_TEST_ONLY) - return S_OK; - - if (decoder->output_type) - IMFMediaType_Release(decoder->output_type); - IMFMediaType_AddRef((decoder->output_type = type)); - - if (decoder->wg_transform) - { - mf_media_type_to_wg_format(decoder->output_type, &output_format); - - if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN - || !wg_transform_set_output_format(decoder->wg_transform, &output_format)) - { - IMFMediaType_Release(decoder->output_type); - decoder->output_type = NULL; - return MF_E_INVALIDMEDIATYPE; - } - } - else if (FAILED(hr = try_create_wg_transform(decoder))) - { - IMFMediaType_Release(decoder->output_type); - decoder->output_type = NULL; - return hr; - } - - decoder->wg_format.u.video.width = frame_size >> 32; - decoder->wg_format.u.video.height = (UINT32)frame_size; - - return hr; -} - -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) -{ - TRACE("iface %p, lower %I64d, upper %I64d.\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 %Ix stub!\n", iface, message, param); - return S_OK; -} - -static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - HRESULT hr; - - TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags); - - if (!decoder->wg_transform) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - hr = wg_transform_push_mf(decoder->wg_transform, sample, decoder->wg_sample_queue); - - return hr; -} - -static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, - MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status) -{ - struct video_decoder *decoder = impl_from_IMFTransform(iface); - struct wg_format wg_format; - UINT32 sample_size; - UINT64 frame_rate; - GUID subtype; - HRESULT hr; - - TRACE("iface %p, flags %#lx, count %lu, samples %p, status %p.\n", iface, flags, count, samples, status); - - if (count != 1) - return E_INVALIDARG; - - if (!decoder->wg_transform) - return MF_E_TRANSFORM_TYPE_NOT_SET; - - *status = samples->dwStatus = 0; - if (!samples->pSample) - return E_INVALIDARG; - - if (FAILED(hr = IMFMediaType_GetGUID(decoder->output_type, &MF_MT_SUBTYPE, &subtype))) - return hr; - if (FAILED(hr = MFCalculateImageSize(&subtype, decoder->wg_format.u.video.width, - decoder->wg_format.u.video.height, &sample_size))) - return hr; - - if (SUCCEEDED(hr = wg_transform_read_mf(decoder->wg_transform, samples->pSample, - sample_size, &wg_format, &samples->dwStatus))) - wg_sample_queue_flush(decoder->wg_sample_queue, false); - - if (hr == MF_E_TRANSFORM_STREAM_CHANGE) - { - decoder->wg_format = wg_format; - - if (FAILED(hr = MFCalculateImageSize(&subtype, decoder->wg_format.u.video.width, - decoder->wg_format.u.video.height, &sample_size))) - return hr; - - /* keep the frame rate that was requested, GStreamer doesn't provide any */ - if (SUCCEEDED(IMFMediaType_GetUINT64(decoder->output_type, &MF_MT_FRAME_RATE, &frame_rate))) - { - decoder->wg_format.u.video.fps_n = frame_rate >> 32; - decoder->wg_format.u.video.fps_d = (UINT32)frame_rate; - } - - samples[0].dwStatus |= MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE; - *status |= MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE; - } - - return hr; -} - -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, -}; - -HRESULT WINAPI winegstreamer_create_video_decoder(IMFTransform **out) -{ - struct video_decoder *decoder; - HRESULT hr; - - TRACE("out %p.\n", out); - - if (!init_gstreamer()) - return E_FAIL; - - if (!(decoder = calloc(1, sizeof(*decoder)))) - return E_OUTOFMEMORY; - - decoder->IMFTransform_iface.lpVtbl = &transform_vtbl; - decoder->refcount = 1; - - decoder->wg_format.u.video.fps_d = 1; - decoder->wg_format.u.video.fps_n = 1; - - if (FAILED(hr = wg_sample_queue_create(&decoder->wg_sample_queue))) - goto failed; - - *out = &decoder->IMFTransform_iface; - TRACE("created decoder %p.\n", *out); - return S_OK; - -failed: - free(decoder); - return hr; -}
From: Rémi Bernon rbernon@codeweavers.com
--- MAINTAINERS | 2 +- dlls/winegstreamer/Makefile.in | 2 +- .../{h264_decoder.c => video_decoder.c} | 56 +++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) rename dlls/winegstreamer/{h264_decoder.c => video_decoder.c} (93%)
diff --git a/MAINTAINERS b/MAINTAINERS index 47dac56947b..34c2acdd56b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -218,10 +218,10 @@ P: Zebediah Figura z.figura12@gmail.com F: dlls/mf/tests/transform.c F: dlls/winegstreamer/aac_decoder.c F: dlls/winegstreamer/color_convert.c -F: dlls/winegstreamer/h264_decoder.c F: dlls/winegstreamer/media_source.c F: dlls/winegstreamer/mfplat.c F: dlls/winegstreamer/resampler.c +F: dlls/winegstreamer/video_decoder.c F: dlls/winegstreamer/video_processor.c F: dlls/winegstreamer/wg_sample.c F: dlls/winegstreamer/wg_transform.c diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index ecb0c3053ab..410bbd1dc03 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -9,7 +9,6 @@ UNIX_LIBS = $(GSTREAMER_LIBS) $(PTHREAD_LIBS) SOURCES = \ aac_decoder.c \ color_convert.c \ - h264_decoder.c \ main.c \ media_sink.c \ media_source.c \ @@ -19,6 +18,7 @@ SOURCES = \ resampler.c \ rsrc.rc \ unixlib.c \ + video_decoder.c \ video_processor.c \ wg_allocator.c \ wg_format.c \ diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/video_decoder.c similarity index 93% rename from dlls/winegstreamer/h264_decoder.c rename to dlls/winegstreamer/video_decoder.c index bd601db99c5..0837217e3a6 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/video_decoder.c @@ -43,7 +43,7 @@ static const GUID *const video_decoder_output_types[] = &MFVideoFormat_YUY2, };
-struct h264_decoder +struct video_decoder { IMFTransform IMFTransform_iface; LONG refcount; @@ -72,12 +72,12 @@ struct h264_decoder IMFMediaBuffer *temp_buffer; };
-static struct h264_decoder *impl_from_IMFTransform(IMFTransform *iface) +static struct video_decoder *impl_from_IMFTransform(IMFTransform *iface) { - return CONTAINING_RECORD(iface, struct h264_decoder, IMFTransform_iface); + return CONTAINING_RECORD(iface, struct video_decoder, IMFTransform_iface); }
-static HRESULT try_create_wg_transform(struct h264_decoder *decoder) +static HRESULT try_create_wg_transform(struct video_decoder *decoder) { /* Call of Duty: Black Ops 3 doesn't care about the ProcessInput/ProcessOutput * return values, it calls them in a specific order and expects the decoder @@ -118,7 +118,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) return S_OK; }
-static HRESULT create_output_media_type(struct h264_decoder *decoder, const GUID *subtype, +static HRESULT create_output_media_type(struct video_decoder *decoder, const GUID *subtype, IMFMediaType *output_type, IMFMediaType **media_type) { IMFMediaType *default_type = decoder->output_type, *stream_type = output_type ? output_type : decoder->stream_type; @@ -198,7 +198,7 @@ done: return hr; }
-static HRESULT init_allocator(struct h264_decoder *decoder) +static HRESULT init_allocator(struct video_decoder *decoder) { HRESULT hr;
@@ -217,7 +217,7 @@ static HRESULT init_allocator(struct h264_decoder *decoder) return S_OK; }
-static void uninit_allocator(struct h264_decoder *decoder) +static void uninit_allocator(struct video_decoder *decoder) { IMFVideoSampleAllocatorEx_UninitializeSampleAllocator(decoder->allocator); decoder->allocator_initialized = FALSE; @@ -225,7 +225,7 @@ static void uninit_allocator(struct h264_decoder *decoder)
static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid, void **out) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
@@ -245,7 +245,7 @@ static HRESULT WINAPI transform_QueryInterface(IMFTransform *iface, REFIID iid,
static ULONG WINAPI transform_AddRef(IMFTransform *iface) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); ULONG refcount = InterlockedIncrement(&decoder->refcount);
TRACE("iface %p increasing refcount to %lu.\n", decoder, refcount); @@ -255,7 +255,7 @@ static ULONG WINAPI transform_AddRef(IMFTransform *iface)
static ULONG WINAPI transform_Release(IMFTransform *iface) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); ULONG refcount = InterlockedDecrement(&decoder->refcount);
TRACE("iface %p decreasing refcount to %lu.\n", decoder, refcount); @@ -309,7 +309,7 @@ static HRESULT WINAPI transform_GetStreamIDs(IMFTransform *iface, DWORD input_si
static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id, MFT_INPUT_STREAM_INFO *info) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
TRACE("iface %p, id %#lx, info %p.\n", iface, id, info);
@@ -319,7 +319,7 @@ static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id
static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
TRACE("iface %p, id %#lx, info %p.\n", iface, id, info);
@@ -329,7 +329,7 @@ static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD i
static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
FIXME("iface %p, attributes %p semi-stub!\n", iface, attributes);
@@ -348,7 +348,7 @@ static HRESULT WINAPI transform_GetInputStreamAttributes(IMFTransform *iface, DW
static HRESULT WINAPI transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
FIXME("iface %p, id %#lx, attributes %p semi-stub!\n", iface, id, attributes);
@@ -376,7 +376,7 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type);
@@ -389,7 +389,7 @@ static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type);
@@ -401,7 +401,7 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR return create_output_media_type(decoder, decoder->output_types[index], NULL, type); }
-static HRESULT update_output_info_size(struct h264_decoder *decoder, UINT32 width, UINT32 height) +static HRESULT update_output_info_size(struct video_decoder *decoder, UINT32 width, UINT32 height) { HRESULT hr = E_FAIL; UINT32 i, size; @@ -420,7 +420,7 @@ static HRESULT update_output_info_size(struct h264_decoder *decoder, UINT32 widt
static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); GUID major, subtype; UINT64 frame_size; HRESULT hr; @@ -465,7 +465,7 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); UINT64 frame_size, stream_frame_size; GUID major, subtype; HRESULT hr; @@ -525,7 +525,7 @@ static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMF
static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); HRESULT hr;
TRACE("iface %p, id %#lx, type %p\n", iface, id, type); @@ -541,7 +541,7 @@ static HRESULT WINAPI transform_GetInputCurrentType(IMFTransform *iface, DWORD i
static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); GUID subtype; HRESULT hr;
@@ -556,7 +556,7 @@ static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD
static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
TRACE("iface %p, id %#lx, flags %p.\n", iface, id, flags);
@@ -587,7 +587,7 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM
static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); HRESULT hr;
TRACE("iface %p, message %#x, param %Ix.\n", iface, message, param); @@ -619,7 +619,7 @@ static HRESULT WINAPI transform_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_
static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface);
TRACE("iface %p, id %#lx, sample %p, flags %#lx.\n", iface, id, sample, flags);
@@ -629,7 +629,7 @@ static HRESULT WINAPI transform_ProcessInput(IMFTransform *iface, DWORD id, IMFS return wg_transform_push_mf(decoder->wg_transform, sample, decoder->wg_sample_queue); }
-static HRESULT output_sample(struct h264_decoder *decoder, IMFSample **out, IMFSample *src_sample) +static HRESULT output_sample(struct video_decoder *decoder, IMFSample **out, IMFSample *src_sample) { MFT_OUTPUT_DATA_BUFFER output[1]; IMFSample *sample; @@ -659,7 +659,7 @@ static HRESULT output_sample(struct h264_decoder *decoder, IMFSample **out, IMFS return S_OK; }
-static HRESULT handle_stream_type_change(struct h264_decoder *decoder, const struct wg_format *format) +static HRESULT handle_stream_type_change(struct video_decoder *decoder, const struct wg_format *format) { UINT64 frame_size, frame_rate; HRESULT hr; @@ -685,7 +685,7 @@ static HRESULT handle_stream_type_change(struct h264_decoder *decoder, const str static HRESULT WINAPI transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count, MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status) { - struct h264_decoder *decoder = impl_from_IMFTransform(iface); + struct video_decoder *decoder = impl_from_IMFTransform(iface); struct wg_format wg_format; UINT32 sample_size; LONGLONG duration; @@ -801,7 +801,7 @@ static const IMFTransformVtbl transform_vtbl = static HRESULT video_decoder_create_with_types(const GUID *const *input_types, UINT input_type_count, const GUID *const *output_types, UINT output_type_count, IMFTransform **ret) { - struct h264_decoder *decoder; + struct video_decoder *decoder; HRESULT hr;
if (!(decoder = calloc(1, sizeof(*decoder))))
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 full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=143263
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/winegstreamer/h264_decoder.c:401 Task: Patch failed to apply
=== debian11b (build log) ===
error: patch failed: dlls/winegstreamer/h264_decoder.c:401 Task: Patch failed to apply
Somehow there's a lot of test failures, none of them seem related.
This merge request was approved by Zebediah Figura.