forked from AuroraMiddleware/gtk
mediastream: Rename an api to avoid name collisions
Some bindings can't handle the coexistence of GtkMediaStream:prepared and gtk_media_stream_prepared. Help them out by renaming the function to gtk_media_stream_set_prepared, and rename gtk_media_stream_unprepared as well, to match. The existing entry points still exist, deprecated. Update all internal uses. Fixes: #4023
This commit is contained in:
parent
e888364d3c
commit
86b5dba43b
@ -267,11 +267,11 @@ gtk_nuclear_media_stream_init (GtkNuclearMediaStream *nuclear)
|
||||
* However, media streams need to tell GTK once they are initialized,
|
||||
* so we do that here.
|
||||
*/
|
||||
gtk_media_stream_prepared (GTK_MEDIA_STREAM (nuclear),
|
||||
FALSE,
|
||||
TRUE,
|
||||
TRUE,
|
||||
DURATION);
|
||||
gtk_media_stream_set_prepared (GTK_MEDIA_STREAM (nuclear),
|
||||
FALSE,
|
||||
TRUE,
|
||||
TRUE,
|
||||
DURATION);
|
||||
}
|
||||
|
||||
/* And finally, we add the simple constructor we declared in the header. */
|
||||
|
@ -72,7 +72,7 @@ gtk_media_file_default_open (GtkMediaFile *self)
|
||||
static void
|
||||
gtk_media_file_default_close (GtkMediaFile *self)
|
||||
{
|
||||
gtk_media_stream_unprepared (GTK_MEDIA_STREAM (self));
|
||||
gtk_media_stream_unset_prepared (GTK_MEDIA_STREAM (self));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1012,7 +1012,7 @@ gtk_media_stream_unrealize (GtkMediaStream *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_media_stream_prepared:
|
||||
* gtk_media_stream_set_prepared:
|
||||
* @self: a `GtkMediaStream`
|
||||
* @has_audio: %TRUE if the stream should advertise audio support
|
||||
* @has_video: %TRUE if the stream should advertise video support
|
||||
@ -1029,13 +1029,15 @@ gtk_media_stream_unrealize (GtkMediaStream *self,
|
||||
*
|
||||
* This function may not be called again until the stream has been
|
||||
* reset via [method@Gtk.MediaStream.unprepared].
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
void
|
||||
gtk_media_stream_prepared (GtkMediaStream *self,
|
||||
gboolean has_audio,
|
||||
gboolean has_video,
|
||||
gboolean seekable,
|
||||
gint64 duration)
|
||||
gtk_media_stream_set_prepared (GtkMediaStream *self,
|
||||
gboolean has_audio,
|
||||
gboolean has_video,
|
||||
gboolean seekable,
|
||||
gint64 duration)
|
||||
{
|
||||
GtkMediaStreamPrivate *priv = gtk_media_stream_get_instance_private (self);
|
||||
|
||||
@ -1072,7 +1074,7 @@ gtk_media_stream_prepared (GtkMediaStream *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_media_stream_unprepared:
|
||||
* gtk_media_stream_unset_prepared:
|
||||
* @self: a `GtkMediaStream`
|
||||
*
|
||||
* Resets a given media stream implementation.
|
||||
@ -1080,9 +1082,11 @@ gtk_media_stream_prepared (GtkMediaStream *self,
|
||||
* [method@Gtk.MediaStream.prepared] can then be called again.
|
||||
*
|
||||
* This function will also reset any error state the stream was in.
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
void
|
||||
gtk_media_stream_unprepared (GtkMediaStream *self)
|
||||
gtk_media_stream_unset_prepared (GtkMediaStream *self)
|
||||
{
|
||||
GtkMediaStreamPrivate *priv = gtk_media_stream_get_instance_private (self);
|
||||
|
||||
@ -1135,6 +1139,42 @@ gtk_media_stream_unprepared (GtkMediaStream *self)
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_media_stream_prepared:
|
||||
* @self: a `GtkMediaStream`
|
||||
* @has_audio: %TRUE if the stream should advertise audio support
|
||||
* @has_video: %TRUE if the stream should advertise video support
|
||||
* @seekable: %TRUE if the stream should advertise seekability
|
||||
* @duration: The duration of the stream or 0 if unknown
|
||||
*
|
||||
* Same as gtk_media_stream_set_prepared().
|
||||
*
|
||||
* Deprecated: 4.4: Use [method@Gtk.MediaStream.set_prepared] instead.
|
||||
*/
|
||||
void
|
||||
gtk_media_stream_prepared (GtkMediaStream *self,
|
||||
gboolean has_audio,
|
||||
gboolean has_video,
|
||||
gboolean seekable,
|
||||
gint64 duration)
|
||||
{
|
||||
gtk_media_stream_set_prepared (self, has_audio, has_video, seekable, duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_media_stream_unprepared:
|
||||
* @self: a `GtkMediaStream`
|
||||
*
|
||||
* Same as gtk_media_stream_unset_prepared().
|
||||
*
|
||||
* Deprecated: 4.4: Use [method@Gtk.MediaStream.unset_prepared] instead.
|
||||
*/
|
||||
void
|
||||
gtk_media_stream_unprepared (GtkMediaStream *self)
|
||||
{
|
||||
gtk_media_stream_unset_prepared (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_media_stream_gerror:
|
||||
* @self: a `GtkMediaStream`
|
||||
|
@ -116,15 +116,24 @@ void gtk_media_stream_unrealize (GtkMediaStream
|
||||
GdkSurface *surface);
|
||||
|
||||
/* for implementations only */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_4_FOR(gtk_media_stream_set_prepared)
|
||||
void gtk_media_stream_prepared (GtkMediaStream *self,
|
||||
gboolean has_audio,
|
||||
gboolean has_video,
|
||||
gboolean seekable,
|
||||
gint64 duration);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_4_FOR(gtk_media_stream_unset_prepared)
|
||||
void gtk_media_stream_unprepared (GtkMediaStream *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_media_stream_set_prepared (GtkMediaStream *self,
|
||||
gboolean has_audio,
|
||||
gboolean has_video,
|
||||
gboolean seekable,
|
||||
gint64 duration);
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_media_stream_unset_prepared (GtkMediaStream *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_media_stream_update (GtkMediaStream *self,
|
||||
gint64 timestamp);
|
||||
|
@ -553,13 +553,13 @@ gtk_ff_media_file_open (GtkMediaFile *file)
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_media_stream_prepared (GTK_MEDIA_STREAM (video),
|
||||
FALSE,
|
||||
video->codec_ctx != NULL,
|
||||
TRUE,
|
||||
video->format_ctx->duration != AV_NOPTS_VALUE
|
||||
? av_rescale (video->format_ctx->duration, G_USEC_PER_SEC, AV_TIME_BASE)
|
||||
: 0);
|
||||
gtk_media_stream_set_prepared (GTK_MEDIA_STREAM (video),
|
||||
FALSE,
|
||||
video->codec_ctx != NULL,
|
||||
TRUE,
|
||||
video->format_ctx->duration != AV_NOPTS_VALUE
|
||||
? av_rescale (video->format_ctx->duration, G_USEC_PER_SEC, AV_TIME_BASE)
|
||||
: 0);
|
||||
|
||||
gdk_paintable_invalidate_size (GDK_PAINTABLE (video));
|
||||
|
||||
|
@ -137,11 +137,11 @@ gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self)
|
||||
media_info = gst_player_get_media_info (self->player);
|
||||
if (media_info)
|
||||
{
|
||||
gtk_media_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)));
|
||||
gtk_media_stream_set_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)));
|
||||
|
||||
g_object_unref (media_info);
|
||||
}
|
||||
@ -152,11 +152,11 @@ gtk_gst_media_file_ensure_prepared (GtkGstMediaFile *self)
|
||||
*
|
||||
* Only for seeking we can't do a thing, because with 0 duration we can't seek anywhere.
|
||||
*/
|
||||
gtk_media_stream_prepared (GTK_MEDIA_STREAM (self),
|
||||
TRUE,
|
||||
TRUE,
|
||||
FALSE,
|
||||
0);
|
||||
gtk_media_stream_set_prepared (GTK_MEDIA_STREAM (self),
|
||||
TRUE,
|
||||
TRUE,
|
||||
FALSE,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user