Commit 29f25c6c authored by Thibault Saunier's avatar Thibault Saunier 🌵 Committed by Thibault Saunier
Browse files

launch: Add an option to embed nested timelines when saving

parent 6c3528fb
......@@ -312,12 +312,22 @@ static gboolean
_ges_command_line_formatter_add_clip (GESTimeline * timeline,
GstStructure * structure, GError ** error)
{
GESProject *proj;
GESAsset *asset;
if (!_cleanup_fields (options[CLIP].properties, structure, error))
return FALSE;
gst_structure_set (structure, "type", G_TYPE_STRING, "GESUriClip", NULL);
return _ges_add_clip_from_struct (timeline, structure, error);
if (!_ges_add_clip_from_struct (timeline, structure, error))
return FALSE;
proj = GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE (timeline)));
asset = _ges_get_asset_from_timeline (timeline, GES_TYPE_URI_CLIP,
gst_structure_get_string (structure, "asset-id"), NULL);
ges_project_add_asset (proj, asset);
return TRUE;
}
static gboolean
......
......@@ -428,6 +428,7 @@ _ges_add_clip_from_struct (GESTimeline * timeline, GstStructure * structure,
asset_id = g_strdup (check_asset_id);
}
gst_structure_set (structure, "asset-id", G_TYPE_STRING, asset_id, NULL);
asset = _ges_get_asset_from_timeline (timeline, type, asset_id, error);
if (!asset) {
res = FALSE;
......@@ -585,7 +586,7 @@ _ges_container_add_child_from_struct (GESTimeline * timeline,
}
if (!child) {
g_error_new (GES_ERROR, 0, "Wong parametters, could not get a child");
g_error_new (GES_ERROR, 0, "Wrong parameters, could not get a child");
return FALSE;
}
......
......@@ -53,6 +53,7 @@ typedef struct
gchar *sanitized_timeline;
const gchar *video_track_caps;
const gchar *audio_track_caps;
gboolean embed_nesteds;
} ParsedOptions;
struct _GESLauncherPrivate
......@@ -397,7 +398,7 @@ intr_handler (GESLauncher * self)
g_print ("interrupt received.\n");
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (self->priv->pipeline),
GST_DEBUG_GRAPH_SHOW_ALL, "ges-launch.interupted");
GST_DEBUG_GRAPH_SHOW_ALL, "ges-launch.interrupted");
g_application_quit (G_APPLICATION (self));
......@@ -411,6 +412,29 @@ _save_timeline (GESLauncher * self)
{
ParsedOptions *opts = &self->priv->parsed_options;
if (opts->embed_nesteds) {
GList *tmp, *assets;
GESProject *proj =
GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE (self->
priv->timeline)));
assets = ges_project_list_assets (proj, GES_TYPE_URI_CLIP);
for (tmp = assets; tmp; tmp = tmp->next) {
gboolean is_nested;
g_object_get (tmp->data, "is-nested-timeline", &is_nested, NULL);
if (is_nested) {
GESAsset *subproj =
ges_asset_request (GES_TYPE_TIMELINE, ges_asset_get_id (tmp->data),
NULL);
ges_project_add_asset (proj, subproj);
}
}
g_list_free_full (assets, gst_object_unref);
}
if (opts->save_only_path) {
gchar *uri;
......@@ -750,6 +774,8 @@ _local_command_line (GApplication * application, gchar ** arguments[],
"and --inspect-action-type.",
"<scenario_name>"},
#endif
{"embed-nesteds", 0, 0, G_OPTION_ARG_NONE, &opts->embed_nesteds,
"Embed nested timelines when saving.",},
{NULL}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment