summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2021-12-04 11:48:30 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2021-12-04 11:48:30 +0300
commit604541863c711b14177c0fac1f41cb79adc43b13 (patch)
treedf8b7e4d50740369cbda5e771fedc44b4f52ab71 /modules
parentbe949496acb9941974ba823e945a2fe299383816 (diff)
downloadgtk+-604541863c711b14177c0fac1f41cb79adc43b13.tar.gz
gstmediafile: Correctly report unknown duration
When loading .mp3 files the duration is initially unknown. Before this change it was reported as a large integer (since GST_CLOCK_TIME_NONE is -1). Now it's correctly reported as 0.
Diffstat (limited to 'modules')
-rw-r--r--modules/media/gtkgstmediafile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/media/gtkgstmediafile.c b/modules/media/gtkgstmediafile.c
index 6f09d1dbc8..0fead35bfa 100644
--- a/modules/media/gtkgstmediafile.c
+++ b/modules/media/gtkgstmediafile.c
@@ -137,11 +137,13 @@ gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self)
media_info = gst_player_get_media_info (self->player);
if (media_info)
{
+ GstClockTime duration = gst_player_media_info_get_duration (media_info);
+
gtk_media_stream_stream_prepared (GTK_MEDIA_STREAM (self),
gst_player_media_info_get_audio_streams (media_info) != NULL,
gst_player_media_info_get_video_streams (media_info) != NULL,
gst_player_media_info_is_seekable (media_info),
- FROM_GST_TIME (gst_player_media_info_get_duration (media_info)));
+ duration == GST_CLOCK_TIME_NONE ? 0 : FROM_GST_TIME (duration));
g_object_unref (media_info);
}