Anton Baskanov : winegstreamer: Support MPEG-1 audio in wg_transform.

Alexandre Julliard julliard at winehq.org
Fri May 6 15:38:39 CDT 2022


Module: wine
Branch: master
Commit: 0250e84bf17e287e15517329c01f6d0e346c0710
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0250e84bf17e287e15517329c01f6d0e346c0710

Author: Anton Baskanov <baskanov at gmail.com>
Date:   Thu May  5 17:24:31 2022 -0500

winegstreamer: Support MPEG-1 audio in wg_transform.

Signed-off-by: Anton Baskanov <baskanov at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/wg_format.c    | 18 +++++++++++++++++-
 dlls/winegstreamer/wg_transform.c |  2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c
index 608070b78e8..5b3a5617ff1 100644
--- a/dlls/winegstreamer/wg_format.c
+++ b/dlls/winegstreamer/wg_format.c
@@ -331,6 +331,22 @@ 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;
+
+    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, format->u.mpeg1_audio.layer, NULL);
+    gst_caps_set_simple(caps, "rate", G_TYPE_INT, format->u.mpeg1_audio.rate, NULL);
+    gst_caps_set_simple(caps, "channels", G_TYPE_INT, format->u.mpeg1_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];
@@ -495,7 +511,7 @@ GstCaps *wg_format_to_caps(const struct wg_format *format)
         case WG_MAJOR_TYPE_UNKNOWN:
             return gst_caps_new_any();
         case WG_MAJOR_TYPE_MPEG1_AUDIO:
-            return NULL;
+            return wg_format_to_caps_mpeg1_audio(format);
         case WG_MAJOR_TYPE_WMA:
             return wg_format_to_caps_wma(format);
         case WG_MAJOR_TYPE_H264:
diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
index 08e0b4aca32..21392a82509 100644
--- a/dlls/winegstreamer/wg_transform.c
+++ b/dlls/winegstreamer/wg_transform.c
@@ -227,6 +227,7 @@ NTSTATUS wg_transform_create(void *args)
                     || !transform_append_element(transform, element, &first, &last))
                 goto out;
             /* fallthrough */
+        case WG_MAJOR_TYPE_MPEG1_AUDIO:
         case WG_MAJOR_TYPE_WMA:
             if (!(element = transform_find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps))
                     || !transform_append_element(transform, element, &first, &last))
@@ -236,7 +237,6 @@ NTSTATUS wg_transform_create(void *args)
             }
             break;
 
-        case WG_MAJOR_TYPE_MPEG1_AUDIO:
         case WG_MAJOR_TYPE_AUDIO:
         case WG_MAJOR_TYPE_VIDEO:
         case WG_MAJOR_TYPE_UNKNOWN:




More information about the wine-cvs mailing list