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;
|
GstFlowReturn ret;
|
||||||
guint64 len;
|
guint64 len;
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
GstBuffer *buf = NULL;
|
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");
|
GST_DEBUG_OBJECT (filter, "failed to query duration, pausing");
|
||||||
goto stop;
|
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
|
/* If we have pipeline and it is running, query the current position and clip duration and inform
|
||||||
* the application */
|
* the application */
|
||||||
static gboolean refresh_ui (CustomData *data) {
|
static gboolean refresh_ui (CustomData *data) {
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
|
||||||
gint64 current = -1;
|
gint64 current = -1;
|
||||||
gint64 position;
|
gint64 position;
|
||||||
|
|
||||||
|
@ -620,12 +619,12 @@ static gboolean refresh_ui (CustomData *data) {
|
||||||
|
|
||||||
/* If we didn't know it yet, query the stream duration */
|
/* If we didn't know it yet, query the stream duration */
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (data->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");
|
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 */
|
/* Java expects these values in milliseconds, and GStreamer provides nanoseconds */
|
||||||
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);
|
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1168,6 @@ Then, in the refresh\_ui method:
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
static gboolean refresh_ui (CustomData *data) {
|
static gboolean refresh_ui (CustomData *data) {
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
|
||||||
gint64 current = -1;
|
gint64 current = -1;
|
||||||
gint64 position;
|
gint64 position;
|
||||||
|
|
||||||
|
@ -1179,12 +1177,12 @@ static gboolean refresh_ui (CustomData *data) {
|
||||||
|
|
||||||
/* If we didn't know it yet, query the stream duration */
|
/* If we didn't know it yet, query the stream duration */
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (data->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");
|
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 */
|
/* Java expects these values in milliseconds, and GStreamer provides nanoseconds */
|
||||||
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);
|
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 */
|
/* Send seek event to change rate */
|
||||||
static void send_seek_event (CustomData *data) {
|
static void send_seek_event (CustomData *data) {
|
||||||
gint64 position;
|
gint64 position;
|
||||||
GstFormat format = GST_FORMAT_TIME;
|
|
||||||
GstEvent *seek_event;
|
GstEvent *seek_event;
|
||||||
|
|
||||||
/* Obtain the current position, needed for the 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");
|
g_printerr ("Unable to retrieve current position.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,9 +360,9 @@ range) depends on what we requested in the
|
||||||
values are used to generate the graph.
|
values are used to generate the graph.
|
||||||
|
|
||||||
``` c
|
``` 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_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)) {
|
GST_CLOCK_TIME_IS_VALID (duration)) {
|
||||||
i = (gint)(GRAPH_LENGTH * (double)position / (double)(duration + 1));
|
i = (gint)(GRAPH_LENGTH * (double)position / (double)(duration + 1));
|
||||||
graph [i] = data->buffering_level < 100 ? 'X' : '>';
|
graph [i] = data->buffering_level < 100 ? 'X' : '>';
|
||||||
|
|
Loading…
Reference in a new issue