ges: Add a method to pass argc/argv to GES at init time
authorThibault Saunier <tsaunier@gnome.org>
Mon, 3 Nov 2014 10:59:32 +0000 (11:59 +0100)
committerThibault Saunier <tsaunier@gnome.org>
Sat, 6 Dec 2014 09:34:15 +0000 (10:34 +0100)
Allowing user to set configuration actions without using
the GES GOptionGroup

https://bugzilla.gnome.org/show_bug.cgi?id=740717

ges/ges.c
ges/ges.h

index adc1e03..55a426b 100644 (file)
--- a/ges/ges.c
+++ b/ges/ges.c
@@ -204,3 +204,45 @@ ges_version (guint * major, guint * minor, guint * micro, guint * nano)
   *micro = GES_VERSION_MICRO;
   *nano = GES_VERSION_NANO;
 }
+
+/**
+ * ges_init_check:
+ * @argc: (inout) (allow-none): pointer to application's argc
+ * @argv: (inout) (array length=argc) (allow-none): pointer to application's argv
+ * @err: pointer to a #GError to which a message will be posted on error
+ *
+ * Initializes the GStreamer Editing Services library, setting up internal path lists,
+ * and loading evrything needed.
+ *
+ * This function will return %FALSE if GES could not be initialized
+ * for some reason.
+ *
+ * Returns: %TRUE if GES could be initialized.
+ */
+gboolean
+ges_init_check (int *argc, char **argv[], GError ** err)
+{
+#ifndef GST_DISABLE_OPTION_PARSING
+  GOptionGroup *group;
+  GOptionContext *ctx;
+#endif
+  gboolean res;
+
+  if (ges_initialized) {
+    GST_DEBUG ("already initialized ges");
+    return TRUE;
+  }
+#ifndef GST_DISABLE_OPTION_PARSING
+  ctx = g_option_context_new ("- GStreamer Editing Services initialization");
+  g_option_context_set_ignore_unknown_options (ctx, TRUE);
+  g_option_context_set_help_enabled (ctx, FALSE);
+  group = ges_init_get_option_group ();
+  g_option_context_add_group (ctx, group);
+  res = g_option_context_parse (ctx, argc, argv, err);
+  g_option_context_free (ctx);
+#endif
+  if (!res)
+    return res;
+
+  return ges_init ();
+}
index f74fbb5..e346f14 100644 (file)
--- a/ges/ges.h
+++ b/ges/ges.h
@@ -85,6 +85,7 @@ G_BEGIN_DECLS
 
 
 gboolean ges_init         (void);
+gboolean ges_init_check (int *argc, char **argv[], GError ** err);
 void     ges_version      (guint * major, guint * minor, guint * micro,
                            guint * nano);
 GOptionGroup *