Signed-off-by: Anton Baskanov baskanov@gmail.com --- v2: * Added "parsed" field to MPEG-1 audio caps. * Allow mpg123audiodec to be used. * Use WG_MAJOR_TYPE_AUDIO instead of WG_MAJOR_TYPE_MPEG1_AUDIO. --- dlls/winegstreamer/wg_format.c | 29 +++++++++++++++++++++++++++++ dlls/winegstreamer/wg_transform.c | 13 +++++++++++++ 2 files changed, 42 insertions(+)
diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c index ff9238a6a69..038ec956a42 100644 --- a/dlls/winegstreamer/wg_format.c +++ b/dlls/winegstreamer/wg_format.c @@ -338,12 +338,41 @@ static void wg_channel_mask_to_gst(GstAudioChannelPosition *positions, uint32_t } }
+static GstCaps *wg_format_to_caps_mpeg1_audio(const struct wg_format *format) +{ + GstCaps *caps; + int layer; + + if (format->u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER1) + layer = 1; + else if (format->u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER2) + layer = 2; + else if (format->u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER3) + layer = 3; + + if (!(caps = gst_caps_new_empty_simple("audio/mpeg"))) + return NULL; + + gst_caps_set_simple(caps, "mpegversion", G_TYPE_INT, 1, NULL); + gst_caps_set_simple(caps, "layer", G_TYPE_INT, layer, NULL); + gst_caps_set_simple(caps, "rate", G_TYPE_INT, format->u.audio.rate, NULL); + gst_caps_set_simple(caps, "channels", G_TYPE_INT, format->u.audio.channels, NULL); + gst_caps_set_simple(caps, "parsed", G_TYPE_BOOLEAN, TRUE, NULL); + + return caps; +} + static GstCaps *wg_format_to_caps_audio(const struct wg_format *format) { GstAudioChannelPosition positions[32]; GstAudioFormat audio_format; GstAudioInfo info;
+ if (format->u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER1 + || format->u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER2 + || format->u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER3) + return wg_format_to_caps_mpeg1_audio(format); + if ((audio_format = wg_audio_format_to_gst(format->u.audio.format)) == GST_AUDIO_FORMAT_UNKNOWN) return NULL;
diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 49c7bfaa927..d8fe896f31e 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -234,6 +234,19 @@ NTSTATUS wg_transform_create(void *args) break;
case WG_MAJOR_TYPE_AUDIO: + if (input_format.u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER1 + || input_format.u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER2 + || input_format.u.audio.format == WG_AUDIO_FORMAT_MPEG1_LAYER3) + { + if (!(element = transform_find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps)) + || !transform_append_element(transform, element, &first, &last)) + { + gst_caps_unref(raw_caps); + goto out; + } + break; + } + /* fallthrough */ case WG_MAJOR_TYPE_VIDEO: case WG_MAJOR_TYPE_UNKNOWN: GST_FIXME("Format %u not implemented!", input_format.major_type);