wpe: Implement audio support
[platform/upstream/gstreamer.git] / ext / wpe / gstwpe.cpp
1 /* Copyright (C) <2018> Philippe Normand <philn@igalia.com>
2  * Copyright (C) <2018> Žan Doberšek <zdobersek@igalia.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 /**
21  * SECTION:element-wpesrc
22  * @title: wpesrc
23  *
24  * The wpesrc element is used to produce a video texture representing a web page
25  * rendered off-screen by WPE.
26  *
27  * Starting from WPEBackend-FDO 1.6.x, software rendering support is available. This
28  * features allows wpesrc to be used on machines without GPU, and/or for testing
29  * purpose. To enable it, set the `LIBGL_ALWAYS_SOFTWARE=true` environment
30  * variable and make sure `video/x-raw, format=BGRA` caps are negotiated by the
31  * wpesrc element.
32  *
33  * ## Example launch lines
34  *
35  * |[
36  * gst-launch-1.0 -v wpesrc location="https://gstreamer.freedesktop.org" ! queue ! glimagesink
37  * ]|
38  * Shows the GStreamer website homepage
39  *
40  * |[
41  * LIBGL_ALWAYS_SOFTWARE=true gst-launch-1.0 -v wpesrc num-buffers=50 location="https://gstreamer.freedesktop.org" ! videoconvert ! pngenc ! multifilesink location=/tmp/snapshot-%05d.png
42  * ]|
43  * Saves the first 50 video frames generated for the GStreamer website as PNG files in /tmp.
44  *
45  * |[
46  * gst-play-1.0 --videosink gtkglsink wpe://https://gstreamer.freedesktop.org
47  * ]|
48  * Shows the GStreamer website homepage as played with GstPlayer in a GTK+ window.
49  *
50  * |[
51  * gst-launch-1.0  glvideomixer name=m sink_1::zorder=0 ! glimagesink wpesrc location="file:///home/phil/Downloads/plunk/index.html" draw-background=0 ! m. videotestsrc ! queue ! glupload ! glcolorconvert ! m.
52  * ]|
53  * Composite WPE with a video stream in a single OpenGL scene.
54  *
55  * |[
56  * gst-launch-1.0 glvideomixer name=m sink_1::zorder=0 sink_0::height=818 sink_0::width=1920 ! gtkglsink wpesrc location="file:///home/phil/Downloads/plunk/index.html" draw-background=0 ! m. uridecodebin uri="http://192.168.1.44/Sintel.2010.1080p.mkv" name=d d. ! queue ! glupload ! glcolorconvert ! m.
57  * ]|
58  * Composite WPE with a video stream, sink_0 pad properties have to match the video dimensions.
59  */
60
61
62 #ifdef HAVE_CONFIG_H
63 #include <config.h>
64 #endif
65
66 #include "gstwpevideosrc.h"
67 #include "gstwpesrcbin.h"
68
69 GST_DEBUG_CATEGORY (wpe_video_src_debug);
70 GST_DEBUG_CATEGORY (wpe_view_debug);
71 GST_DEBUG_CATEGORY (wpe_src_debug);
72
73 static gboolean
74 plugin_init (GstPlugin * plugin)
75 {
76   GST_DEBUG_CATEGORY_INIT (wpe_video_src_debug, "wpevideosrc", 0, "WPE Video Source");
77   GST_DEBUG_CATEGORY_INIT (wpe_view_debug, "wpeview", 0, "WPE Threaded View");
78   GST_DEBUG_CATEGORY_INIT (wpe_src_debug, "wpesrc", 0, "WPE Source");
79
80   gboolean result = gst_element_register (plugin, "wpevideosrc", GST_RANK_NONE,
81       GST_TYPE_WPE_VIDEO_SRC);
82   result &= gst_element_register(plugin, "wpesrc", GST_RANK_NONE, GST_TYPE_WPE_SRC);
83   return result;
84 }
85
86 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
87     wpe, "WPE src plugin", plugin_init, VERSION, GST_LICENSE, PACKAGE,
88     GST_PACKAGE_ORIGIN)