Add more media docs
authorMatthias Clasen <mclasen@redhat.com>
Sun, 6 May 2018 19:37:13 +0000 (15:37 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 6 May 2018 19:57:10 +0000 (15:57 -0400)
docs/reference/gtk/gtk4-sections.txt
gtk/gtkmediacontrols.c
gtk/gtkmediafile.c
gtk/gtkmediastream.c
gtk/gtkvideo.c

index c3caa92f489e9a3f148b1c15b39869bdc4da6b6a..7a7a593525900e1d6c40ddcff1fc5a7076786639 100644 (file)
@@ -6875,6 +6875,17 @@ gtk_media_stream_set_volume
 gtk_media_stream_realize
 gtk_media_stream_unrealize
 
+<SUBSECTION>
+gtk_media_stream_prepared
+gtk_media_stream_unprepared
+gtk_media_stream_update
+gtk_media_stream_ended
+gtk_media_stream_seek_success
+gtk_media_stream_seek_failed
+gtk_media_stream_gerror
+gtk_media_stream_error
+gtk_media_stream_error_valist
+
 <SUBSECTION Private>
 GTK_TYPE_MEDIA_STREAM
 gtk_media_stream_get_type
index 38a9bbbf23ccbf32e7acaa233f5241e2dca2e95a..22d1852b481f11e5ad97d32d4a1fa8d164d75b65 100644 (file)
@@ -30,6 +30,7 @@
  * SECTION:gtkmediacontrols
  * @title: GtkMediaControls
  * @short_description: A widget showing controls for a media stream
+ * @see_also: #GtkVideo
  *
  * GtkMediaControls is a widget to show controls for a #GtkMediaStream
  * and giving users a way to use it.
@@ -464,6 +465,13 @@ gtk_media_controls_notify_cb (GtkMediaStream   *stream,
     update_volume (controls);
 }
 
+/**
+ * gtk_media_controls_set_media_stream:
+ * @controls: a #GtkMediaControls widget
+ * @stream: (nullable):  a #GtkMediaStream, or %NULL
+ *
+ * Sets the stream that is controlled by @controls.
+ */
 void
 gtk_media_controls_set_media_stream (GtkMediaControls *controls,
                                      GtkMediaStream   *stream)
index 7c3f30f929d5ff430e474af3fb93fc56e7fc8f06..bc050eedfb4bd3484e459bd116628438f536caad 100644 (file)
  * SECTION:gtkmediafile
  * @Short_description: Open media files for use in GTK
  * @Title: GtkMediaFile
- * @See_also: #GtkMediaStream
+ * @See_also: #GtkMediaStream, #GtkVideo
  *
  * #GtkMediaFile is the implementation for media file usage with #GtkMediaStream.
  *
  * This provides a simple way to play back video files with GTK.
+ *
+ * GTK+ provides a GIO extension point for #GtkMediaFile implementations
+ * to allow for external implementations using various media frameworks.
+ * GTK+ itself includes implementations using GStreamer and ffmpeg.
  */
 
 typedef struct _GtkMediaFilePrivate GtkMediaFilePrivate;
index 9153c700c603863920940cbf8d4495af8745f339..d36dde593e00fae0b7d76f3ca7f91cf00fee5af5 100644 (file)
  *
  * #GtkMediaStream is the integration point for media playback inside GTK.
  *
- * FIXME: Write more about how frameworks should implement this thing and how
- * GTK widgets exist (once they do) that consume it.
+ * Apart from application-facing API for stream playback, #GtkMediaStream
+ * has a number of APIs that are only useful for implementations and should
+ * not be used in applications:
+ * gtk_media_stream_prepared(),
+ * gtk_media_stream_unprepared(),
+ * gtk_media_stream_update(),
+ * gtk_media_stream_ended(),
+ * gtk_media_stream_seek_success(),
+ * gtk_media_stream_seek_failed(),
+ * gtk_media_stream_gerror(),
+ * gtk_media_stream_error(),
+ * gtk_media_stream_error_valist().
  */
 
 typedef struct _GtkMediaStreamPrivate GtkMediaStreamPrivate;
@@ -448,6 +458,15 @@ gtk_media_stream_init (GtkMediaStream *self)
   priv->volume = 1.0;
 }
 
+/**
+ * gtk_media_stream_is_prepared:
+ * @self: a #GtkMediaStream
+ *
+ * Returns whether the stream has finished initializing and existence of
+ * audio and video is known.
+ *
+ * Returns: %TRUE if the stream is prepared
+ */
 gboolean
 gtk_media_stream_is_prepared (GtkMediaStream *self)
 {
@@ -458,6 +477,14 @@ gtk_media_stream_is_prepared (GtkMediaStream *self)
   return priv->prepared;
 }
 
+/**
+ * gtk_media_stream_has_audio:
+ * @self: a #GtkMediaStream
+ *
+ * Returns whether the stream has audio.
+ *
+ * Returns: %TRUe if the stream has audio
+ */
 gboolean
 gtk_media_stream_has_audio (GtkMediaStream *self)
 {
@@ -468,6 +495,14 @@ gtk_media_stream_has_audio (GtkMediaStream *self)
   return priv->has_audio;
 }
 
+/**
+ * gtk_media_stream_has_video:
+ * @self: a #GtkMediaStream
+ *
+ * Returns whether the stream has video.
+ *
+ * Returns: %TRUe if the stream has video 
+ */
 gboolean
 gtk_media_stream_has_video (GtkMediaStream *self)
 {
@@ -478,6 +513,13 @@ gtk_media_stream_has_video (GtkMediaStream *self)
   return priv->has_video;
 }
 
+/**
+ * gtk_media_stream_play:
+ * @self: a #GtkMediaStream
+ *
+ * Starts playing the stream. If the stream
+ * is in error or already playing, do nothing.
+ */
 void
 gtk_media_stream_play (GtkMediaStream *self)
 {
@@ -508,6 +550,13 @@ gtk_media_stream_play (GtkMediaStream *self)
     }
 }
 
+/**
+ * gtk_media_stream_pause:
+ * @self: a #GtkMediaStream
+ *
+ * Pauses playback of the stream. If the stream
+ * is not playing, do nothing.
+ */
 void
 gtk_media_stream_pause (GtkMediaStream *self)
 {
@@ -527,6 +576,14 @@ gtk_media_stream_pause (GtkMediaStream *self)
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PLAYING]);
 }
 
+/**
+ * gtk_media_stream_get_playing:
+ * @self: a #GtkMediaStream
+ *
+ * Return whether the stream is currently playing.
+ *
+ * Returns: %TRUE if the stream is playing
+ */
 gboolean
 gtk_media_stream_get_playing (GtkMediaStream *self)
 {
@@ -537,6 +594,13 @@ gtk_media_stream_get_playing (GtkMediaStream *self)
   return priv->playing;
 }
 
+/**
+ * gtk_media_stream_set_playing:
+ * @self: a #GtkMediaStream
+ * @playing: whether to start or pause playback
+ *
+ * Starts or pauses playback of the stream.
+ */
 void
 gtk_media_stream_set_playing (GtkMediaStream *self,
                               gboolean        playing)
@@ -549,6 +613,14 @@ gtk_media_stream_set_playing (GtkMediaStream *self,
     gtk_media_stream_pause (self);
 }
 
+/**
+ * gtk_medai_stream_get_ended:
+ * @self: a #GtkMediaStream
+ *
+ * Returns whether the streams playback is finished.
+ *
+ * Return: %TRUE if playback is finished
+ */
 gboolean
 gtk_media_stream_get_ended (GtkMediaStream *self)
 {
@@ -559,6 +631,14 @@ gtk_media_stream_get_ended (GtkMediaStream *self)
   return priv->ended;
 }
 
+/**
+ * gtk_media_stream_get_timestamp:
+ * @self: a #GtkMediaStream
+ *
+ * Returns the current presentation timestamp in microseconds.
+ *
+ * Return: the timestamp in microseconds
+ */
 gint64
 gtk_media_stream_get_timestamp (GtkMediaStream *self)
 {
index 8b12bf1f15bc4dca3f2657cc9606d658249369ac..3756d03bac37772de28281fc9656b8e1f16610ac 100644 (file)
  * SECTION:gtkvideo
  * @title: GtkVideo
  * @short_description: A widget for displaying video
+ * @see_also: #GtkMediaControls
  *
  * GtkVideo is a widget to show a #GtkMediaStream.
+ *
+ * It is commonly combined with #GtkMediaControls to give the
+ * user a way to control the playback.
  */
 
 struct _GtkVideo