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

Rémi Bernon rbernon at codeweavers.com
Wed Apr 27 13:41:26 CDT 2022


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52908
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52914
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

(Imho the WG_MAJOR_TYPE_UNKNOWN was simpler, but I don't mind)

 dlls/winegstreamer/h264_decoder.c | 19 +++++++++++++++++++
 dlls/winegstreamer/wma_decoder.c  | 20 ++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c
index 8bfa15529db..0b085d44552 100644
--- a/dlls/winegstreamer/h264_decoder.c
+++ b/dlls/winegstreamer/h264_decoder.c
@@ -585,10 +585,29 @@ static const IMFTransformVtbl transform_vtbl =
 
 HRESULT h264_decoder_create(REFIID riid, void **ret)
 {
+    struct wg_format output_format =
+    {
+        .major_type = WG_MAJOR_TYPE_VIDEO,
+        .u.video =
+        {
+            .format = WG_VIDEO_FORMAT_I420,
+            .width = 1920,
+            .height = 1080,
+        },
+    };
+    struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_H264};
+    struct wg_transform *transform;
     struct h264_decoder *decoder;
 
     TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret);
 
+    if (!(transform = wg_transform_create(&input_format, &output_format)))
+    {
+        FIXME("GStreamer doesn't support H264 decoding, please install appropriate plugins\n");
+        return E_FAIL;
+    }
+    wg_transform_destroy(transform);
+
     if (!(decoder = calloc(1, sizeof(*decoder))))
         return E_OUTOFMEMORY;
 
diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c
index 57b0f204f9e..24ea176bfc8 100644
--- a/dlls/winegstreamer/wma_decoder.c
+++ b/dlls/winegstreamer/wma_decoder.c
@@ -853,10 +853,30 @@ static const IPropertyBagVtbl property_bag_vtbl =
 
 HRESULT wma_decoder_create(IUnknown *outer, IUnknown **out)
 {
+    struct wg_format output_format =
+    {
+        .major_type = WG_MAJOR_TYPE_AUDIO,
+        .u.audio =
+        {
+            .format = WG_AUDIO_FORMAT_F32LE,
+            .channel_mask = 1,
+            .channels = 1,
+            .rate = 44100,
+        },
+    };
+    struct wg_format input_format = {.major_type = WG_MAJOR_TYPE_WMA};
+    struct wg_transform *transform;
     struct wma_decoder *decoder;
 
     TRACE("outer %p, out %p.\n", outer, out);
 
+    if (!(transform = wg_transform_create(&input_format, &output_format)))
+    {
+        FIXME("GStreamer doesn't support WMA decoding, please install appropriate plugins\n");
+        return E_FAIL;
+    }
+    wg_transform_destroy(transform);
+
     if (!(decoder = calloc(1, sizeof(*decoder))))
         return E_OUTOFMEMORY;
 
-- 
2.35.1




More information about the wine-devel mailing list