scenario: Add the notion of repeated actions
This commit is contained in:
parent
a89f32725b
commit
c9ee576e8e
@ -8,6 +8,7 @@ scenarios_DATA = simple_seeks.scenario \
|
|||||||
fast_backward.scenario \
|
fast_backward.scenario \
|
||||||
alternate_fast_backward_forward.scenario \
|
alternate_fast_backward_forward.scenario \
|
||||||
pause_resume.scenario \
|
pause_resume.scenario \
|
||||||
|
scrub_forward_seeking.scenario \
|
||||||
switch_audio_track.scenario
|
switch_audio_track.scenario
|
||||||
|
|
||||||
EXTRA_DIST = simple_seeks.scenario \
|
EXTRA_DIST = simple_seeks.scenario \
|
||||||
@ -19,4 +20,5 @@ EXTRA_DIST = simple_seeks.scenario \
|
|||||||
fast_backward.scenario \
|
fast_backward.scenario \
|
||||||
alternate_fast_backward_forward.scenario \
|
alternate_fast_backward_forward.scenario \
|
||||||
pause_resume.scenario \
|
pause_resume.scenario \
|
||||||
|
scrub_forward_seeking.scenario \
|
||||||
switch_audio_track.scenario
|
switch_audio_track.scenario
|
||||||
|
3
validate/data/scrub_forward_seeking.scenario
Normal file
3
validate/data/scrub_forward_seeking.scenario
Normal 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
|
@ -210,9 +210,10 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action)
|
|||||||
stop = dstop * GST_SECOND;
|
stop = dstop * GST_SECOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_print ("%s (num %u), seeking to: %" GST_TIME_FORMAT " stop: %"
|
g_print ("%s (num %u, missing repeat: %i), seeking to: %" GST_TIME_FORMAT
|
||||||
GST_TIME_FORMAT " Rate %lf\n", action->name,
|
" stop: %" GST_TIME_FORMAT " Rate %lf\n", action->name,
|
||||||
action->action_number, GST_TIME_ARGS (start), GST_TIME_ARGS (stop), rate);
|
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,
|
seek = gst_event_new_seek (rate, format, flags, start_type, start,
|
||||||
stop_type, stop);
|
stop_type, stop);
|
||||||
@ -266,7 +267,6 @@ _execute_pause (GstValidateScenario * scenario, GstValidateAction * action)
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
gst_element_get_state (priv->pipeline, NULL, NULL, -1);
|
|
||||||
if (duration)
|
if (duration)
|
||||||
g_timeout_add (duration * 1000,
|
g_timeout_add (duration * 1000,
|
||||||
(GSourceFunc) _pause_action_restore_playing, scenario);
|
(GSourceFunc) _pause_action_restore_playing, scenario);
|
||||||
@ -541,15 +541,33 @@ get_position (GstValidateScenario * scenario)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
type = g_hash_table_lookup (action_types_table, act->type);
|
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))
|
if (!type->execute (scenario, act))
|
||||||
GST_WARNING_OBJECT (scenario, "Could not execute %" GST_PTR_FORMAT,
|
GST_WARNING_OBJECT (scenario, "Could not execute %" GST_PTR_FORMAT,
|
||||||
act->structure);
|
act->structure);
|
||||||
|
|
||||||
|
if (act->repeat > 0) {
|
||||||
|
act->repeat--;
|
||||||
|
} else {
|
||||||
tmp = priv->actions;
|
tmp = priv->actions;
|
||||||
priv->actions = g_list_remove_link (priv->actions, tmp);
|
priv->actions = g_list_remove_link (priv->actions, tmp);
|
||||||
_free_scenario_action (act);
|
_free_scenario_action (act);
|
||||||
g_list_free (tmp);
|
g_list_free (tmp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -648,6 +666,7 @@ _load_scenario_file (GstValidateScenario * scenario,
|
|||||||
|
|
||||||
action = g_slice_new0 (GstValidateAction);
|
action = g_slice_new0 (GstValidateAction);
|
||||||
action->type = type;
|
action->type = type;
|
||||||
|
action->repeat = -1;
|
||||||
if (gst_structure_get_double (structure, "playback_time", &playback_time))
|
if (gst_structure_get_double (structure, "playback_time", &playback_time))
|
||||||
action->playback_time = playback_time * GST_SECOND;
|
action->playback_time = playback_time * GST_SECOND;
|
||||||
else
|
else
|
||||||
|
@ -48,6 +48,7 @@ struct _GstValidateAction
|
|||||||
const gchar *type;
|
const gchar *type;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
guint action_number;
|
guint action_number;
|
||||||
|
gint repeat;
|
||||||
GstClockTime playback_time;
|
GstClockTime playback_time;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user