mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
ges-launch: Make it so actions are executed directly when needed.
This commit is contained in:
parent
48f3315e9b
commit
171710f0c5
3 changed files with 21 additions and 15 deletions
|
@ -252,11 +252,12 @@ str_to_time (char *time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GESTimeline *
|
static GESTimeline *
|
||||||
create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri)
|
create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri, const gchar *scenario)
|
||||||
{
|
{
|
||||||
GESLayer *layer = NULL;
|
GESLayer *layer = NULL;
|
||||||
GESTrack *tracka = NULL, *trackv = NULL;
|
GESTrack *tracka = NULL, *trackv = NULL;
|
||||||
GESTimeline *timeline;
|
GESTimeline *timeline;
|
||||||
|
gboolean activate_before_paused = TRUE;
|
||||||
guint i;
|
guint i;
|
||||||
GESProject *project = ges_project_new (proj_uri);
|
GESProject *project = ges_project_new (proj_uri);
|
||||||
|
|
||||||
|
@ -273,8 +274,10 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri)
|
||||||
|
|
||||||
timeline = GES_TIMELINE (ges_asset_extract (GES_ASSET (project), NULL));
|
timeline = GES_TIMELINE (ges_asset_extract (GES_ASSET (project), NULL));
|
||||||
|
|
||||||
if (proj_uri)
|
if (proj_uri) {
|
||||||
return timeline;
|
activate_before_paused = FALSE;
|
||||||
|
goto activate_validate;
|
||||||
|
}
|
||||||
|
|
||||||
if (track_types & GES_TRACK_TYPE_AUDIO) {
|
if (track_types & GES_TRACK_TYPE_AUDIO) {
|
||||||
tracka = GES_TRACK (ges_audio_track_new ());
|
tracka = GES_TRACK (ges_audio_track_new ());
|
||||||
|
@ -308,6 +311,7 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri)
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
/* We are only going to be doing one layer of clips */
|
/* We are only going to be doing one layer of clips */
|
||||||
layer = (GESLayer *) ges_layer_new ();
|
layer = (GESLayer *) ges_layer_new ();
|
||||||
|
activate_before_paused = FALSE;
|
||||||
|
|
||||||
/* Add the tracks and the layer to the timeline */
|
/* Add the tracks and the layer to the timeline */
|
||||||
if (!ges_timeline_add_layer (timeline, layer))
|
if (!ges_timeline_add_layer (timeline, layer))
|
||||||
|
@ -401,6 +405,11 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri)
|
||||||
ges_layer_add_clip (layer, clip);
|
ges_layer_add_clip (layer, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activate_validate:
|
||||||
|
if (ges_validate_activate (GST_PIPELINE (pipeline), scenario, activate_before_paused) == FALSE) {
|
||||||
|
g_error ("Could not activate scenario %s", scenario);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return timeline;
|
return timeline;
|
||||||
|
|
||||||
build_failure:
|
build_failure:
|
||||||
|
@ -412,10 +421,9 @@ build_failure:
|
||||||
|
|
||||||
static GESPipeline *
|
static GESPipeline *
|
||||||
create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
|
create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
|
||||||
int argc, char **argv)
|
int argc, char **argv, const gchar *scenario)
|
||||||
{
|
{
|
||||||
gchar *uri = NULL;
|
gchar *uri = NULL;
|
||||||
GESPipeline *pipeline = NULL;
|
|
||||||
GESTimeline *timeline = NULL;
|
GESTimeline *timeline = NULL;
|
||||||
|
|
||||||
/* Timeline creation */
|
/* Timeline creation */
|
||||||
|
@ -427,7 +435,10 @@ create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(timeline = create_timeline (argc, argv, uri)))
|
|
||||||
|
pipeline = ges_pipeline_new ();
|
||||||
|
|
||||||
|
if (!(timeline = create_timeline (argc, argv, uri, scenario)))
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
ges_timeline_commit (timeline);
|
ges_timeline_commit (timeline);
|
||||||
|
@ -449,7 +460,6 @@ create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
|
||||||
|
|
||||||
/* In order to view our timeline, let's grab a convenience pipeline to put
|
/* In order to view our timeline, let's grab a convenience pipeline to put
|
||||||
* our timeline in. */
|
* our timeline in. */
|
||||||
pipeline = ges_pipeline_new ();
|
|
||||||
|
|
||||||
if (mute) {
|
if (mute) {
|
||||||
GstElement *sink = gst_element_factory_make ("fakesink", NULL);
|
GstElement *sink = gst_element_factory_make ("fakesink", NULL);
|
||||||
|
@ -819,15 +829,10 @@ main (int argc, gchar ** argv)
|
||||||
g_option_context_free (ctx);
|
g_option_context_free (ctx);
|
||||||
|
|
||||||
/* Create the pipeline */
|
/* Create the pipeline */
|
||||||
pipeline = create_pipeline (&timeline, load_path, argc - 1, argv + 1);
|
create_pipeline (&timeline, load_path, argc - 1, argv + 1, scenario);
|
||||||
if (!pipeline)
|
if (!pipeline)
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
||||||
if (ges_validate_activate (GST_PIPELINE (pipeline), scenario) == FALSE) {
|
|
||||||
g_error ("Could not activate scenario %s", scenario);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup profile/encoding if needed */
|
/* Setup profile/encoding if needed */
|
||||||
if (smartrender || outputuri) {
|
if (smartrender || outputuri) {
|
||||||
GstEncodingProfile *prof = NULL;
|
GstEncodingProfile *prof = NULL;
|
||||||
|
|
|
@ -398,7 +398,7 @@ _edit_clip (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
ges_validate_activate (GstPipeline * pipeline, const gchar * scenario)
|
ges_validate_activate (GstPipeline * pipeline, const gchar * scenario, gboolean activate_before_paused)
|
||||||
{
|
{
|
||||||
GstValidateRunner *runner = NULL;
|
GstValidateRunner *runner = NULL;
|
||||||
GstValidateMonitor *monitor = NULL;
|
GstValidateMonitor *monitor = NULL;
|
||||||
|
@ -477,6 +477,7 @@ ges_validate_activate (GstPipeline * pipeline, const gchar * scenario)
|
||||||
gst_validate_monitor_factory_create (GST_OBJECT_CAST (pipeline), runner,
|
gst_validate_monitor_factory_create (GST_OBJECT_CAST (pipeline), runner,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
g_object_set (monitor, "stateless", activate_before_paused, NULL);
|
||||||
g_object_set_data (G_OBJECT (pipeline), MONITOR_ON_PIPELINE, monitor);
|
g_object_set_data (G_OBJECT (pipeline), MONITOR_ON_PIPELINE, monitor);
|
||||||
g_object_set_data (G_OBJECT (pipeline), RUNNER_ON_PIPELINE, runner);
|
g_object_set_data (G_OBJECT (pipeline), RUNNER_ON_PIPELINE, runner);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
ges_validate_activate (GstPipeline *pipeline, const gchar *scenario);
|
ges_validate_activate (GstPipeline *pipeline, const gchar *scenario, gboolean activate_before_paused);
|
||||||
|
|
||||||
gint
|
gint
|
||||||
ges_validate_clean (GstPipeline *pipeline);
|
ges_validate_clean (GstPipeline *pipeline);
|
||||||
|
|
Loading…
Reference in a new issue