summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorPhilippe Normand <philn@igalia.com>2021-08-31 17:33:02 +0100
committerNicolas Dufresne <nicolas@ndufresne.ca>2021-09-13 15:02:24 +0000
commit5dc39091f393a8cc596871015e6b2c3dd1d18004 (patch)
tree7d14d7abdd8ef91ed7e5bd9e30d148d08f4e887e /ext
parent364a2fe08e104b66c5d07a842d0c578ba9e17c72 (diff)
downloadgstreamer-plugins-bad-5dc39091f393a8cc596871015e6b2c3dd1d18004.tar.gz
wpe: Add support for web:// URIs
The CEF source already supports this. No good reason for wpesrc not too ;) Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2503>
Diffstat (limited to 'ext')
-rw-r--r--ext/wpe/gstwpesrcbin.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/ext/wpe/gstwpesrcbin.cpp b/ext/wpe/gstwpesrcbin.cpp
index 22150d26f..0d5e6d897 100644
--- a/ext/wpe/gstwpesrcbin.cpp
+++ b/ext/wpe/gstwpesrcbin.cpp
@@ -51,6 +51,8 @@
* gst-play-1.0 --videosink gtkglsink wpe://https://gstreamer.freedesktop.org
* ```
*
+ * The `web://` URI protocol is also supported, as an alias to `wpe://`. Since: 1.20
+ *
* ### Composite WPE with a video stream in a single OpenGL scene
*
* ```
@@ -132,6 +134,7 @@ struct _GstWpeSrc
GstElement *video_src;
GHashTable *audio_src_pads;
GstFlowCombiner *flow_combiner;
+ gchar *uri;
};
enum
@@ -374,7 +377,7 @@ gst_wpe_src_uri_get_type (GType)
static const gchar *const *
gst_wpe_src_get_protocols (GType)
{
- static const char *protocols[] = { "wpe", NULL };
+ static const char *protocols[] = { "wpe", "web", NULL };
return protocols;
}
@@ -382,14 +385,8 @@ static gchar *
gst_wpe_src_get_uri (GstURIHandler * handler)
{
GstWpeSrc *src = GST_WPE_SRC (handler);
- gchar *location;
- gchar *res;
-
- g_object_get (src->video_src, "location", &location, NULL);
- res = g_strdup_printf ("wpe://%s", location);
- g_free (location);
- return res;
+ return g_strdup (src->uri);
}
static gboolean
@@ -398,6 +395,10 @@ gst_wpe_src_set_uri (GstURIHandler * handler, const gchar * uri,
{
GstWpeSrc *src = GST_WPE_SRC (handler);
+ if (src->uri) {
+ g_free (src->uri);
+ }
+ src->uri = g_strdup (uri);
gst_wpe_src_set_location(src, uri + 6);
return TRUE;
}
@@ -476,15 +477,16 @@ gst_wpe_src_change_state (GstElement * element, GstStateChange transition)
}
static void
-gst_wpe_src_dispose (GObject *object)
+gst_wpe_src_finalize (GObject *object)
{
GstWpeSrc *src = GST_WPE_SRC (object);
g_hash_table_unref (src->audio_src_pads);
gst_flow_combiner_free (src->flow_combiner);
gst_object_unref (src->fd_allocator);
+ g_free (src->uri);
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+ GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
static void
@@ -495,7 +497,7 @@ gst_wpe_src_class_init (GstWpeSrcClass * klass)
gobject_class->set_property = gst_wpe_src_set_property;
gobject_class->get_property = gst_wpe_src_get_property;
- gobject_class->dispose = gst_wpe_src_dispose;
+ gobject_class->finalize = gst_wpe_src_finalize;
g_object_class_install_property (gobject_class, PROP_LOCATION,
g_param_spec_string ("location", "location", "The URL to display", "",