[gtk/wip/otte/for-master: 1/2] gstmedia: Ensure we prepare files without duration
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/for-master: 1/2] gstmedia: Ensure we prepare files without duration
- Date: Mon, 29 Mar 2021 15:10:02 +0000 (UTC)
commit 06be1f8b52eb486b3fe0936f935eec9ea12339ef
Author: Benjamin Otte <otte redhat com>
Date: Mon Mar 29 17:03:33 2021 +0200
gstmedia: Ensure we prepare files without duration
In particular this fixes playback of images.
Fixes #3810
modules/media/gtkgstmediafile.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/modules/media/gtkgstmediafile.c b/modules/media/gtkgstmediafile.c
index 6382f3b10a..7edc682e9c 100644
--- a/modules/media/gtkgstmediafile.c
+++ b/modules/media/gtkgstmediafile.c
@@ -126,11 +126,27 @@ g_io_module_query (void)
return g_strdupv (eps);
}
+static void
+gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self,
+ gint64 duration)
+{
+ if (gtk_media_stream_is_prepared (GTK_MEDIA_STREAM (self)))
+ return;
+
+ gtk_media_stream_prepared (GTK_MEDIA_STREAM (self),
+ TRUE,
+ TRUE,
+ TRUE,
+ duration);
+}
+
static void
gtk_gst_media_file_position_updated_cb (GstPlayer *player,
GstClockTime time,
GtkGstMediaFile *self)
{
+ gtk_gst_media_file_ensure_prepared (self, 0);
+
gtk_media_stream_update (GTK_MEDIA_STREAM (self), FROM_GST_TIME (time));
}
@@ -139,14 +155,7 @@ gtk_gst_media_file_duration_changed_cb (GstPlayer *player,
GstClockTime duration,
GtkGstMediaFile *self)
{
- if (gtk_media_stream_is_prepared (GTK_MEDIA_STREAM (self)))
- return;
-
- gtk_media_stream_prepared (GTK_MEDIA_STREAM (self),
- TRUE,
- TRUE,
- TRUE,
- FROM_GST_TIME (duration));
+ gtk_gst_media_file_ensure_prepared (self, FROM_GST_TIME (duration));
}
static void
@@ -176,6 +185,8 @@ static void
gtk_gst_media_file_end_of_stream_cb (GstPlayer *player,
GtkGstMediaFile *self)
{
+ gtk_gst_media_file_ensure_prepared (self, 0);
+
if (gtk_media_stream_get_ended (GTK_MEDIA_STREAM (self)))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]