mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 21:16:24 +00:00
validate: Expose a seeking method so other actions types can seek
Other action types might need to seek and we GstValidateScenario need to know about it, add a method others can use to do the seeking
This commit is contained in:
parent
a3a132489a
commit
676602644c
2 changed files with 43 additions and 22 deletions
|
@ -209,12 +209,41 @@ gst_validate_action_get_clocktime (GstValidateScenario * scenario,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_validate_scenario_execute_seek (GstValidateScenario * scenario,
|
||||
GstValidateAction * action, gdouble rate, GstFormat format,
|
||||
GstSeekFlags flags, GstSeekType start_type, GstClockTime start,
|
||||
GstSeekType stop_type, GstClockTime stop)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
GstValidateScenarioPrivate *priv = scenario->priv;
|
||||
|
||||
GstEvent *seek = gst_event_new_seek (rate, format, flags, start_type, start,
|
||||
stop_type, stop);
|
||||
|
||||
gst_event_ref (seek);
|
||||
if (gst_element_send_event (scenario->pipeline, seek)) {
|
||||
gst_event_replace (&priv->last_seek, seek);
|
||||
priv->seek_flags = flags;
|
||||
} else {
|
||||
GST_VALIDATE_REPORT (scenario, EVENT_SEEK_NOT_HANDLED,
|
||||
"Could not execute seek: '(position %" GST_TIME_FORMAT
|
||||
"), %s (num %u, missing repeat: %i), seeking to: %" GST_TIME_FORMAT
|
||||
" stop: %" GST_TIME_FORMAT " Rate %lf'",
|
||||
GST_TIME_ARGS (action->playback_time), action->name,
|
||||
action->action_number, action->repeat, GST_TIME_ARGS (start),
|
||||
GST_TIME_ARGS (stop), rate);
|
||||
ret = FALSE;
|
||||
}
|
||||
gst_event_unref (seek);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_execute_seek (GstValidateScenario * scenario, GstValidateAction * action)
|
||||
{
|
||||
GstValidateScenarioPrivate *priv = scenario->priv;
|
||||
const char *str_format, *str_flags, *str_start_type, *str_stop_type;
|
||||
gboolean ret = TRUE;
|
||||
|
||||
gdouble rate = 1.0;
|
||||
GstFormat format = GST_FORMAT_TIME;
|
||||
|
@ -223,7 +252,6 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action)
|
|||
GstClockTime start;
|
||||
GstSeekType stop_type = GST_SEEK_TYPE_SET;
|
||||
GstClockTime stop = GST_CLOCK_TIME_NONE;
|
||||
GstEvent *seek;
|
||||
|
||||
if (!gst_validate_action_get_clocktime (scenario, action, "start", &start))
|
||||
return FALSE;
|
||||
|
@ -251,25 +279,8 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action)
|
|||
" stop: %" GST_TIME_FORMAT " Rate %lf\n",
|
||||
GST_TIME_ARGS (start), GST_TIME_ARGS (stop), rate);
|
||||
|
||||
seek = gst_event_new_seek (rate, format, flags, start_type, start,
|
||||
stop_type, stop);
|
||||
gst_event_ref (seek);
|
||||
if (gst_element_send_event (scenario->pipeline, seek)) {
|
||||
gst_event_replace (&priv->last_seek, seek);
|
||||
priv->seek_flags = flags;
|
||||
} else {
|
||||
GST_VALIDATE_REPORT (scenario, EVENT_SEEK_NOT_HANDLED,
|
||||
"Could not execute seek: '(position %" GST_TIME_FORMAT
|
||||
"), %s (num %u, missing repeat: %i), seeking to: %" GST_TIME_FORMAT
|
||||
" stop: %" GST_TIME_FORMAT " Rate %lf'",
|
||||
GST_TIME_ARGS (action->playback_time), action->name,
|
||||
action->action_number, action->repeat, GST_TIME_ARGS (start),
|
||||
GST_TIME_ARGS (stop), rate);
|
||||
ret = FALSE;
|
||||
}
|
||||
gst_event_unref (seek);
|
||||
|
||||
return ret;
|
||||
return gst_validate_scenario_execute_seek (scenario, action, rate, format,
|
||||
flags, start_type, start, stop_type, stop);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -86,6 +86,16 @@ gboolean gst_validate_action_get_clocktime (GstValidateScenario * scenario,
|
|||
const gchar * name,
|
||||
GstClockTime * retval);
|
||||
|
||||
gboolean gst_validate_scenario_execute_seek (GstValidateScenario *scenario,
|
||||
GstValidateAction *action,
|
||||
gdouble rate,
|
||||
GstFormat format,
|
||||
GstSeekFlags flags,
|
||||
GstSeekType start_type,
|
||||
GstClockTime start,
|
||||
GstSeekType stop_type,
|
||||
GstClockTime stop);
|
||||
|
||||
#define GST_TYPE_VALIDATE_ACTION (gst_validate_action_get_type ())
|
||||
#define GST_IS_VALIDATE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION))
|
||||
GType gst_validate_action_get_type (void);
|
||||
|
|
Loading…
Reference in a new issue