Commit bfd08317 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

tests: update for query API changes

parent bb651921
......@@ -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);
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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% */
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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 (" / ");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment