[totem/wip/hadess/properties-vaapi-crash-fix: 8/10] gst: Add function to disable certain video decoders



commit 725b9e9a265473232e1e9392e9c053e30b1a5a83
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 10 13:34:18 2019 +0100

    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.

 src/gst/totem-gst-helpers.c | 28 ++++++++++++++++++++++++++++
 src/gst/totem-gst-helpers.h |  2 ++
 2 files changed, 30 insertions(+)
---
diff --git a/src/gst/totem-gst-helpers.c b/src/gst/totem-gst-helpers.c
index 62dde28a..1c7f05fa 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 85689e78..3b5bc1a4 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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]