scenario: Fix negative rate management

Properly parse the it has a gdouble and set the stop position of the seek as
seeked_position if the rate is negative

+ Add some debug
This commit is contained in:
Thibault Saunier 2013-08-15 17:30:34 +02:00 committed by Thiago Santos
parent ddd00741fd
commit f9ddb6f59e

View file

@ -273,7 +273,7 @@ _parse_seek (GMarkupParseContext * context, const gchar * element_name,
if (playback_time) if (playback_time)
info->action.playback_time = g_ascii_strtoull (playback_time, NULL, 10); info->action.playback_time = g_ascii_strtoull (playback_time, NULL, 10);
info->rate = g_ascii_strtoull (rate, NULL, 10); info->rate = g_ascii_strtod (rate, NULL);
info->flags = get_flags_from_string (GST_TYPE_SEEK_FLAGS, flags); info->flags = get_flags_from_string (GST_TYPE_SEEK_FLAGS, flags);
get_enum_from_string (GST_TYPE_SEEK_TYPE, start_type, &info->start_type); get_enum_from_string (GST_TYPE_SEEK_TYPE, start_type, &info->start_type);
info->start = g_ascii_strtoull (start, NULL, 10); info->start = g_ascii_strtoull (start, NULL, 10);
@ -411,9 +411,9 @@ _execute_action (GstValidateScenario * scenario, ScenarioAction * act)
if (act->type == SCENARIO_ACTION_SEEK) { if (act->type == SCENARIO_ACTION_SEEK) {
SeekInfo *seek = (SeekInfo *) act; SeekInfo *seek = (SeekInfo *) act;
GST_DEBUG ("%s (num %u), seeking to: %" GST_TIME_FORMAT " stop: %" GST_DEBUG ("%s (num %u), seeking to: %" GST_TIME_FORMAT " stop: %"
GST_TIME_FORMAT, SCENARIO_ACTION (seek)->name, GST_TIME_FORMAT " Rate %lf", SCENARIO_ACTION (seek)->name,
SCENARIO_ACTION (seek)->action_number, GST_TIME_ARGS (seek->start), SCENARIO_ACTION (seek)->action_number, GST_TIME_ARGS (seek->start),
GST_TIME_ARGS (seek->stop)); GST_TIME_ARGS (seek->stop), seek->rate);
if (gst_element_seek (pipeline, seek->rate, if (gst_element_seek (pipeline, seek->rate,
seek->format, seek->flags, seek->format, seek->flags,
@ -424,7 +424,8 @@ _execute_action (GstValidateScenario * scenario, ScenarioAction * act)
"Could not seek to position %" GST_TIME_FORMAT, "Could not seek to position %" GST_TIME_FORMAT,
GST_TIME_ARGS (priv->seeked_position)); GST_TIME_ARGS (priv->seeked_position));
} }
priv->seeked_position = seek->start; priv->seeked_position = (seek->rate > 0) ? seek->start : seek->stop;
} else if (act->type == SCENARIO_ACTION_PAUSE) { } else if (act->type == SCENARIO_ACTION_PAUSE) {
PauseInfo *pause = (PauseInfo *) act; PauseInfo *pause = (PauseInfo *) act;