Skip to content
Snippets Groups Projects
Commit 9bc06c75 authored by Thibault Saunier's avatar Thibault Saunier
Browse files

ges: Check if GstDiscoverer could be created at init time

And fail initialization if it is not the case, we make the assumption
it worked all around the codebase so we should really concider it fatal.
parent acfa0e90
No related branches found
No related tags found
Loading
......@@ -182,6 +182,7 @@ _asset_proxied (GESAsset * self, const gchar * new_uri)
static void
ges_uri_clip_asset_class_init (GESUriClipAssetClass * klass)
{
GError *err;
GstClockTime timeout;
const gchar *timeout_str;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
......@@ -216,8 +217,20 @@ ges_uri_clip_asset_class_init (GESUriClipAssetClass * klass)
if (errno)
timeout = 60 * GST_SECOND;
klass->discoverer = gst_discoverer_new (timeout, NULL);
klass->discoverer = gst_discoverer_new (timeout, &err);
if (!klass->discoverer) {
GST_ERROR ("Could not create discoverer: %s", err->message);
g_error_free (err);
return;
}
klass->sync_discoverer = gst_discoverer_new (timeout, NULL);
if (!klass->sync_discoverer) {
GST_ERROR ("Could not create discoverer: %s", err->message);
g_error_free (err);
return;
}
g_signal_connect (klass->discoverer, "discovered",
G_CALLBACK (discoverer_discovered_cb), NULL);
......
......@@ -60,11 +60,20 @@ static gboolean
ges_init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
GError ** error)
{
GESUriClipAssetClass *uriasset_klass = NULL;
if (ges_initialized) {
GST_DEBUG ("already initialized ges");
return TRUE;
}
uriasset_klass = g_type_class_ref (GES_TYPE_URI_CLIP_ASSET);
if (!uriasset_klass->discoverer)
goto failed;
if (!uriasset_klass->sync_discoverer)
goto failed;
/* register clip classes with the system */
GES_TYPE_TEST_CLIP;
......@@ -94,10 +103,19 @@ ges_init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
/* TODO: user-defined types? */
ges_initialized = TRUE;
g_type_class_unref (uriasset_klass);
GST_DEBUG ("GStreamer Editing Services initialized");
return TRUE;
failed:
if (uriasset_klass)
g_type_class_unref (uriasset_klass);
GST_ERROR ("Could not initialize GES.");
return FALSE;
}
/**
......@@ -112,9 +130,8 @@ gboolean
ges_init (void)
{
ges_init_pre (NULL, NULL, NULL, NULL);
ges_init_post (NULL, NULL, NULL, NULL);
return TRUE;
return ges_init_post (NULL, NULL, NULL, NULL);
}
#ifndef GST_DISABLE_OPTION_PARSING
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment