Module: wine Branch: master Commit: c73dddbf0f8627395b6e813b4f096bcc1a0b6e27 URL: https://gitlab.winehq.org/wine/wine/-/commit/c73dddbf0f8627395b6e813b4f096bc...
Author: Ziqing Hui zhui@codeweavers.com Date: Thu Jun 20 10:59:43 2024 +0800
winegstreamer/video_encoder: Implement GetOutputAvailableType.
---
dlls/winegstreamer/video_encoder.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/dlls/winegstreamer/video_encoder.c b/dlls/winegstreamer/video_encoder.c index beb74003d64..73d3f757ff9 100644 --- a/dlls/winegstreamer/video_encoder.c +++ b/dlls/winegstreamer/video_encoder.c @@ -38,6 +38,9 @@ struct video_encoder IMFTransform IMFTransform_iface; LONG refcount;
+ const GUID *const *output_types; + UINT output_type_count; + IMFAttributes *attributes; };
@@ -174,8 +177,14 @@ static HRESULT WINAPI transform_GetInputAvailableType(IMFTransform *iface, DWORD 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; + struct video_encoder *encoder = impl_from_IMFTransform(iface); + + TRACE("iface %p, id %#lx, index %#lx, type %p.\n", iface, id, index, type); + + *type = NULL; + if (index >= encoder->output_type_count) + return MF_E_NO_MORE_TYPES; + return MFCreateVideoMediaTypeFromSubtype(encoder->output_types[index], (IMFVideoMediaType **)type); }
static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) @@ -275,7 +284,8 @@ static const IMFTransformVtbl transform_vtbl = transform_ProcessOutput, };
-static HRESULT video_encoder_create(struct video_encoder **out) +static HRESULT video_encoder_create(const GUID *const *output_types, UINT output_type_count, + struct video_encoder **out) { struct video_encoder *encoder; HRESULT hr; @@ -286,6 +296,9 @@ static HRESULT video_encoder_create(struct video_encoder **out) encoder->IMFTransform_iface.lpVtbl = &transform_vtbl; encoder->refcount = 1;
+ encoder->output_types = output_types; + encoder->output_type_count = output_type_count; + if (FAILED(hr = MFCreateAttributes(&encoder->attributes, 16))) goto failed; if (FAILED(hr = IMFAttributes_SetUINT32(encoder->attributes, &MFT_ENCODER_SUPPORTS_CONFIG_EVENT, TRUE))) @@ -302,6 +315,11 @@ failed: return hr; }
+static const GUID *const h264_encoder_output_types[] = +{ + &MFVideoFormat_H264, +}; + HRESULT h264_encoder_create(REFIID riid, void **out) { const MFVIDEOFORMAT input_format = @@ -327,7 +345,8 @@ HRESULT h264_encoder_create(REFIID riid, void **out) return hr; }
- if (FAILED(hr = video_encoder_create(&encoder))) + if (FAILED(hr = video_encoder_create(h264_encoder_output_types, ARRAY_SIZE(h264_encoder_output_types), + &encoder))) return hr;
TRACE("Created h264 encoder transform %p.\n", &encoder->IMFTransform_iface);