Port gst_element_query*() functions over to the 1.0 API
authorSebastian Dröge <sebastian@centricular.com>
Mon, 12 Aug 2019 08:57:22 +0000 (11:57 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 12 Aug 2019 08:57:22 +0000 (11:57 +0300)
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
markdown/tutorials/android/media-player.md
markdown/tutorials/basic/playback-speed.md
markdown/tutorials/playback/progressive-streaming.md

index 470cd63..af51fbe 100644 (file)
@@ -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;
       }
index faf65aa..d831123 100644 (file)
@@ -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);
   }
index 025d6fd..ba52d0d 100644 (file)
@@ -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;
   }
index 47764af..be6ffeb 100644 (file)
@@ -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' : '>';