<TITLE>Initialization</TITLE>
ges_init
ges_init_check
+ges_deinit
ges_version
ges_init_get_option_group
GES_VERSION_MAJOR
static GHashTable *parent_newparent_table = NULL;
+static GstDiscoverer *discoverer = NULL;
+static GstDiscoverer *sync_discoverer = NULL;
+
static void
initable_iface_init (GInitableIface * initable_iface)
{
if (errno)
timeout = DEFAULT_DISCOVERY_TIMEOUT;
- klass->discoverer = gst_discoverer_new (timeout, &err);
+ if (!discoverer) {
+ discoverer = gst_discoverer_new (timeout, &err);
+ if (!discoverer) {
+ GST_ERROR ("Could not create discoverer: %s", err->message);
+ g_error_free (err);
+ return;
+ }
+ }
+
+ /* The class structure keeps weak pointers on the discoverers so they
+ * can be properly cleaned up in _ges_uri_asset_cleanup(). */
if (!klass->discoverer) {
- GST_ERROR ("Could not create discoverer: %s", err->message);
- g_error_free (err);
- return;
+ klass->discoverer = discoverer;
+ g_object_add_weak_pointer (G_OBJECT (discoverer),
+ (gpointer *) & klass->discoverer);
+ }
+
+ if (!sync_discoverer) {
+ sync_discoverer = gst_discoverer_new (timeout, &err);
+
+ if (!sync_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;
+ klass->sync_discoverer = sync_discoverer;
+ g_object_add_weak_pointer (G_OBJECT (sync_discoverer),
+ (gpointer *) & klass->sync_discoverer);
}
g_signal_connect (klass->discoverer, "discovered",
return asset->priv->parent_asset;
}
+
+void
+_ges_uri_asset_cleanup (void)
+{
+ g_clear_object (&discoverer);
+ g_clear_object (&sync_discoverer);
+}
const gchar * ges_uri_source_asset_get_stream_uri (GESUriSourceAsset *asset);
const GESUriClipAsset *ges_uri_source_asset_get_filesource_asset (GESUriSourceAsset *asset);
+void _ges_uri_asset_cleanup (void);
+
G_END_DECLS
#endif /* _GES_URI_CLIP_ASSET */
return ges_init_post (NULL, NULL, NULL, NULL);
}
+/**
+ * ges_deinit:
+ *
+ * Clean up any resources created by GES in ges_init().
+ *
+ * It is normally not needed to call this function in a normal application as the
+ * resources will automatically be freed when the program terminates.
+ * This function is therefore mostly used by testsuites and other memory profiling tools.
+ *
+ * After this call GES (including this method) should not be used anymore.
+ */
+void
+ges_deinit (void)
+{
+ _ges_uri_asset_cleanup ();
+}
+
#ifndef GST_DISABLE_OPTION_PARSING
static gboolean
parse_goption_arg (const gchar * s_opt,
gboolean ges_init (void);
gboolean ges_init_check (int *argc, char **argv[], GError ** err);
+void ges_deinit (void);
void ges_version (guint * major, guint * minor, guint * micro,
guint * nano);
GOptionGroup *
Suite *s = suite_create ("ges");
TCase *tc_chain = tcase_create ("a");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
ges_init ();
Suite *s = suite_create ("ges-backgroundsource");
TCase *tc_chain = tcase_create ("backgroundsource");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_test_source_basic);
Suite *s = suite_create ("ges-basic");
TCase *tc_chain = tcase_create ("basic");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_ges_init);
Suite *s = suite_create ("ges-clip");
TCase *tc_chain = tcase_create ("clip");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_object_properties);
Suite *s = suite_create ("ges");
TCase *tc_chain = tcase_create ("effect");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_effect_basic);
Suite *s = suite_create ("ges-group");
TCase *tc_chain = tcase_create ("group");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_move_group);
Suite *s = suite_create ("ges-layer");
TCase *tc_chain = tcase_create ("timeline-layer");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_layer_properties);
Suite *s = suite_create ("Smart mixers");
TCase *tc_chain = tcase_create ("smart-mixers");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
ges_init ();
suite_add_tcase (s, tc_chain);
Suite *s = suite_create ("ges-overlays");
TCase *tc_chain = tcase_create ("overlays");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_overlay_basic);
Suite *s = suite_create ("ges-project");
TCase *tc_chain = tcase_create ("project");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
ges_init ();
GstPluginFeature *pitch = gst_registry_find_feature (gst_registry_get (),
"pitch", GST_TYPE_ELEMENT_FACTORY);
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
if (pitch) {
gst_object_unref (pitch);
Suite *s = suite_create ("ges-timeline-edition");
TCase *tc_chain = tcase_create ("timeline-edition");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
ges_init ();
suite_add_tcase (s, tc_chain);
Suite *s = suite_create ("ges-titles");
TCase *tc_chain = tcase_create ("titles");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_title_source_basic);
Suite *s = suite_create ("ges-track");
TCase *tc_chain = tcase_create ("track");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_update_restriction_caps);
Suite *s = suite_create ("ges-transition");
TCase *tc_chain = tcase_create ("transition");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_transition_basic);
gst_check_init (&argc, &argv);
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
s = ges_suite ();
av_uri = ges_test_get_audio_video_uri ();
Suite *s = suite_create ("gnonlin-complex");
TCase *tc_chain = tcase_create ("complex");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
ges_init ();
suite_add_tcase (s, tc_chain);
Suite *s = suite_create ("nlecomposition");
TCase *tc_chain = tcase_create ("nlecomposition");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
ges_init ();
suite_add_tcase (s, tc_chain);
Suite *s = suite_create ("nleoperation");
TCase *tc_chain = tcase_create ("nleoperation");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
ges_init ();
suite_add_tcase (s, tc_chain);
Suite *s = suite_create ("gnonlin-simple");
TCase *tc_chain = tcase_create ("general");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
suite_add_tcase (s, tc_chain);
ges_init ();
Suite *s = suite_create ("nle");
TCase *tc_chain = tcase_create ("tempochange");
+ if (atexit (ges_deinit) != 0) {
+ GST_ERROR ("failed to set ges_deinit as exit function");
+ }
+
ges_init ();
suite_add_tcase (s, tc_chain);