From 1a046968d63235e6fb9d66bc0fd0200532441c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 12 Aug 2019 11:57:22 +0300 Subject: [PATCH] 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 --- markdown/plugin-development/advanced/scheduling.md | 3 +-- markdown/tutorials/android/media-player.md | 10 ++++------ markdown/tutorials/basic/playback-speed.md | 3 +-- markdown/tutorials/playback/progressive-streaming.md | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/markdown/plugin-development/advanced/scheduling.md b/markdown/plugin-development/advanced/scheduling.md index 470cd6317f..af51fbe2d7 100644 --- a/markdown/plugin-development/advanced/scheduling.md +++ b/markdown/plugin-development/advanced/scheduling.md @@ -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; } diff --git a/markdown/tutorials/android/media-player.md b/markdown/tutorials/android/media-player.md index faf65aae90..d831123567 100644 --- a/markdown/tutorials/android/media-player.md +++ b/markdown/tutorials/android/media-player.md @@ -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); } diff --git a/markdown/tutorials/basic/playback-speed.md b/markdown/tutorials/basic/playback-speed.md index 025d6fdb8f..ba52d0d7d3 100644 --- a/markdown/tutorials/basic/playback-speed.md +++ b/markdown/tutorials/basic/playback-speed.md @@ -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; } diff --git a/markdown/tutorials/playback/progressive-streaming.md b/markdown/tutorials/playback/progressive-streaming.md index 47764af197..be6ffeb0b6 100644 --- a/markdown/tutorials/playback/progressive-streaming.md +++ b/markdown/tutorials/playback/progressive-streaming.md @@ -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' : '>';