mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
validate:scenario: Enforce a synthax $(varname) to reference variables
This way it is clear that you are using a variable reading the scenario and we can verify that what the scenario writer intents is to use an already set variable.
This commit is contained in:
parent
3ebc26e265
commit
d24477d9e4
18 changed files with 69 additions and 58 deletions
|
@ -1,14 +1,14 @@
|
|||
description, duration=55.0, min-media-duration=470.0, seek=true, reverse-playback=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, name=backward-seek, playback-time=0.0, rate=-1.0, start=0.0, stop=310.0, flags=default_flags
|
||||
seek, name=forward-seek, playback-time=305.0, rate=1.0, start=305.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=2.0, start=310.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=320.0, rate=-2.0, start=0.0, stop=320.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=4.0, start=310.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=330.0, rate=-4.0, start=0.0, stop=330.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=8.0, start=310.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=350.0, rate=-8.0, start=0.0, stop=350.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=16.0, start=310.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=390.0, rate=-16.0, start=0.0, stop=390.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=32.0, start=310.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=470.0, rate=-32.0, start=310.0, stop=470.0, flags=default_flags
|
||||
seek, name=backward-seek, playback-time=0.0, rate=-1.0, start=0.0, stop=310.0, flags="$(default-flags)"
|
||||
seek, name=forward-seek, playback-time=305.0, rate=1.0, start=305.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=2.0, start=310.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=320.0, rate=-2.0, start=0.0, stop=320.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=4.0, start=310.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=330.0, rate=-4.0, start=0.0, stop=330.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=8.0, start=310.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=350.0, rate=-8.0, start=0.0, stop=350.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=16.0, start=310.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=390.0, rate=-16.0, start=0.0, stop=390.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time=310.0, rate=32.0, start=310.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=470.0, rate=-32.0, start=310.0, stop=470.0, flags="$(default-flags)"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
description, duration=30.0, minfo-media-duration=310.0, seek=true, reverse-playback=true, need-clock-sync=true, min-media-duration=310.0
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, name=Fast-backward-seek, playback-time=0.0, rate=-2.0, start=0.0, stop=310.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=300.0, rate=-4.0, start=0.0, stop=300.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=280.0, rate=-8.0, start=0.0, stop=280.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=240.0, rate=-16.0, start=0.0, stop=240.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=160.0, rate=-32.0, start=0.0, stop=160.0, flags=default_flags
|
||||
seek, name=Fast-backward-seek, playback-time=0.0, rate=-2.0, start=0.0, stop=310.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=300.0, rate=-4.0, start=0.0, stop=300.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=280.0, rate=-8.0, start=0.0, stop=280.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=240.0, rate=-16.0, start=0.0, stop=240.0, flags="$(default-flags)"
|
||||
seek, name=Fast-backward-seek, playback-time=160.0, rate=-32.0, start=0.0, stop=160.0, flags="$(default-flags)"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
description, duration=25.0, seek=true, need-clock-sync=true, min-media-duration=5.0
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, name=Fast-forward-seek, playback-time=0.0, rate=2.0, start=0.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time="min(10.0, duration*0.0625)", rate=4.0, start=0.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time="min(20.0, duration*0.125)", rate=8.0, start=0.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time="min(40.0, duration*0.25)", rate=16.0, start=0.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time="min(80.0, duration*0.50)", rate=32.0, start=0.0, flags=default_flags
|
||||
seek, name=Fast-forward-seek, playback-time=0.0, rate=2.0, start=0.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time="min(10.0, duration*0.0625)", rate=4.0, start=0.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time="min(20.0, duration*0.125)", rate=8.0, start=0.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time="min(40.0, duration*0.25)", rate=16.0, start=0.0, flags="$(default-flags)"
|
||||
seek, name=Fast-forward-seek, playback-time="min(80.0, duration*0.50)", rate=32.0, start=0.0, flags="$(default-flags)"
|
||||
stop, playback-time="min(duration - 0.3, 160.0)"
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
set-vars,\
|
||||
default_flags=accurate+flush
|
||||
default-flags=accurate+flush
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
description, seek=true, reverse-playback=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, name=Reverse-seek, playback-time=0.0, rate=-1.0, start="max(duration - 15.0, 0.0)", stop=duration, flags=default_flags
|
||||
seek, name=Reverse-seek, playback-time=0.0, rate=-1.0, start="max(duration - 15.0, 0.0)", stop=duration, flags="$(default-flags)"
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
set-vars,\
|
||||
default_flags=flush
|
||||
default-flags=flush
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
description, seek=true, handles-states=true, needs_preroll=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
pause, playback-time=0.0
|
||||
seek, playback-time=0.0, start="duration - 0.5", flags=default_flags
|
||||
seek, playback-time=0.0, start=position-0.1, repeat="min(10, (duration - 0.6))/0.1", flags=default_flags
|
||||
seek, playback-time=0.0, start="duration - 0.5", flags="$(default-flags)"
|
||||
seek, playback-time=0.0, start=position-0.1, repeat="min(10, (duration - 0.6))/0.1", flags="$(default-flags)"
|
||||
play, playback-time=0.0
|
||||
stop, playback-time=1.0
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
description, seek=true, handles-states=true, needs_preroll=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
pause, playback-time=0.0
|
||||
seek, playback-time=0.0, start="duration - 0.5", flags=default_flags
|
||||
seek, playback-time=0.0, start=position-0.1, repeat="(duration - 0.6)/0.1", flags=default_flags
|
||||
seek, playback-time=0.0, start="duration - 0.5", flags="$(default-flags)"
|
||||
seek, playback-time=0.0, start=position-0.1, repeat="(duration - 0.6)/0.1", flags="$(default-flags)"
|
||||
play, playback-time=0.0
|
||||
stop, playback-time=1.0
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
description, seek=true, handles-states=true, needs_preroll=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
pause, playback-time=0.0
|
||||
seek, playback-time=0.0, start=position+0.1, repeat="min(10, (duration - 0.5))/0.1", flags=default_flags
|
||||
seek, playback-time=0.0, start=position+0.1, repeat="min(10, (duration - 0.5))/0.1", flags="$(default-flags)"
|
||||
play, playback-time=0.0
|
||||
stop, playback-time=1.0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
description, seek=true, handles-states=true, needs_preroll=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
pause, playback-time=0.0
|
||||
seek, playback-time=0.0, start=position+0.1, repeat="(duration - 0.5)/0.1", flags=default_flags
|
||||
seek, playback-time=0.0, start=position+0.1, repeat="(duration - 0.5)/0.1", flags="$(default-flags)"
|
||||
play, playback-time=0.0
|
||||
stop, playback-time=1.0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
description, seek=true, duration=30, need-clock-sync=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, name=Backward-seek, playback-time="min(5.0, (duration/4))", rate=1.0, start=0.0, flags=default_flags
|
||||
seek, name=Backward-seek, playback-time="min(10.0, 2*(duration/4))", rate=1.0, start="min(5.0, duration/4)", flags=default_flags
|
||||
seek, name=Backward-seek, playback-time="min(15.0, 3*(duration/4))", rate=1.0, start="min(10.0, 2*(duration/4))", flags=default_flags
|
||||
seek, name=Backward-seek, playback-time="min(5.0, (duration/4))", rate=1.0, start=0.0, flags="$(default-flags)"
|
||||
seek, name=Backward-seek, playback-time="min(10.0, 2*(duration/4))", rate=1.0, start="min(5.0, duration/4)", flags="$(default-flags)"
|
||||
seek, name=Backward-seek, playback-time="min(15.0, 3*(duration/4))", rate=1.0, start="min(10.0, 2*(duration/4))", flags="$(default-flags)"
|
||||
stop, playback-time="min(15.0, 3*(duration/4))"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
description, seek=true, duration=20, need-clock-sync=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, name=First-forward-seek, playback-time="min(5.0, (duration/8))", start="min(10, 2*(duration/8))", flags=default_flags
|
||||
seek, name=Second-forward-seek, playback-time="min(15.0, 3*(duration/8))", start="min(20, 4*(duration/8))", flags=default_flags
|
||||
seek, name=Third-forward-seek, playback-time="min(25, 5*(duration/8))", start="min(30.0, 6*(duration/8))", flags=default_flags
|
||||
seek, name=First-forward-seek, playback-time="min(5.0, (duration/8))", start="min(10, 2*(duration/8))", flags="$(default-flags)"
|
||||
seek, name=Second-forward-seek, playback-time="min(15.0, 3*(duration/8))", start="min(20, 4*(duration/8))", flags="$(default-flags)"
|
||||
seek, name=Third-forward-seek, playback-time="min(25, 5*(duration/8))", start="min(30.0, 6*(duration/8))", flags="$(default-flags)"
|
||||
stop, playback-time=35.0
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
description, seek=true, duration=40, min-media-duration=45.0
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, name=Forward-seek, playback-time=0.0, rate=1.0, start=5.0, flags=default_flags
|
||||
seek, name=Backward-seek, playback-time=10.0, rate=1.0, start=0.0, flags=default_flags
|
||||
seek, name=Backward-seek, playback-time=5.0, rate=1.0, start=25.0, stop=-1, flags=default_flags
|
||||
seek, name=Backward-seek, playback-time=30.0, rate=1.0, start=0.0, flags=default_flags
|
||||
seek, name=Forward-seek, playback-time=5.0, rate=1.0, start=15.0, flags=default_flags
|
||||
seek, name=Forward-seek, playback-time=20.0, rate=1.0, start=35.0, flags=default_flags
|
||||
seek, name=Backward-seek, playback-time=40.0, rate=1.0, start=25.0, flags=default_flags
|
||||
seek, name=Last-backward-seek, playback-time=30.0, rate=1.0, start=5.0, stop=10.0, flags=default_flags
|
||||
seek, name=Forward-seek, playback-time=0.0, rate=1.0, start=5.0, flags="$(default-flags)"
|
||||
seek, name=Backward-seek, playback-time=10.0, rate=1.0, start=0.0, flags="$(default-flags)"
|
||||
seek, name=Backward-seek, playback-time=5.0, rate=1.0, start=25.0, stop=-1, flags="$(default-flags)"
|
||||
seek, name=Backward-seek, playback-time=30.0, rate=1.0, start=0.0, flags="$(default-flags)"
|
||||
seek, name=Forward-seek, playback-time=5.0, rate=1.0, start=15.0, flags="$(default-flags)"
|
||||
seek, name=Forward-seek, playback-time=20.0, rate=1.0, start=35.0, flags="$(default-flags)"
|
||||
seek, name=Backward-seek, playback-time=40.0, rate=1.0, start=25.0, flags="$(default-flags)"
|
||||
seek, name=Last-backward-seek, playback-time=30.0, rate=1.0, start=5.0, stop=10.0, flags="$(default-flags)"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
description, seek=true, duration=5.0, need_clock_sync=true, min-media-duration=2
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, playback-time=1.0, start=0.0, stop="min(5.0, duration-1.0)", flags=default_flags
|
||||
seek, playback-time=1.0, start=0.0, stop="min(5.0, duration-1.0)", flags="$(default-flags)"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
description, seek=true, duration=5.0
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, playback-time=1.0, rate=1.0, start=2.0, flags=default_flags
|
||||
seek, playback-time=3.0, rate=1.0, start=0.0, flags=default_flags
|
||||
seek, playback-time=1.0, rate=1.0, start=2.0, stop=3.0, flags=default_flags
|
||||
seek, playback-time=1.0, rate=1.0, start=2.0, flags="$(default-flags)"
|
||||
seek, playback-time=3.0, rate=1.0, start=0.0, flags="$(default-flags)"
|
||||
seek, playback-time=1.0, rate=1.0, start=2.0, stop=3.0, flags="$(default-flags)"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
description, summary="Use the set seek type to seek at 5 seconds after 2 seconds", seek=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, playback-time=2.0, rate=1.0, start_type=set, start=5.0, stop_type=none, stop=0.0, flags=default_flags
|
||||
seek, playback-time=2.0, rate=1.0, start_type=set, start=5.0, stop_type=none, stop=0.0, flags="$(default-flags)"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
description, summary="Use the set seek type to seek at 0 secs stop 10secs after 5 secs", seek=true
|
||||
description, duration=15.0, seek=true
|
||||
include,location=includes/default-seek-flags.scenario
|
||||
seek, playback-time=5.0, rate=1.0, start_type=none, start=0.0, stop_type=set, stop=10.0, flags=default_flags
|
||||
seek, playback-time=5.0, rate=1.0, start_type=none, start=0.0, stop_type=set, stop=10.0, flags="$(default-flags)"
|
||||
|
|
|
@ -2815,7 +2815,8 @@ _structure_set_variables (GQuark field_id, GValue * value,
|
|||
GstValidateAction * action)
|
||||
{
|
||||
GstValidateScenario *scenario;
|
||||
const gchar *var_value;
|
||||
const gchar *var_value, *pvarname;
|
||||
gint varname_len;
|
||||
|
||||
if (!G_VALUE_HOLDS_STRING (value))
|
||||
return TRUE;
|
||||
|
@ -2824,12 +2825,22 @@ _structure_set_variables (GQuark field_id, GValue * value,
|
|||
if (!scenario)
|
||||
return TRUE;
|
||||
|
||||
var_value =
|
||||
gst_structure_get_string (scenario->priv->vars,
|
||||
g_value_get_string (value));
|
||||
if (var_value) {
|
||||
GST_INFO_OBJECT (action, "Setting variable %s to %s",
|
||||
g_value_get_string (value), var_value);
|
||||
pvarname = g_value_get_string (value);
|
||||
varname_len = strlen (pvarname);
|
||||
if (varname_len > 3 && pvarname[0] == '$' && pvarname[1] == '('
|
||||
&& pvarname[varname_len - 1] == ')') {
|
||||
gchar *varname = g_malloc (sizeof (gchar) * varname_len - 3);
|
||||
strncpy (varname, &pvarname[2], varname_len - 3);
|
||||
varname[varname_len - 3] = '\0';
|
||||
|
||||
var_value = gst_structure_get_string (scenario->priv->vars, varname);
|
||||
if (!var_value) {
|
||||
g_error ("Trying to use undefined variable : %s", pvarname);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_INFO_OBJECT (action, "Setting variable %s to %s", varname, var_value);
|
||||
g_value_set_string (value, var_value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue