mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 18:35:35 +00:00
scenario: Make the get_clocktime helper a public method
So it can be reused outside of the core code
This commit is contained in:
parent
4d59a2720e
commit
10d1c4560e
2 changed files with 13 additions and 8 deletions
|
@ -159,17 +159,17 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
gboolean
|
||||||
_get_clocktime_from_structure (GstValidateScenario * scenario,
|
gst_validate_action_get_clocktime (GstValidateScenario * scenario,
|
||||||
const GstStructure * structure, const gchar * name, GstClockTime * retval)
|
GstValidateAction *action, const gchar * name, GstClockTime * retval)
|
||||||
{
|
{
|
||||||
gdouble val;
|
gdouble val;
|
||||||
const gchar *strval;
|
const gchar *strval;
|
||||||
|
|
||||||
if (!gst_structure_get_double (structure, name, &val)) {
|
if (!gst_structure_get_double (action->structure, name, &val)) {
|
||||||
gchar *error = NULL;
|
gchar *error = NULL;
|
||||||
|
|
||||||
if (!(strval = gst_structure_get_string (structure, name))) {
|
if (!(strval = gst_structure_get_string (action->structure, name))) {
|
||||||
GST_DEBUG_OBJECT (scenario, "Could not find %s", name);
|
GST_DEBUG_OBJECT (scenario, "Could not find %s", name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
GstClockTime stop = GST_CLOCK_TIME_NONE;
|
GstClockTime stop = GST_CLOCK_TIME_NONE;
|
||||||
GstEvent *seek;
|
GstEvent *seek;
|
||||||
|
|
||||||
if (!_get_clocktime_from_structure (scenario, action->structure, "start",
|
if (!gst_validate_action_get_clocktime (scenario, action, "start",
|
||||||
&start))
|
&start))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
if ((str_flags = gst_structure_get_string (action->structure, "flags")))
|
if ((str_flags = gst_structure_get_string (action->structure, "flags")))
|
||||||
flags = get_flags_from_string (GST_TYPE_SEEK_FLAGS, str_flags);
|
flags = get_flags_from_string (GST_TYPE_SEEK_FLAGS, str_flags);
|
||||||
|
|
||||||
_get_clocktime_from_structure (scenario, action->structure, "stop", &stop);
|
gst_validate_action_get_clocktime (scenario, action, "stop", &stop);
|
||||||
|
|
||||||
g_print ("(position %" GST_TIME_FORMAT
|
g_print ("(position %" GST_TIME_FORMAT
|
||||||
"), %s (num %u, missing repeat: %i), seeking to: %" GST_TIME_FORMAT
|
"), %s (num %u, missing repeat: %i), seeking to: %" GST_TIME_FORMAT
|
||||||
|
@ -639,7 +639,7 @@ message_cb (GstBus * bus, GstMessage * message, GstValidateScenario * scenario)
|
||||||
for (tmp = priv->needs_parsing; tmp; tmp = tmp->next) {
|
for (tmp = priv->needs_parsing; tmp; tmp = tmp->next) {
|
||||||
GstValidateAction *action = tmp->data;
|
GstValidateAction *action = tmp->data;
|
||||||
|
|
||||||
if (!_get_clocktime_from_structure (scenario, action->structure,
|
if (!gst_validate_action_get_clocktime (scenario, action,
|
||||||
"playback_time", &action->playback_time)) {
|
"playback_time", &action->playback_time)) {
|
||||||
gchar *str = gst_structure_to_string (action->structure);
|
gchar *str = gst_structure_to_string (action->structure);
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,11 @@ void gst_validate_list_scenarios (void);
|
||||||
void gst_validate_add_action_type (const gchar *type_name, GstValidateExecuteAction function,
|
void gst_validate_add_action_type (const gchar *type_name, GstValidateExecuteAction function,
|
||||||
const gchar * const * mandatory_fields, const gchar *description);
|
const gchar * const * mandatory_fields, const gchar *description);
|
||||||
|
|
||||||
|
gboolean gst_validate_action_get_clocktime (GstValidateScenario * scenario,
|
||||||
|
GstValidateAction *action,
|
||||||
|
const gchar * name,
|
||||||
|
GstClockTime * retval);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_VALIDATE_SCENARIOS__ */
|
#endif /* __GST_VALIDATE_SCENARIOS__ */
|
||||||
|
|
Loading…
Reference in a new issue