ges: Keep backward compatibility for relocated assets CLI

Meaning adding an API for user to add relacation URI paths

API:
    ges_add_missing_uri_relocation_uri
This commit is contained in:
Thibault Saunier 2014-11-03 12:18:35 +01:00
parent 1373937b8e
commit 3b353be8ea
6 changed files with 39 additions and 22 deletions

View file

@ -183,11 +183,6 @@ G_GNUC_INTERNAL gchar * ges_project_try_updating_id (GESProject *s
G_GNUC_INTERNAL void ges_project_add_loading_asset (GESProject *project,
GType extractable_type,
const gchar *id);
G_GNUC_INTERNAL gboolean ges_add_missing_uri_relocation_path (const gchar * option_name,
const gchar * value,
gpointer udata,
GError ** error);
/************************************************
* *
* GESBaseXmlFormatter internal methods *

View file

@ -287,24 +287,18 @@ done:
gst_object_unref (fenum);
}
gboolean
ges_add_missing_uri_relocation_path (const gchar * option_name,
const gchar * value, gpointer udata, GError ** error)
ges_add_missing_uri_relocation_uri (const gchar * uri, gboolean recurse)
{
g_return_val_if_fail (gst_uri_is_valid (value), FALSE);
g_return_val_if_fail (gst_uri_is_valid (uri), FALSE);
if (new_paths == NULL)
new_paths = g_ptr_array_new_with_free_func (g_free);
g_print ("\n\nOption name %s\n\n", option_name);
if (g_strcmp0 (option_name, "--sample-path-recurse") == 0 ||
g_strcmp0 (option_name, "-R") == 0) {
_add_media_new_paths_recursing (value);
} else {
GST_INFO ("Adding folder: %s", value);
g_ptr_array_add (new_paths, g_strdup (value));
}
if (recurse)
_add_media_new_paths_recursing (uri);
else
g_ptr_array_add (new_paths, g_strdup (uri));
return TRUE;
}

View file

@ -105,6 +105,8 @@ GList * ges_project_get_loading_assets (GESProject * project);
gboolean ges_project_add_encoding_profile (GESProject *project,
GstEncodingProfile *profile);
const GList *ges_project_list_encoding_profiles (GESProject *project);
gboolean ges_add_missing_uri_relocation_uri (const gchar * uri,
gboolean recurse);
G_END_DECLS

View file

@ -114,7 +114,7 @@ struct _GESUriSourceAssetClass
};
GstDiscovererStreamInfo * ges_uri_source_asset_get_stream_info (GESUriSourceAsset *asset);
const gchar * ges_uri_source_asset_get_stream_uri (GESUriSourceAsset *asset);
const GESUriClipAsset *ges_uri_source_asset_get_filesource_asset (GESUriSourceAsset *asset);
const GESUriClipAsset *ges_uri_source_asset_get_filesource_asset (GESUriSourceAsset *asset);
G_END_DECLS
#endif /* _GES_URI_CLIP_ASSET */

View file

@ -129,6 +129,10 @@ parse_goption_arg (const gchar * s_opt,
if (g_strcmp0 (s_opt, "--ges-version") == 0) {
g_print ("GStreamer Editing Services version %s\n", PACKAGE_VERSION);
exit (0);
} else if (g_strcmp0 (s_opt, "--ges-sample-paths") == 0) {
ges_add_missing_uri_relocation_uri (arg, FALSE);
} else if (g_strcmp0 (s_opt, "--ges-sample-path-recurse") == 0) {
ges_add_missing_uri_relocation_uri (arg, TRUE);
}
return TRUE;
@ -162,11 +166,11 @@ ges_init_get_option_group (void)
(gpointer) parse_goption_arg,
"Print the GStreamer Editing Services version",
NULL},
{"sample-paths", 'P', 0, G_OPTION_ARG_CALLBACK,
&ges_add_missing_uri_relocation_path,
{"ges-sample-paths", 0, 0, G_OPTION_ARG_CALLBACK,
(gpointer) parse_goption_arg,
"List of pathes to look assets in if they were moved"},
{"sample-path-recurse", 'R', 0, G_OPTION_ARG_CALLBACK,
&ges_add_missing_uri_relocation_path,
{"ges-sample-path-recurse", 0, 0, G_OPTION_ARG_CALLBACK,
(gpointer) parse_goption_arg,
"Same as above, but recursing into the folder"},
{NULL}
};

View file

@ -682,6 +682,23 @@ _parse_encoding_profile (const gchar * format)
return encoding_profile;
}
static gboolean
_add_media_path (const gchar * option_name, const gchar * value,
gpointer udata, GError ** error)
{
g_return_val_if_fail (gst_uri_is_valid (value), FALSE);
if (g_strcmp0 (option_name, "--sample-path-recurse") == 0 ||
g_strcmp0 (option_name, "-R") == 0) {
ges_add_missing_uri_relocation_uri (value, TRUE);
} else {
GST_INFO ("Adding folder: %s", value);
ges_add_missing_uri_relocation_uri (value, FALSE);
}
return TRUE;
}
int
main (int argc, gchar ** argv)
{
@ -736,6 +753,11 @@ main (int argc, gchar ** argv)
"The video sink used for playing back", "<videosink>"},
{"audiosink", 'a', 0, G_OPTION_ARG_STRING, &audiosink,
"The audio sink used for playing back", "<audiosink>"},
{"sample-paths", 'P', 0, G_OPTION_ARG_CALLBACK, &_add_media_path,
"List of pathes to look assets in if they were moved"},
{"sample-path-recurse", 'R', 0, G_OPTION_ARG_CALLBACK,
&_add_media_path,
"Same as above, but recursing into the folder"},
#ifdef HAVE_GST_VALIDATE
{"inspect-action-type", 'y', 0, G_OPTION_ARG_NONE, &inspect_action_type,
"Inspect the avalaible action types with which to write scenarios"