gstplayer: Add gst_player_get_state() API
- Add gst_player_get_state() API
https://bugzilla.gnome.org/show_bug.cgi?id=778379
Upstream-Status: Submitted
Signed-off-by: Lyon Wang <lyon.wang@nxp.com>
Conflicts:
gst-libs/gst/player/gstplayer.c
diff --git a/gst-libs/gst/player/gstplayer.c b/gst-libs/gst/player/gstplayer.c
index eb73c96..4d7cf0c 100644
--- a/gst-libs/gst/player/gstplayer.c
+++ b/gst-libs/gst/player/gstplayer.c
@@ -5049,3 +5049,23 @@
return actual_sink;
}
+
+/**
+ * gst_player_get_state:
+ * @player: #GstPlayer instance
+ *
+ * Gets internal GstPlayer state.
+ * It's not guaranteed that the state returned is the current state,
+ * it might've changed in the meantime.
+ *
+ * Returns: (transfer none): internal GstPlayerState
+ *
+ * Since 1.12
+ */
+GstPlayerState
+gst_player_get_state (GstPlayer * self)
+{
+ g_return_val_if_fail (GST_IS_PLAYER (self), GST_PLAYER_STATE_STOPPED);
+
+ return self->app_state;
+}
diff --git a/gst-libs/gst/player/gstplayer.h b/gst-libs/gst/player/gstplayer.h
index 09f457c..ffecc1d 100644
--- a/gst-libs/gst/player/gstplayer.h
+++ b/gst-libs/gst/player/gstplayer.h
@@ -302,6 +302,8 @@
GstElement * gst_player_get_audio_sink (GstPlayer * player);
GstElement * gst_player_get_text_sink (GstPlayer * player);
+GstPlayerState gst_player_get_state (GstPlayer * player);
+
G_END_DECLS
#endif /* __GST_PLAYER_H__ */