From bfd083175bd10ee1bb5f008bb9e66dcdd0c41b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 27 Jul 2011 01:18:19 +0100 Subject: [PATCH] tests: update for query API changes --- tests/check/pipelines/gio.c | 5 ++--- tests/examples/seek/jsseek.c | 23 +++++++++-------------- tests/examples/seek/scrubby.c | 8 ++------ tests/examples/seek/seek.c | 13 ++++--------- tests/examples/snapshot/snapshot.c | 4 +--- tests/icles/playback/test3.c | 5 ++--- tests/icles/playback/test7.c | 5 ++--- tests/icles/playbin-text.c | 4 +--- tests/icles/position-formats.c | 4 ++-- 9 files changed, 25 insertions(+), 46 deletions(-) diff --git a/tests/check/pipelines/gio.c b/tests/check/pipelines/gio.c index ee14110166..10b9213eaf 100644 --- a/tests/check/pipelines/gio.c +++ b/tests/check/pipelines/gio.c @@ -68,7 +68,6 @@ GST_START_TEST (test_memory_stream) guint8 *in_data; guint8 *out_data; gint i; - GstFormat fmt = GST_FORMAT_BYTES; gint64 duration; guint bus_watch = 0; @@ -110,7 +109,7 @@ GST_START_TEST (test_memory_stream) gst_element_set_state (bin, GST_STATE_PAUSED); gst_element_get_state (bin, NULL, NULL, -1); - fail_unless (gst_element_query_duration (bin, &fmt, &duration)); + fail_unless (gst_element_query_duration (bin, GST_FORMAT_BYTES, &duration)); fail_unless_equals_int (duration, 512); gst_element_set_state (bin, GST_STATE_PLAYING); @@ -130,7 +129,7 @@ GST_START_TEST (test_memory_stream) gst_element_set_state (bin, GST_STATE_PAUSED); gst_element_get_state (bin, NULL, NULL, -1); - fail_unless (gst_element_query_duration (bin, &fmt, &duration)); + fail_unless (gst_element_query_duration (bin, GST_FORMAT_BYTES, &duration)); fail_unless_equals_int (duration, 512); gst_element_set_state (bin, GST_STATE_PLAYING); diff --git a/tests/examples/seek/jsseek.c b/tests/examples/seek/jsseek.c index 6d6ec21d46..f0bbc7e766 100644 --- a/tests/examples/seek/jsseek.c +++ b/tests/examples/seek/jsseek.c @@ -1075,7 +1075,7 @@ query_rates (void) format = seek_formats[i].format; - if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, + if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, format, &value)) { g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value); } else { @@ -1106,8 +1106,8 @@ query_positions_elems (void) format = seek_formats[i].format; - if (gst_element_query_position (element, &format, &position) && - gst_element_query_duration (element, &format, &total)) { + if (gst_element_query_position (element, format, &position) && + gst_element_query_duration (element, format, &total)) { g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ", seek_formats[i].name, position, total); } else { @@ -1138,8 +1138,8 @@ query_positions_pads (void) format = seek_formats[i].format; - if (gst_pad_query_position (pad, &format, &position) && - gst_pad_query_duration (pad, &format, &total)) { + if (gst_pad_query_position (pad, format, &position) && + gst_pad_query_duration (pad, format, &total)) { g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ", seek_formats[i].name, position, total); } else { @@ -1227,24 +1227,19 @@ update_fill (gpointer data) static gboolean update_scale (gpointer data) { - GstFormat format = GST_FORMAT_TIME; - - //position = 0; - //duration = 0; - if (elem_seek) { if (seekable_elements) { GstElement *element = GST_ELEMENT (seekable_elements->data); - gst_element_query_position (element, &format, &position); - gst_element_query_duration (element, &format, &duration); + gst_element_query_position (element, GST_FORMAT_TIME, &position); + gst_element_query_duration (element, GST_FORMAT_TIME, &duration); } } else { if (seekable_pads) { GstPad *pad = GST_PAD (seekable_pads->data); - gst_pad_query_position (pad, &format, &position); - gst_pad_query_duration (pad, &format, &duration); + gst_pad_query_position (pad, GST_FORMAT_TIME, &position); + gst_pad_query_duration (pad, GST_FORMAT_TIME, &duration); } } diff --git a/tests/examples/seek/scrubby.c b/tests/examples/seek/scrubby.c index aa6de20be3..f399cb47ae 100644 --- a/tests/examples/seek/scrubby.c +++ b/tests/examples/seek/scrubby.c @@ -145,15 +145,11 @@ format_value (GtkScale * scale, gdouble value) static gboolean update_scale (gpointer data) { - GstFormat format; - position = 0; duration = 0; - format = GST_FORMAT_TIME; - - gst_element_query_position (pipeline, &format, &position); - gst_element_query_duration (pipeline, &format, &duration); + gst_element_query_position (pipeline, GST_FORMAT_TIME, &position); + gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration); if (position >= duration) duration = position; diff --git a/tests/examples/seek/seek.c b/tests/examples/seek/seek.c index a49a9cd4c3..18677cadf6 100644 --- a/tests/examples/seek/seek.c +++ b/tests/examples/seek/seek.c @@ -307,8 +307,8 @@ query_positions_elems (void) format = seek_formats[i].format; - if (gst_element_query_position (element, &format, &position) && - gst_element_query_duration (element, &format, &total)) { + if (gst_element_query_position (element, format, &position) && + gst_element_query_duration (element, format, &total)) { g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ", seek_formats[i].name, position, total); } else { @@ -393,16 +393,11 @@ update_fill (gpointer data) static gboolean update_scale (gpointer data) { - GstFormat format = GST_FORMAT_TIME; - - //position = 0; - //duration = 0; - if (seekable_elements) { GstElement *element = GST_ELEMENT (seekable_elements->data); - gst_element_query_position (element, &format, &position); - gst_element_query_duration (element, &format, &duration); + gst_element_query_position (element, GST_FORMAT_TIME, &position); + gst_element_query_duration (element, GST_FORMAT_TIME, &duration); } if (stats) { diff --git a/tests/examples/snapshot/snapshot.c b/tests/examples/snapshot/snapshot.c index feafdf30bb..6f9755ea78 100644 --- a/tests/examples/snapshot/snapshot.c +++ b/tests/examples/snapshot/snapshot.c @@ -34,7 +34,6 @@ main (int argc, char *argv[]) GError *error = NULL; GdkPixbuf *pixbuf; gint64 duration, position; - GstFormat format; GstStateChangeReturn ret; gboolean res; guint8 *data; @@ -87,8 +86,7 @@ main (int argc, char *argv[]) } /* get the duration */ - format = GST_FORMAT_TIME; - gst_element_query_duration (pipeline, &format, &duration); + gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration); if (duration != -1) /* we have a duration, seek to 5% */ diff --git a/tests/icles/playback/test3.c b/tests/icles/playback/test3.c index dd08f7cf5f..d55e633310 100644 --- a/tests/icles/playback/test3.c +++ b/tests/icles/playback/test3.c @@ -25,17 +25,16 @@ update_scale (GstElement * element) { gint64 duration = -1; gint64 position = -1; - GstFormat format = GST_FORMAT_TIME; gchar dur_str[32], pos_str[32]; - if (gst_element_query_position (element, &format, &position) && + if (gst_element_query_position (element, GST_FORMAT_TIME, &position) && position != -1) { g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position)); } else { g_snprintf (pos_str, 32, "-:--:--.---------"); } - if (gst_element_query_duration (element, &format, &duration) && + if (gst_element_query_duration (element, GST_FORMAT_TIME, &duration) && duration != -1) { g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration)); } else { diff --git a/tests/icles/playback/test7.c b/tests/icles/playback/test7.c index 530229bd5b..6dc984a791 100644 --- a/tests/icles/playback/test7.c +++ b/tests/icles/playback/test7.c @@ -34,17 +34,16 @@ update_scale (GstElement * element) { gint64 duration = -1; gint64 position = -1; - GstFormat format = GST_FORMAT_TIME; gchar dur_str[32], pos_str[32]; - if (gst_element_query_position (element, &format, &position) && + if (gst_element_query_position (element, GST_FORMAT_TIME, &position) && position != -1) { g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position)); } else { g_snprintf (pos_str, 32, "-:--:--.---------"); } - if (gst_element_query_duration (element, &format, &duration) && + if (gst_element_query_duration (element, GST_FORMAT_TIME, &duration) && duration != -1) { g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration)); } else { diff --git a/tests/icles/playbin-text.c b/tests/icles/playbin-text.c index 0b32ed0f21..a7c473655a 100644 --- a/tests/icles/playbin-text.c +++ b/tests/icles/playbin-text.c @@ -95,13 +95,11 @@ have_subtitle (GstElement * appsink, App * app) if (buffer) { guint8 *data; gsize size; - GstFormat format; gint64 position; GstClock *clock; GstClockTime base_time, running_time; - format = GST_FORMAT_TIME; - gst_element_query_position (appsink, &format, &position); + gst_element_query_position (appsink, GST_FORMAT_TIME, &position); clock = gst_element_get_clock (appsink); base_time = gst_element_get_base_time (appsink); diff --git a/tests/icles/position-formats.c b/tests/icles/position-formats.c index 5ca815e60a..774d288b18 100644 --- a/tests/icles/position-formats.c +++ b/tests/icles/position-formats.c @@ -83,9 +83,9 @@ run_queries (gpointer user_data) for (i = GST_FORMAT_DEFAULT; i <= GST_FORMAT_PERCENT; i++) { fmt = i; - pres = gst_element_query_position (bin, &fmt, &pos); + pres = gst_element_query_position (bin, fmt, &pos); fmt = i; - dres = gst_element_query_duration (bin, &fmt, &dur); + dres = gst_element_query_duration (bin, fmt, &dur); printf ("%-8s : ", gst_format_get_name (i)); print_value (pres, fmt, pos); printf (" / ");