scenario: Add the notion of repeated actions

This commit is contained in:
Thibault Saunier 2013-09-28 00:15:13 +02:00
parent a89f32725b
commit c9ee576e8e
4 changed files with 33 additions and 8 deletions

View file

@ -8,6 +8,7 @@ scenarios_DATA = simple_seeks.scenario \
fast_backward.scenario \
alternate_fast_backward_forward.scenario \
pause_resume.scenario \
scrub_forward_seeking.scenario \
switch_audio_track.scenario
EXTRA_DIST = simple_seeks.scenario \
@ -19,4 +20,5 @@ EXTRA_DIST = simple_seeks.scenario \
fast_backward.scenario \
alternate_fast_backward_forward.scenario \
pause_resume.scenario \
scrub_forward_seeking.scenario \
switch_audio_track.scenario

View file

@ -0,0 +1,3 @@
pause, playback_time=0.0
seek, playback_time=0.0, start=position+0.1, repeat="duration/0.1-2", flags=accurate+flush
play, playback_time=0.0

View file

@ -210,9 +210,10 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action)
stop = dstop * GST_SECOND;
}
g_print ("%s (num %u), seeking to: %" GST_TIME_FORMAT " stop: %"
GST_TIME_FORMAT " Rate %lf\n", action->name,
action->action_number, GST_TIME_ARGS (start), GST_TIME_ARGS (stop), rate);
g_print ("%s (num %u, missing repeat: %i), seeking to: %" GST_TIME_FORMAT
" stop: %" GST_TIME_FORMAT " Rate %lf\n", action->name,
action->action_number, action->repeat, GST_TIME_ARGS (start),
GST_TIME_ARGS (stop), rate);
seek = gst_event_new_seek (rate, format, flags, start_type, start,
stop_type, stop);
@ -266,7 +267,6 @@ _execute_pause (GstValidateScenario * scenario, GstValidateAction * action)
return FALSE;
}
gst_element_get_state (priv->pipeline, NULL, NULL, -1);
if (duration)
g_timeout_add (duration * 1000,
(GSourceFunc) _pause_action_restore_playing, scenario);
@ -541,14 +541,32 @@ get_position (GstValidateScenario * scenario)
return TRUE;
type = g_hash_table_lookup (action_types_table, act->type);
if (act->repeat == -1 &&
!gst_structure_get_int (act->structure, "repeat", &act->repeat)) {
gchar *error = NULL;
const gchar *repeat_expr = gst_structure_get_string (act->structure,
"repeat");
if (repeat_expr) {
act->repeat = parse_expression (repeat_expr, _set_variable_func,
scenario, &error);
g_print ("REPEAT %i", act->repeat);
}
}
if (!type->execute (scenario, act))
GST_WARNING_OBJECT (scenario, "Could not execute %" GST_PTR_FORMAT,
act->structure);
tmp = priv->actions;
priv->actions = g_list_remove_link (priv->actions, tmp);
_free_scenario_action (act);
g_list_free (tmp);
if (act->repeat > 0) {
act->repeat--;
} else {
tmp = priv->actions;
priv->actions = g_list_remove_link (priv->actions, tmp);
_free_scenario_action (act);
g_list_free (tmp);
}
}
return TRUE;
@ -648,6 +666,7 @@ _load_scenario_file (GstValidateScenario * scenario,
action = g_slice_new0 (GstValidateAction);
action->type = type;
action->repeat = -1;
if (gst_structure_get_double (structure, "playback_time", &playback_time))
action->playback_time = playback_time * GST_SECOND;
else

View file

@ -48,6 +48,7 @@ struct _GstValidateAction
const gchar *type;
const gchar *name;
guint action_number;
gint repeat;
GstClockTime playback_time;
GstStructure *structure;
};