/* If we have pipeline and it is running, query the current position and clip duration and inform
* the application */
static gboolean refresh_ui (CustomData *data) {
- GstFormat fmt = GST_FORMAT_TIME;
gint64 current = -1;
gint64 position;
/* If we didn't know it yet, query the stream duration */
if (!GST_CLOCK_TIME_IS_VALID (data->duration)) {
- if (!gst_element_query_duration (data->pipeline, &fmt, &data->duration)) {
+ if (!gst_element_query_duration (data->pipeline, GST_FORMAT_TIME, data->duration)) {
GST_WARNING ("Could not query current duration");
}
}
- if (gst_element_query_position (data->pipeline, &fmt, &position)) {
+ if (gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {
/* Java expects these values in milliseconds, and GStreamer provides nanoseconds */
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);
}
``` c
static gboolean refresh_ui (CustomData *data) {
- GstFormat fmt = GST_FORMAT_TIME;
gint64 current = -1;
gint64 position;
/* If we didn't know it yet, query the stream duration */
if (!GST_CLOCK_TIME_IS_VALID (data->duration)) {
- if (!gst_element_query_duration (data->pipeline, &fmt, &data->duration)) {
+ if (!gst_element_query_duration (data->pipeline, GST_FORMAT_TIME, &data->duration)) {
GST_WARNING ("Could not query current duration");
}
}
- if (gst_element_query_position (data->pipeline, &fmt, &position)) {
+ if (gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {
/* Java expects these values in milliseconds, and GStreamer provides nanoseconds */
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);
}
/* Send seek event to change rate */
static void send_seek_event (CustomData *data) {
gint64 position;
- GstFormat format = GST_FORMAT_TIME;
GstEvent *seek_event;
/* Obtain the current position, needed for the seek event */
- if (!gst_element_query_position (data->pipeline, &format, &position)) {
+ if (!gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {
g_printerr ("Unable to retrieve current position.\n");
return;
}
values are used to generate the graph.
``` c
-if (gst_element_query_position (data->pipeline, &format, &position) &&
+if (gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position) &&
GST_CLOCK_TIME_IS_VALID (position) &&
- gst_element_query_duration (data->pipeline, &format, &duration) &&
+ gst_element_query_duration (data->pipeline, GST_FORMAT_TIME, &duration) &&
GST_CLOCK_TIME_IS_VALID (duration)) {
i = (gint)(GRAPH_LENGTH * (double)position / (double)(duration + 1));
graph [i] = data->buffering_level < 100 ? 'X' : '>';