[gtk/media-stream-name-collision] mediastream: Rename an api to avoid name collisions
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/media-stream-name-collision] mediastream: Rename an api to avoid name collisions
- Date: Mon, 14 Jun 2021 11:50:24 +0000 (UTC)
commit 86b5dba43b7c471e496242e542ff772c91bf763b
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 14 07:25:06 2021 -0400
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
demos/gtk-demo/paintable_mediastream.c | 10 +++---
gtk/gtkmediafile.c | 2 +-
gtk/gtkmediastream.c | 56 +++++++++++++++++++++++++++++-----
gtk/gtkmediastream.h | 13 ++++++--
modules/media/gtkffmediafile.c | 14 ++++-----
modules/media/gtkgstmediafile.c | 20 ++++++------
6 files changed, 82 insertions(+), 33 deletions(-)
---
diff --git a/demos/gtk-demo/paintable_mediastream.c b/demos/gtk-demo/paintable_mediastream.c
index ea1b374b76..c7c699509e 100644
--- a/demos/gtk-demo/paintable_mediastream.c
+++ b/demos/gtk-demo/paintable_mediastream.c
@@ -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. */
diff --git a/gtk/gtkmediafile.c b/gtk/gtkmediafile.c
index 96e8c84731..53b4e5b3fc 100644
--- a/gtk/gtkmediafile.c
+++ b/gtk/gtkmediafile.c
@@ -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
diff --git a/gtk/gtkmediastream.c b/gtk/gtkmediastream.c
index 1b3d1c1115..66f0a06489 100644
--- a/gtk/gtkmediastream.c
+++ b/gtk/gtkmediastream.c
@@ -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`
diff --git a/gtk/gtkmediastream.h b/gtk/gtkmediastream.h
index 8c5a0c47c8..f4ed91f15e 100644
--- a/gtk/gtkmediastream.h
+++ b/gtk/gtkmediastream.h
@@ -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);
diff --git a/modules/media/gtkffmediafile.c b/modules/media/gtkffmediafile.c
index 9df9e6556f..b6b703db87 100644
--- a/modules/media/gtkffmediafile.c
+++ b/modules/media/gtkffmediafile.c
@@ -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));
diff --git a/modules/media/gtkgstmediafile.c b/modules/media/gtkgstmediafile.c
index d64fe660b5..e607aa1aa8 100644
--- a/modules/media/gtkgstmediafile.c
+++ b/modules/media/gtkgstmediafile.c
@@ -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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]