mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-11 19:06:33 +00:00
tests: update for query API changes
This commit is contained in:
parent
bb65192151
commit
bfd083175b
9 changed files with 25 additions and 46 deletions
|
@ -68,7 +68,6 @@ GST_START_TEST (test_memory_stream)
|
||||||
guint8 *in_data;
|
guint8 *in_data;
|
||||||
guint8 *out_data;
|
guint8 *out_data;
|
||||||
gint i;
|
gint i;
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
guint bus_watch = 0;
|
guint bus_watch = 0;
|
||||||
|
|
||||||
|
@ -110,7 +109,7 @@ GST_START_TEST (test_memory_stream)
|
||||||
gst_element_set_state (bin, GST_STATE_PAUSED);
|
gst_element_set_state (bin, GST_STATE_PAUSED);
|
||||||
gst_element_get_state (bin, NULL, NULL, -1);
|
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);
|
fail_unless_equals_int (duration, 512);
|
||||||
|
|
||||||
gst_element_set_state (bin, GST_STATE_PLAYING);
|
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_set_state (bin, GST_STATE_PAUSED);
|
||||||
gst_element_get_state (bin, NULL, NULL, -1);
|
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);
|
fail_unless_equals_int (duration, 512);
|
||||||
|
|
||||||
gst_element_set_state (bin, GST_STATE_PLAYING);
|
gst_element_set_state (bin, GST_STATE_PLAYING);
|
||||||
|
|
|
@ -1075,7 +1075,7 @@ query_rates (void)
|
||||||
|
|
||||||
format = seek_formats[i].format;
|
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)) {
|
&value)) {
|
||||||
g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
|
g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1106,8 +1106,8 @@ query_positions_elems (void)
|
||||||
|
|
||||||
format = seek_formats[i].format;
|
format = seek_formats[i].format;
|
||||||
|
|
||||||
if (gst_element_query_position (element, &format, &position) &&
|
if (gst_element_query_position (element, format, &position) &&
|
||||||
gst_element_query_duration (element, &format, &total)) {
|
gst_element_query_duration (element, format, &total)) {
|
||||||
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
||||||
seek_formats[i].name, position, total);
|
seek_formats[i].name, position, total);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1138,8 +1138,8 @@ query_positions_pads (void)
|
||||||
|
|
||||||
format = seek_formats[i].format;
|
format = seek_formats[i].format;
|
||||||
|
|
||||||
if (gst_pad_query_position (pad, &format, &position) &&
|
if (gst_pad_query_position (pad, format, &position) &&
|
||||||
gst_pad_query_duration (pad, &format, &total)) {
|
gst_pad_query_duration (pad, format, &total)) {
|
||||||
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
||||||
seek_formats[i].name, position, total);
|
seek_formats[i].name, position, total);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1227,24 +1227,19 @@ update_fill (gpointer data)
|
||||||
static gboolean
|
static gboolean
|
||||||
update_scale (gpointer data)
|
update_scale (gpointer data)
|
||||||
{
|
{
|
||||||
GstFormat format = GST_FORMAT_TIME;
|
|
||||||
|
|
||||||
//position = 0;
|
|
||||||
//duration = 0;
|
|
||||||
|
|
||||||
if (elem_seek) {
|
if (elem_seek) {
|
||||||
if (seekable_elements) {
|
if (seekable_elements) {
|
||||||
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
||||||
|
|
||||||
gst_element_query_position (element, &format, &position);
|
gst_element_query_position (element, GST_FORMAT_TIME, &position);
|
||||||
gst_element_query_duration (element, &format, &duration);
|
gst_element_query_duration (element, GST_FORMAT_TIME, &duration);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (seekable_pads) {
|
if (seekable_pads) {
|
||||||
GstPad *pad = GST_PAD (seekable_pads->data);
|
GstPad *pad = GST_PAD (seekable_pads->data);
|
||||||
|
|
||||||
gst_pad_query_position (pad, &format, &position);
|
gst_pad_query_position (pad, GST_FORMAT_TIME, &position);
|
||||||
gst_pad_query_duration (pad, &format, &duration);
|
gst_pad_query_duration (pad, GST_FORMAT_TIME, &duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,15 +145,11 @@ format_value (GtkScale * scale, gdouble value)
|
||||||
static gboolean
|
static gboolean
|
||||||
update_scale (gpointer data)
|
update_scale (gpointer data)
|
||||||
{
|
{
|
||||||
GstFormat format;
|
|
||||||
|
|
||||||
position = 0;
|
position = 0;
|
||||||
duration = 0;
|
duration = 0;
|
||||||
|
|
||||||
format = GST_FORMAT_TIME;
|
gst_element_query_position (pipeline, GST_FORMAT_TIME, &position);
|
||||||
|
gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration);
|
||||||
gst_element_query_position (pipeline, &format, &position);
|
|
||||||
gst_element_query_duration (pipeline, &format, &duration);
|
|
||||||
|
|
||||||
if (position >= duration)
|
if (position >= duration)
|
||||||
duration = position;
|
duration = position;
|
||||||
|
|
|
@ -307,8 +307,8 @@ query_positions_elems (void)
|
||||||
|
|
||||||
format = seek_formats[i].format;
|
format = seek_formats[i].format;
|
||||||
|
|
||||||
if (gst_element_query_position (element, &format, &position) &&
|
if (gst_element_query_position (element, format, &position) &&
|
||||||
gst_element_query_duration (element, &format, &total)) {
|
gst_element_query_duration (element, format, &total)) {
|
||||||
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
||||||
seek_formats[i].name, position, total);
|
seek_formats[i].name, position, total);
|
||||||
} else {
|
} else {
|
||||||
|
@ -393,16 +393,11 @@ update_fill (gpointer data)
|
||||||
static gboolean
|
static gboolean
|
||||||
update_scale (gpointer data)
|
update_scale (gpointer data)
|
||||||
{
|
{
|
||||||
GstFormat format = GST_FORMAT_TIME;
|
|
||||||
|
|
||||||
//position = 0;
|
|
||||||
//duration = 0;
|
|
||||||
|
|
||||||
if (seekable_elements) {
|
if (seekable_elements) {
|
||||||
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
||||||
|
|
||||||
gst_element_query_position (element, &format, &position);
|
gst_element_query_position (element, GST_FORMAT_TIME, &position);
|
||||||
gst_element_query_duration (element, &format, &duration);
|
gst_element_query_duration (element, GST_FORMAT_TIME, &duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats) {
|
if (stats) {
|
||||||
|
|
|
@ -34,7 +34,6 @@ main (int argc, char *argv[])
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
gint64 duration, position;
|
gint64 duration, position;
|
||||||
GstFormat format;
|
|
||||||
GstStateChangeReturn ret;
|
GstStateChangeReturn ret;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
@ -87,8 +86,7 @@ main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the duration */
|
/* get the duration */
|
||||||
format = GST_FORMAT_TIME;
|
gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration);
|
||||||
gst_element_query_duration (pipeline, &format, &duration);
|
|
||||||
|
|
||||||
if (duration != -1)
|
if (duration != -1)
|
||||||
/* we have a duration, seek to 5% */
|
/* we have a duration, seek to 5% */
|
||||||
|
|
|
@ -25,17 +25,16 @@ update_scale (GstElement * element)
|
||||||
{
|
{
|
||||||
gint64 duration = -1;
|
gint64 duration = -1;
|
||||||
gint64 position = -1;
|
gint64 position = -1;
|
||||||
GstFormat format = GST_FORMAT_TIME;
|
|
||||||
gchar dur_str[32], pos_str[32];
|
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) {
|
position != -1) {
|
||||||
g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
|
g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
|
||||||
} else {
|
} else {
|
||||||
g_snprintf (pos_str, 32, "-:--:--.---------");
|
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) {
|
duration != -1) {
|
||||||
g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
|
g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,17 +34,16 @@ update_scale (GstElement * element)
|
||||||
{
|
{
|
||||||
gint64 duration = -1;
|
gint64 duration = -1;
|
||||||
gint64 position = -1;
|
gint64 position = -1;
|
||||||
GstFormat format = GST_FORMAT_TIME;
|
|
||||||
gchar dur_str[32], pos_str[32];
|
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) {
|
position != -1) {
|
||||||
g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
|
g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
|
||||||
} else {
|
} else {
|
||||||
g_snprintf (pos_str, 32, "-:--:--.---------");
|
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) {
|
duration != -1) {
|
||||||
g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
|
g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -95,13 +95,11 @@ have_subtitle (GstElement * appsink, App * app)
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
gsize size;
|
gsize size;
|
||||||
GstFormat format;
|
|
||||||
gint64 position;
|
gint64 position;
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
GstClockTime base_time, running_time;
|
GstClockTime base_time, running_time;
|
||||||
|
|
||||||
format = GST_FORMAT_TIME;
|
gst_element_query_position (appsink, GST_FORMAT_TIME, &position);
|
||||||
gst_element_query_position (appsink, &format, &position);
|
|
||||||
|
|
||||||
clock = gst_element_get_clock (appsink);
|
clock = gst_element_get_clock (appsink);
|
||||||
base_time = gst_element_get_base_time (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++) {
|
for (i = GST_FORMAT_DEFAULT; i <= GST_FORMAT_PERCENT; i++) {
|
||||||
fmt = i;
|
fmt = i;
|
||||||
pres = gst_element_query_position (bin, &fmt, &pos);
|
pres = gst_element_query_position (bin, fmt, &pos);
|
||||||
fmt = i;
|
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));
|
printf ("%-8s : ", gst_format_get_name (i));
|
||||||
print_value (pres, fmt, pos);
|
print_value (pres, fmt, pos);
|
||||||
printf (" / ");
|
printf (" / ");
|
||||||
|
|
Loading…
Reference in a new issue