[PATCH] winegstreamer: Check whether transforms are supported at creation time.

Zebediah Figura zfigura at codeweavers.com
Wed Apr 27 13:16:20 CDT 2022


On 4/27/22 12:50, Rémi Bernon wrote:
> diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c
> index 8bfa15529db..778729f576c 100644
> --- a/dlls/winegstreamer/h264_decoder.c
> +++ b/dlls/winegstreamer/h264_decoder.c
> @@ -585,10 +585,20 @@ static const IMFTransformVtbl transform_vtbl =
>   
>   HRESULT h264_decoder_create(REFIID riid, void **ret)
>   {
> +    struct wg_format output_format = {.major_type = WG_MAJOR_TYPE_UNKNOWN};
> +    struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_H264};

This feels a bit awkward. input_format is somewhat ill-formed [not that 
struct wg_format is highly formalized, but wg_format_to_caps_h264() at 
least expects the profile and level to be set], but output_format has a 
major type of UNKNOWN, presumably to avoid passing an ill-formed type.

> @@ -210,9 +209,13 @@ NTSTATUS wg_transform_create(void *args)
>        * based on the actual output caps now. Matching decoders with the
>        * raw output media type should be enough.
>        */
> -    media_type = gst_structure_get_name(gst_caps_get_structure(sink_caps, 0));
> -    if (!(raw_caps = gst_caps_new_empty_simple(media_type)))
> +    if (!(raw_caps = gst_caps_new_any()))
>           goto out;
> +    if (gst_caps_get_size(sink_caps))
> +    {
> +        const gchar *media_type = gst_structure_get_name(gst_caps_get_structure(sink_caps, 0));
> +        gst_caps_append_structure(raw_caps, gst_structure_new_empty(media_type));
> +    }

And this will end up checking whether H.264 or WMA can decode to 
*anything*, which, while probably sufficient in practice, is less useful 
in theory than checking whether it can decode to, say, NV12 or PCM 
respectively.

I don't think that wg_format structs need to be fully specified (e.g. 
just enough to calculate the GstStructure name seems sufficient), 
although it'd be nice to avoid generating GStreamer FIXMEs under normal 
operation.



More information about the wine-devel mailing list