From: Thibault Saunier Date: Tue, 15 Nov 2016 18:09:10 +0000 (-0300) Subject: ges: Check if GstDiscoverer could be created at init time X-Git-Tag: 1.19.3~493^2~901 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9bc06c755ad9e640dc6d01b2a547cb8e803391f5;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/ges/ges-uri-asset.c b/ges/ges-uri-asset.c index cc70ab1..e8de919 100644 --- a/ges/ges-uri-asset.c +++ b/ges/ges-uri-asset.c @@ -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); diff --git a/ges/ges.c b/ges/ges.c index 6127b69..836ade3 100644 --- a/ges/ges.c +++ b/ges/ges.c @@ -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