winegstreamer: Check whether transform is supported when creating MPEG layer-3 decoder.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
This commit is contained in:
Anton Baskanov 2022-10-02 23:30:51 +07:00 committed by Alexandre Julliard
parent a9cda37f65
commit 9d8de06fd9

View file

@ -816,9 +816,39 @@ static const struct transform_ops mpeg_layer3_decoder_transform_ops =
HRESULT mpeg_layer3_decoder_create(IUnknown *outer, IUnknown **out)
{
static const struct wg_format output_format =
{
.major_type = WG_MAJOR_TYPE_AUDIO,
.u.audio =
{
.format = WG_AUDIO_FORMAT_S16LE,
.channel_mask = 1,
.channels = 1,
.rate = 44100,
},
};
static const struct wg_format input_format =
{
.major_type = WG_MAJOR_TYPE_AUDIO_MPEG1,
.u.audio_mpeg1 =
{
.layer = 3,
.channels = 1,
.rate = 44100,
},
};
struct wg_transform *transform;
struct transform *object;
HRESULT hr;
transform = wg_transform_create(&input_format, &output_format);
if (!transform)
{
ERR_(winediag)("GStreamer doesn't support MPEG-1 audio decoding, please install appropriate plugins.\n");
return E_FAIL;
}
wg_transform_destroy(transform);
hr = transform_create(outer, &CLSID_mpeg_layer3_decoder, &mpeg_layer3_decoder_transform_ops, &object);
if (FAILED(hr))
return hr;