ges: Check that the gnonlin elements are present at initialization time

This avoids hanging with no obvious cause later when they're not.

https://bugzilla.gnome.org/show_bug.cgi?id=641246
This commit is contained in:
Vincent Penquerc'h 2011-02-07 12:19:18 +00:00 committed by Edward Hervey
parent 493059f01c
commit 857142a15d
3 changed files with 32 additions and 3 deletions

View file

@ -22,6 +22,10 @@
#include <gst/controller/gstcontroller.h>
#include "ges-internal.h"
#define GES_GNONLIN_VERSION_NEEDED_MAJOR 0
#define GES_GNONLIN_VERSION_NEEDED_MINOR 10
#define GES_GNONLIN_VERSION_NEEDED_MICRO 16
GST_DEBUG_CATEGORY (_ges_debug);
/**
@ -29,6 +33,22 @@ GST_DEBUG_CATEGORY (_ges_debug);
* @short_description: Initialization.
*/
static gboolean
ges_check_gnonlin_availability (void)
{
gboolean ret = TRUE;
if (!gst_default_registry_check_feature_version ("gnlcomposition",
GES_GNONLIN_VERSION_NEEDED_MAJOR, GES_GNONLIN_VERSION_NEEDED_MINOR,
GES_GNONLIN_VERSION_NEEDED_MICRO)) {
GST_ERROR
("GNonLin plugins not found, or not at least version %u.%u.%u",
GES_GNONLIN_VERSION_NEEDED_MAJOR,
GES_GNONLIN_VERSION_NEEDED_MINOR, GES_GNONLIN_VERSION_NEEDED_MICRO);
ret = FALSE;
}
return ret;
}
/**
* ges_init:
*
@ -36,7 +56,7 @@ GST_DEBUG_CATEGORY (_ges_debug);
* GES.
*/
void
gboolean
ges_init (void)
{
/* initialize debugging category */
@ -52,7 +72,13 @@ ges_init (void)
GES_TYPE_TIMELINE_STANDARD_TRANSITION;
GES_TYPE_TIMELINE_OVERLAY;
/* check the gnonlin elements are available */
if (!ges_check_gnonlin_availability ())
return FALSE;
/* TODO: user-defined types? */
GST_DEBUG ("GStreamer Editing Services initialized");
return TRUE;
}

View file

@ -63,7 +63,7 @@
G_BEGIN_DECLS
void ges_init (void);
gboolean ges_init (void);
G_END_DECLS

View file

@ -435,7 +435,10 @@ main (int argc, gchar ** argv)
}
/* Initialize the GStreamer Editing Services */
ges_init ();
if (!ges_init ()) {
g_printerr ("Error initializing GES\n");
exit (1);
}
if (list_transitions) {
print_transition_list ();