Title: [292387] trunk/Source/WebCore
Revision
292387
Author
dp...@igalia.com
Date
2022-04-05 02:11:43 -0700 (Tue, 05 Apr 2022)

Log Message

[GStreamer] gst_video_format_info_component not defined in GStreamer <1.18
https://bugs.webkit.org/show_bug.cgi?id=238685

Reviewed by Philippe Normand.

* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::webkitGstVideoFormatInfoComponent):
* platform/graphics/gstreamer/GStreamerCommon.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (292386 => 292387)


--- trunk/Source/WebCore/ChangeLog	2022-04-05 08:50:32 UTC (rev 292386)
+++ trunk/Source/WebCore/ChangeLog	2022-04-05 09:11:43 UTC (rev 292387)
@@ -1,3 +1,14 @@
+2022-04-05  Diego Pino Garcia  <dp...@igalia.com>
+
+        [GStreamer] gst_video_format_info_component not defined in GStreamer <1.18
+        https://bugs.webkit.org/show_bug.cgi?id=238685
+
+        Reviewed by Philippe Normand.
+
+        * platform/graphics/gstreamer/GStreamerCommon.cpp:
+        (WebCore::webkitGstVideoFormatInfoComponent):
+        * platform/graphics/gstreamer/GStreamerCommon.h:
+
 2022-04-05  Nikolaos Mouchtaris  <nmouchta...@apple.com>
 
         Support rendering url(), CSS basic shapes other than path(), and coord-box for offset-path

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp (292386 => 292387)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2022-04-05 08:50:32 UTC (rev 292386)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2022-04-05 09:11:43 UTC (rev 292387)
@@ -85,6 +85,24 @@
     return pad;
 }
 
+#if !GST_CHECK_VERSION(1, 18, 0)
+void webkitGstVideoFormatInfoComponent(const GstVideoFormatInfo* info, guint plane, gint components[GST_VIDEO_MAX_COMPONENTS])
+{
+    guint c, i = 0;
+
+    /* Reverse mapping of info->plane. */
+    for (c = 0; c < GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info); c++) {
+        if (GST_VIDEO_FORMAT_INFO_PLANE(info, c) == plane) {
+            components[i] = c;
+            i++;
+        }
+    }
+
+    for (c = i; c < GST_VIDEO_MAX_COMPONENTS; c++)
+        components[c] = -1;
+}
+#endif
+
 #if ENABLE(VIDEO)
 bool getVideoSizeAndFormatFromCaps(const GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride)
 {

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h (292386 => 292387)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h	2022-04-05 08:50:32 UTC (rev 292386)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h	2022-04-05 09:11:43 UTC (rev 292387)
@@ -55,6 +55,15 @@
     return true;
 }
 
+// gst_video_format_info_component() is GStreamer 1.18 API, so for older versions we use a local
+// vendored copy of the function.
+#if !GST_CHECK_VERSION(1, 18, 0)
+#define GST_VIDEO_MAX_COMPONENTS 4
+void webkitGstVideoFormatInfoComponent(const GstVideoFormatInfo*, guint, gint components[GST_VIDEO_MAX_COMPONENTS]);
+
+#define gst_video_format_info_component webkitGstVideoFormatInfoComponent
+#endif
+
 #define GST_VIDEO_CAPS_TYPE_PREFIX  "video/"
 #define GST_AUDIO_CAPS_TYPE_PREFIX  "audio/"
 #define GST_TEXT_CAPS_TYPE_PREFIX   "text/"
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to