Title: [271355] trunk
Revision
271355
Author
[email protected]
Date
2021-01-11 02:31:00 -0800 (Mon, 11 Jan 2021)

Log Message

[GStreamer] Add support to build with native audio and video
https://bugs.webkit.org/show_bug.cgi?id=220087

Reviewed by Philippe Normand.

.:

* Source/cmake/GStreamerDefinitions.cmake: Enable TEXT_SINK.
* Source/cmake/WebKitFeatures.cmake:  Declare TEXT_SINK, NATIVE_VIDEO and NATIVE_AUDIO.

Source/WebCore:

We enable native audio and video in the pipeline depending on the
build flags.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::setPlaybackFlags):
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):

Modified Paths

Diff

Modified: trunk/ChangeLog (271354 => 271355)


--- trunk/ChangeLog	2021-01-11 08:43:55 UTC (rev 271354)
+++ trunk/ChangeLog	2021-01-11 10:31:00 UTC (rev 271355)
@@ -1,3 +1,13 @@
+2021-01-11  Xabier Rodriguez Calvar  <[email protected]>
+
+        [GStreamer] Add support to build with native audio and video
+        https://bugs.webkit.org/show_bug.cgi?id=220087
+
+        Reviewed by Philippe Normand.
+
+        * Source/cmake/GStreamerDefinitions.cmake: Enable TEXT_SINK.
+        * Source/cmake/WebKitFeatures.cmake:  Declare TEXT_SINK, NATIVE_VIDEO and NATIVE_AUDIO.
+
 2021-01-08  Ryan Hostetler  <[email protected]>
 
         Add support for source caching between platforms

Modified: trunk/Source/WebCore/ChangeLog (271354 => 271355)


--- trunk/Source/WebCore/ChangeLog	2021-01-11 08:43:55 UTC (rev 271354)
+++ trunk/Source/WebCore/ChangeLog	2021-01-11 10:31:00 UTC (rev 271355)
@@ -1,3 +1,17 @@
+2021-01-11  Xabier Rodriguez Calvar  <[email protected]>
+
+        [GStreamer] Add support to build with native audio and video
+        https://bugs.webkit.org/show_bug.cgi?id=220087
+
+        Reviewed by Philippe Normand.
+
+        We enable native audio and video in the pipeline depending on the
+        build flags.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::setPlaybackFlags):
+        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+
 2021-01-11  Carlos Garcia Campos  <[email protected]> and Philippe Normand  <[email protected]>
 
         [GStreamer] Do not use the registry scanner singleton from the UI process

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (271354 => 271355)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-01-11 08:43:55 UTC (rev 271354)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-01-11 10:31:00 UTC (rev 271355)
@@ -2687,6 +2687,40 @@
     }
 }
 
+static void setPlaybackFlags(GstElement* pipeline)
+{
+    unsigned hasAudio = getGstPlayFlag("audio");
+    unsigned hasVideo = getGstPlayFlag("video");
+    unsigned hasText = getGstPlayFlag("text");
+    unsigned hasNativeVideo = getGstPlayFlag("native-video");
+    unsigned hasNativeAudio = getGstPlayFlag("native-audio");
+
+    unsigned flags = 0;
+    g_object_get(pipeline, "flags", &flags, nullptr);
+    GST_TRACE_OBJECT(pipeline, "default flags %x", flags);
+    flags = flags & ~hasText;
+    flags = flags & ~hasNativeAudio;
+    flags = flags & ~hasNativeVideo;
+
+#if !ENABLE(TEXT_SINK)
+    hasText = 0x0;
+#endif
+
+#if !ENABLE(NATIVE_VIDEO)
+    hasNativeVideo = 0x0;
+#endif
+
+#if !ENABLE(NATIVE_AUDIO)
+    hasNativeAudio = 0x0;
+#endif
+
+    GST_INFO_OBJECT(pipeline, "text %s, audio %s (native %s), video %s (native %s)", boolForPrinting(hasText), boolForPrinting(hasAudio),
+        boolForPrinting(hasNativeAudio), boolForPrinting(hasVideo), boolForPrinting(hasNativeVideo));
+    flags |= hasText | hasAudio | hasVideo | hasNativeVideo | hasNativeAudio;
+    g_object_set(pipeline, "flags", flags, nullptr);
+    GST_DEBUG_OBJECT(pipeline, "current pipeline flags %x", flags);
+}
+
 void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url, const String& pipelineName)
 {
     GST_INFO("Creating pipeline for %s player", m_player->isVideoPlayer() ? "video" : "audio");
@@ -2721,6 +2755,8 @@
 
     GST_INFO_OBJECT(pipeline(), "Using legacy playbin element: %s", boolForPrinting(m_isLegacyPlaybin));
 
+    setPlaybackFlags(pipeline());
+
     // Let also other listeners subscribe to (application) messages in this bus.
     GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
     gst_bus_add_signal_watch_full(bus.get(), RunLoopSourcePriority::RunLoopDispatcher);

Modified: trunk/Source/cmake/GStreamerDefinitions.cmake (271354 => 271355)


--- trunk/Source/cmake/GStreamerDefinitions.cmake	2021-01-11 08:43:55 UTC (rev 271354)
+++ trunk/Source/cmake/GStreamerDefinitions.cmake	2021-01-11 10:31:00 UTC (rev 271355)
@@ -1,5 +1,6 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TEXT_SINK PRIVATE ON)
 
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PUBLIC ON)
 

Modified: trunk/Source/cmake/WebKitFeatures.cmake (271354 => 271355)


--- trunk/Source/cmake/WebKitFeatures.cmake	2021-01-11 08:43:55 UTC (rev 271354)
+++ trunk/Source/cmake/WebKitFeatures.cmake	2021-01-11 10:31:00 UTC (rev 271355)
@@ -284,6 +284,9 @@
     WEBKIT_OPTION_DEPEND(ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN ENABLE_VIDEO)
     WEBKIT_OPTION_DEPEND(ENABLE_TOUCH_SLIDER ENABLE_TOUCH_EVENTS)
     WEBKIT_OPTION_DEPEND(ENABLE_WEBXR ENABLE_WEBGL)
+    WEBKIT_OPTION_DEFINE(ENABLE_NATIVE_VIDEO "Toggle native video support in GStreamer media player" PRIVATE OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_NATIVE_AUDIO "Toggle native audio support in GStreamer media player" PRIVATE OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_TEXT_SINK "Toggle text sink support in GStreamer media player" PRIVATE OFF)
 endmacro()
 
 macro(_WEBKIT_OPTION_ENFORCE_DEPENDS _name)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to