GstPad *sinkpad;
GstStateChangeReturn ret;
gboolean qret;
- GstFormat qformat;
gint64 qcur;
GstBuffer *buffer;
GstFlowReturn fret;
fail_if (sinkpad == NULL);
/* do position query, this should fail, we have nothing received yet */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == FALSE);
ret = gst_element_set_state (pipeline, GST_STATE_READY);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
/* do position query, this should fail, we have nothing received yet */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == FALSE);
/* make pipeline and element ready to accept data */
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
/* do position query, this should fail, we have nothing received yet */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == FALSE);
/* send segment, this should work */
/* FIXME, do position query, this should succeed with the time value from the
* segment. */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur == 1 * GST_SECOND);
/* do position query, this should succeed with the time value from the
* segment. */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur == 1 * GST_SECOND);
/* do position query, this should succeed with the time value from the
* segment before the flush. */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur == 1 * GST_SECOND);
}
/* do position query, this should fail, the segment is flushed */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == FALSE);
/* send segment, this should work */
/* do position query, this should succeed with the time value from the
* segment. */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur == 1 * GST_SECOND);
/* position now is increasing but never exceeds the boundaries of the segment */
for (i = 0; i < 5; i++) {
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
GST_DEBUG ("position %" GST_TIME_FORMAT, GST_TIME_ARGS (qcur));
fail_unless (qret == TRUE);
fail_unless (qcur >= 1 * GST_SECOND && qcur <= 3 * GST_SECOND);
/* after rendering the position must be bigger then the stream_time of the
* buffer */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur >= 2 * GST_SECOND && qcur <= 3 * GST_SECOND);
}
/* this should now just report the stream time of the last buffer */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur == 2 * GST_SECOND);
}
/* do position query, this should fail, the segment is flushed */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == FALSE);
/* send segment, this should work */
/* do position query, this should succeed with the stream time of the buffer
* against the clock. Since the buffer is synced against the clock, the time
* should be at least the stream time of the buffer. */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur >= 2 * GST_SECOND && qcur <= 3 * GST_SECOND);
* against the segment */
g_usleep (2 * G_USEC_PER_SEC);
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur == 3 * GST_SECOND);
/* we report the time of the last start of the buffer. This is slightly
* incorrect, we should report the exact time when we paused but there is no
* record of that anywhere */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == TRUE);
fail_unless (qcur >= 4 * GST_SECOND);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS);
/* fails again because we are in the wrong state */
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == FALSE);
gst_element_set_state (pipeline, GST_STATE_NULL);
- qformat = GST_FORMAT_TIME;
- qret = gst_element_query_position (sink, &qformat, &qcur);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &qcur);
fail_unless (qret == FALSE);
gst_object_unref (sinkpad);
async_done_func (GstBus * bus, GstMessage * msg, GstElement * sink)
{
if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_DONE) {
- GstFormat format;
gint64 position;
GST_DEBUG ("we have ASYNC_DONE now");
fail_unless (have_preroll == TRUE, "no preroll buffer received");
/* get the position now */
- format = GST_FORMAT_TIME;
- gst_element_query_position (sink, &format, &position);
+ gst_element_query_position (sink, GST_FORMAT_TIME, &position);
GST_DEBUG ("we have position %" GST_TIME_FORMAT, GST_TIME_ARGS (position));
GstFlowReturn res;
GstBus *bus;
GThread *thread;
- GstFormat format;
gint64 position;
gboolean qret;
GstSegment segment;
/* We have not yet received any buffers so we are still in the READY state,
* the position is therefore still not queryable. */
- format = GST_FORMAT_TIME;
position = -1;
- qret = gst_element_query_position (sink, &format, &position);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &position);
fail_unless (qret == TRUE, "position wrong");
fail_unless (position == 10 * GST_SECOND, "position is wrong");
fail_unless (res == GST_FLOW_OK, "no OK flow return");
/* check if position is still 10 seconds */
- format = GST_FORMAT_TIME;
- gst_element_query_position (sink, &format, &position);
+ gst_element_query_position (sink, GST_FORMAT_TIME, &position);
GST_DEBUG ("first buffer position %" GST_TIME_FORMAT,
GST_TIME_ARGS (position));
fail_unless (position == 10 * GST_SECOND, "position is wrong");
/* check if position is still 10 seconds. This is racy because the above
* thread might not yet have started the push, because of the above sleep,
* this is very unlikely, though. */
- format = GST_FORMAT_TIME;
- gst_element_query_position (sink, &format, &position);
+ gst_element_query_position (sink, GST_FORMAT_TIME, &position);
GST_DEBUG ("second buffer position %" GST_TIME_FORMAT,
GST_TIME_ARGS (position));
fail_unless (position == 10 * GST_SECOND, "position is wrong");
GST_DEBUG ("joining thread");
g_thread_join (thread);
- format = GST_FORMAT_TIME;
- gst_element_query_position (sink, &format, &position);
+ gst_element_query_position (sink, GST_FORMAT_TIME, &position);
GST_DEBUG ("last buffer position %" GST_TIME_FORMAT,
GST_TIME_ARGS (position));
fail_unless (position == 310 * GST_SECOND, "position is wrong");
async_done_eos_func (GstBus * bus, GstMessage * msg, GstElement * sink)
{
if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_DONE) {
- GstFormat format;
gint64 position;
GST_DEBUG ("we have ASYNC_DONE now");
/* get the position now */
- format = GST_FORMAT_TIME;
- gst_element_query_position (sink, &format, &position);
+ gst_element_query_position (sink, GST_FORMAT_TIME, &position);
GST_DEBUG ("we have position %" GST_TIME_FORMAT, GST_TIME_ARGS (position));
GstPad *sinkpad;
gboolean res;
GstBus *bus;
- GstFormat format;
gint64 position;
gboolean qret;
GstSegment segment;
/* We have not yet received any buffers so we are still in the READY state,
* the position is therefore still not queryable. */
- format = GST_FORMAT_TIME;
position = -1;
- qret = gst_element_query_position (sink, &format, &position);
+ qret = gst_element_query_position (sink, GST_FORMAT_TIME, &position);
fail_unless (qret == TRUE, "position wrong");
fail_unless (position == 10 * GST_SECOND, "position is wrong");
fail_unless (res == TRUE, "no TRUE return");
/* check if position is still 10 seconds */
- format = GST_FORMAT_TIME;
- gst_element_query_position (sink, &format, &position);
+ gst_element_query_position (sink, GST_FORMAT_TIME, &position);
GST_DEBUG ("EOS position %" GST_TIME_FORMAT, GST_TIME_ARGS (position));
fail_unless (position == 10 * GST_SECOND, "position is wrong");