mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
Port gst_element_query*() functions over to the 1.0 API
We don't take the GstFormat as pointer anymore. This was already fixed long ago in the actual code but not in the markdown documentation. Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/issues/44
This commit is contained in:
parent
23cb67b03e
commit
1a046968d6
4 changed files with 8 additions and 12 deletions
|
@ -221,10 +221,9 @@ far.
|
|||
{
|
||||
GstFlowReturn ret;
|
||||
guint64 len;
|
||||
GstFormat fmt = GST_FORMAT_BYTES;
|
||||
GstBuffer *buf = NULL;
|
||||
|
||||
if (!gst_pad_query_duration (filter->sinkpad, fmt, &len)) {
|
||||
if (!gst_pad_query_duration (filter->sinkpad, GST_FORMAT_BYTES, &len)) {
|
||||
GST_DEBUG_OBJECT (filter, "failed to query duration, pausing");
|
||||
goto stop;
|
||||
}
|
||||
|
|
|
@ -610,7 +610,6 @@ static void set_current_ui_position (gint position, gint duration, CustomData *d
|
|||
/* 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;
|
||||
|
||||
|
@ -620,12 +619,12 @@ static gboolean refresh_ui (CustomData *data) {
|
|||
|
||||
/* 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);
|
||||
}
|
||||
|
@ -1169,7 +1168,6 @@ Then, in the refresh\_ui method:
|
|||
|
||||
``` c
|
||||
static gboolean refresh_ui (CustomData *data) {
|
||||
GstFormat fmt = GST_FORMAT_TIME;
|
||||
gint64 current = -1;
|
||||
gint64 position;
|
||||
|
||||
|
@ -1179,12 +1177,12 @@ static gboolean refresh_ui (CustomData *data) {
|
|||
|
||||
/* 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);
|
||||
}
|
||||
|
|
|
@ -79,11 +79,10 @@ typedef struct _CustomData {
|
|||
/* 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;
|
||||
}
|
||||
|
|
|
@ -360,9 +360,9 @@ range) depends on what we requested in the
|
|||
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' : '>';
|
||||
|
|
Loading…
Reference in a new issue