From e5b57db7a20954a8834e971826f7023ba374b5c6 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 3 Nov 2014 11:59:32 +0100 Subject: [PATCH] ges: Add a method to pass argc/argv to GES at init time Allowing user to set configuration actions without using the GES GOptionGroup https://bugzilla.gnome.org/show_bug.cgi?id=740717 --- ges/ges.c | 42 ++++++++++++++++++++++++++++++++++++++++++ ges/ges.h | 1 + 2 files changed, 43 insertions(+) diff --git a/ges/ges.c b/ges/ges.c index adc1e03669..55a426b746 100644 --- 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 (); +} diff --git a/ges/ges.h b/ges/ges.h index f74fbb5e49..e346f144df 100644 --- 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 *