[Spice-devel] [PATCH spice-gtk 2/2] Let user rank gstreamer element
Snir Sheriber
ssheribe at redhat.com
Sun Dec 31 15:46:25 UTC 2017
User can now rank a gstreamer element with high rank
by setting SPICE_GST_RANK_HIGH to the element's name.
This can be used to prioritize specific decoder to
be chosen by playbin.
---
src/channel-display-gst.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index af87fb5..fe3918d 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -340,6 +340,27 @@ static void app_source_setup(GstElement *pipeline G_GNUC_UNUSED,
gst_caps_unref(caps);
decoder->appsrc = GST_APP_SRC(gst_object_ref(source));
}
+
+static void gst_factory_rank_high(void) {
+ GstRegistry *registry = NULL;
+ GstElementFactory *factory = NULL;
+ const gchar *name = NULL;
+
+
+ registry = gst_registry_get ();
+ if (!registry) return;
+
+ name = g_getenv("SPICE_GST_RANK_HIGH");
+ if (!name) return;
+
+ factory = gst_element_factory_find (name);
+ if (!factory) return;
+
+ gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_PRIMARY + 1);
+
+ gst_registry_add_feature (registry, GST_PLUGIN_FEATURE (factory));
+ return;
+}
#endif
static gboolean create_pipeline(SpiceGstDecoder *decoder)
@@ -358,6 +379,8 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
return FALSE;
}
+ gst_factory_rank_high();
+
convert = gst_element_factory_make("autovideoconvert", "autovideoconvert");
download = gst_element_factory_make("gldownload", "gldownload");
appsink = gst_element_factory_make("appsink", "appsink");
--
2.9.5
More information about the Spice-devel
mailing list