mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
Handle media with no position or duration correctly (pictures, for example)
This commit is contained in:
parent
3c9c405464
commit
36d03232e1
1 changed files with 8 additions and 4 deletions
|
@ -135,14 +135,18 @@ 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)) {
|
||||
GST_WARNING ("Could not query current duration");
|
||||
GST_WARNING ("Could not query current duration (normal for still pictures)");
|
||||
data->duration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (gst_element_query_position (data->pipeline, &fmt, &position)) {
|
||||
/* Java expects these values in milliseconds, and GStreamer provides nanoseconds */
|
||||
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);
|
||||
if (!gst_element_query_position (data->pipeline, &fmt, &position)) {
|
||||
GST_WARNING ("Could not query current position (normal for still pictures)");
|
||||
position = 0;
|
||||
}
|
||||
|
||||
/* Java expects these values in milliseconds, and GStreamer provides nanoseconds */
|
||||
set_current_ui_position (position / GST_MSECOND, data->duration / GST_MSECOND, data);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue