From 10d1c4560e30b3d790297a182ce3651e9a3aadd7 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 9 Oct 2013 09:33:06 -0300 Subject: [PATCH] scenario: Make the get_clocktime helper a public method So it can be reused outside of the core code --- validate/gst/validate/gst-validate-scenario.c | 16 ++++++++-------- validate/gst/validate/gst-validate-scenario.h | 5 +++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index dbd35b30c6..12f462b986 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -159,17 +159,17 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data) return FALSE; } -static gboolean -_get_clocktime_from_structure (GstValidateScenario * scenario, - const GstStructure * structure, const gchar * name, GstClockTime * retval) +gboolean +gst_validate_action_get_clocktime (GstValidateScenario * scenario, + GstValidateAction *action, const gchar * name, GstClockTime * retval) { gdouble val; const gchar *strval; - if (!gst_structure_get_double (structure, name, &val)) { + if (!gst_structure_get_double (action->structure, name, &val)) { 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); return FALSE; } @@ -207,7 +207,7 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action) GstClockTime stop = GST_CLOCK_TIME_NONE; GstEvent *seek; - if (!_get_clocktime_from_structure (scenario, action->structure, "start", + if (!gst_validate_action_get_clocktime (scenario, action, "start", &start)) return FALSE; @@ -226,7 +226,7 @@ _execute_seek (GstValidateScenario * scenario, GstValidateAction * action) if ((str_flags = gst_structure_get_string (action->structure, "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 "), %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) { 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)) { gchar *str = gst_structure_to_string (action->structure); diff --git a/validate/gst/validate/gst-validate-scenario.h b/validate/gst/validate/gst-validate-scenario.h index 5bcc1a59dd..530a77749d 100644 --- a/validate/gst/validate/gst-validate-scenario.h +++ b/validate/gst/validate/gst-validate-scenario.h @@ -74,6 +74,11 @@ void gst_validate_list_scenarios (void); void gst_validate_add_action_type (const gchar *type_name, GstValidateExecuteAction function, 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 #endif /* __GST_VALIDATE_SCENARIOS__ */