[aravis/aravis-0-2] viewer: check for gstreamer plugins at application launch.



commit f0b7de38fb48db96ab4be156a6c4b2f671acff1f
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun Nov 3 10:02:29 2013 +0100

    viewer: check for gstreamer plugins at application launch.

 viewer/arvviewer.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/viewer/arvviewer.c b/viewer/arvviewer.c
index 636504b..92225da 100644
--- a/viewer/arvviewer.c
+++ b/viewer/arvviewer.c
@@ -817,6 +817,42 @@ static const GOptionEntry arv_viewer_option_entries[] =
        { NULL }
 };
 
+static gboolean
+_gstreamer_plugin_check (void)
+{
+       GstRegistry *registry;
+       unsigned int i;
+       gboolean success = TRUE;
+
+       static char *plugins[] = {
+               "appsrc",
+               "ffmpegcolorspace",
+               "videoflip",
+               "autovideosink",
+               "bayer2rgb"
+       };
+
+       registry = gst_registry_get_default ();
+
+       for (i = 0; i < G_N_ELEMENTS (plugins); i++) {
+               GstPluginFeature *feature;
+       
+               feature = gst_registry_lookup_feature (registry, plugins[i]);
+               if (!GST_IS_PLUGIN_FEATURE (feature)) {
+                       g_print ("Gstreamer plugin '%s' is missing.\n", plugins[i]);
+                       success = FALSE;
+               }
+               else
+
+               g_object_unref (feature);
+       }
+
+       if (!success)
+               g_print ("Check your gstreamer installation.\n");
+
+       return success;
+}
+
 int
 main (int argc,char *argv[])
 {
@@ -846,6 +882,12 @@ main (int argc,char *argv[])
        gtk_init (&argc, &argv);
        gst_init (&argc, &argv);
 
+       if (!_gstreamer_plugin_check ()) {
+               arv_shutdown ();
+
+               return EXIT_FAILURE;
+       }
+
        arv_debug_enable (arv_viewer_option_debug_domains);
 
        arv_enable_interface ("Fake");


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