Anton Baskanov : winegstreamer: Check whether transform is supported when creating MPEG audio decoder.

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


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

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

winegstreamer: Check whether transform is supported when creating MPEG audio decoder.

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/quartz_transform.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c
index 375c549aad5..c383e6774d2 100644
--- a/dlls/winegstreamer/quartz_transform.c
+++ b/dlls/winegstreamer/quartz_transform.c
@@ -21,6 +21,7 @@
 #include "gst_private.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
+WINE_DECLARE_DEBUG_CHANNEL(winediag);
 
 struct transform
 {
@@ -296,9 +297,39 @@ static const struct transform_ops mpeg_audio_codec_transform_ops =
 
 HRESULT mpeg_audio_codec_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_MPEG1_AUDIO,
+        .u.mpeg1_audio =
+        {
+            .layer = 2,
+            .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_CMpegAudioCodec, &mpeg_audio_codec_transform_ops, &object);
     if (FAILED(hr))
         return hr;




More information about the wine-cvs mailing list