Merge branch 'wip/otte/for-master' into 'master'

Wip/otte/for master

Closes #3810

See merge request GNOME/gtk!3366
This commit is contained in:
Benjamin Otte 2021-03-29 15:41:55 +00:00
commit 6569a877d8
2 changed files with 29 additions and 12 deletions

View File

@ -1263,6 +1263,8 @@ gtk_media_stream_error_valist (GtkMediaStream *self,
*
* It is up to implementations to call this at the frequency
* they deem appropriate.
*
* The media stream must be prepared when this function is called.
*/
void
gtk_media_stream_update (GtkMediaStream *self,
@ -1271,6 +1273,7 @@ gtk_media_stream_update (GtkMediaStream *self,
GtkMediaStreamPrivate *priv = gtk_media_stream_get_instance_private (self);
g_return_if_fail (GTK_IS_MEDIA_STREAM (self));
g_return_if_fail (gtk_media_stream_is_prepared (self));
g_object_freeze_notify (G_OBJECT (self));
@ -1301,6 +1304,8 @@ gtk_media_stream_update (GtkMediaStream *self,
*
* This is a hint only, calls to GtkMediaStream.play()
* may still happen.
*
* The media stream must be prepared when this function is called.
*/
void
gtk_media_stream_ended (GtkMediaStream *self)
@ -1308,6 +1313,7 @@ gtk_media_stream_ended (GtkMediaStream *self)
GtkMediaStreamPrivate *priv = gtk_media_stream_get_instance_private (self);
g_return_if_fail (GTK_IS_MEDIA_STREAM (self));
g_return_if_fail (gtk_media_stream_is_prepared (self));
g_return_if_fail (!gtk_media_stream_get_ended (self));
g_object_freeze_notify (G_OBJECT (self));

View File

@ -127,17 +127,8 @@ g_io_module_query (void)
}
static void
gtk_gst_media_file_position_updated_cb (GstPlayer *player,
GstClockTime time,
GtkGstMediaFile *self)
{
gtk_media_stream_update (GTK_MEDIA_STREAM (self), FROM_GST_TIME (time));
}
static void
gtk_gst_media_file_duration_changed_cb (GstPlayer *player,
GstClockTime duration,
GtkGstMediaFile *self)
gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self,
gint64 duration)
{
if (gtk_media_stream_is_prepared (GTK_MEDIA_STREAM (self)))
return;
@ -146,7 +137,25 @@ gtk_gst_media_file_duration_changed_cb (GstPlayer *player,
TRUE,
TRUE,
TRUE,
FROM_GST_TIME (duration));
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));
}
static void
gtk_gst_media_file_duration_changed_cb (GstPlayer *player,
GstClockTime duration,
GtkGstMediaFile *self)
{
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;