summaryrefslogtreecommitdiff
path: root/src/gst
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2019-01-10 13:34:18 +0100
committerBastien Nocera <hadess@hadess.net>2019-01-14 16:01:53 +0000
commit725b9e9a265473232e1e9392e9c053e30b1a5a83 (patch)
tree6fedb7e076f8b35696ab29fe782d402502af276a /src/gst
parent717c3253bc3605204bcef269ba7915ad3f073ac3 (diff)
downloadtotem-725b9e9a265473232e1e9392e9c053e30b1a5a83.tar.gz
gst: Add function to disable certain video decoders
A number of hardware accelerated video decoders won't work for non-GUI uses as they might require a display to work, such as VA-API, Broadcom's MPEG decoder, etc. This function is code that was already in the thumbnailer code, so we can also apply it to the properties code.
Diffstat (limited to 'src/gst')
-rw-r--r--src/gst/totem-gst-helpers.c28
-rw-r--r--src/gst/totem-gst-helpers.h2
2 files changed, 30 insertions, 0 deletions
diff --git a/src/gst/totem-gst-helpers.c b/src/gst/totem-gst-helpers.c
index 62dde28ad..1c7f05fab 100644
--- a/src/gst/totem-gst-helpers.c
+++ b/src/gst/totem-gst-helpers.c
@@ -72,6 +72,34 @@ totem_gst_message_print (GstMessage *msg,
g_free (dbg);
}
+/* Disable decoders that require a display environment to work,
+ * and that might cause crashes */
+void
+totem_gst_disable_display_decoders (void)
+{
+ GstRegistry *registry;
+ const char *blacklisted_plugins[] = {
+ "bmcdec",
+ "vaapi",
+ "video4linux2"
+ };
+ guint i;
+
+ /* Disable the vaapi plugin as it will not work with the
+ * fakesink we use:
+ * See: https://bugzilla.gnome.org/show_bug.cgi?id=700186 and
+ * https://bugzilla.gnome.org/show_bug.cgi?id=749605 */
+ registry = gst_registry_get ();
+
+ for (i = 0; i < G_N_ELEMENTS (blacklisted_plugins); i++) {
+ GstPlugin *plugin =
+ gst_registry_find_plugin (registry,
+ blacklisted_plugins[i]);
+ if (plugin)
+ gst_registry_remove_plugin (registry, plugin);
+ }
+}
+
/*
* vim: sw=2 ts=8 cindent noai bs=2
*/
diff --git a/src/gst/totem-gst-helpers.h b/src/gst/totem-gst-helpers.h
index 85689e78f..3b5bc1a48 100644
--- a/src/gst/totem-gst-helpers.h
+++ b/src/gst/totem-gst-helpers.h
@@ -54,6 +54,8 @@ void totem_gst_message_print (GstMessage *msg,
GstElement *play,
const char *filename);
+void totem_gst_disable_display_decoders (void);
+
G_END_DECLS
#endif /* HAVE_TOTEM_GST_HELPERS_H */