From 6e74c8bb4c93f07a83b6e79acfcef467e735abc5 Mon Sep 17 00:00:00 2001 From: Lyon Wang Date: Fri, 17 Feb 2017 17:22:31 +0800 Subject: [PATCH 15/26] 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 Conflicts: gst-libs/gst/player/gstplayer.c --- gst-libs/gst/player/gstplayer.c | 20 ++++++++++++++++++++ gst-libs/gst/player/gstplayer.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/gst-libs/gst/player/gstplayer.c b/gst-libs/gst/player/gstplayer.c index 92ad919..ebad94e 100644 --- a/gst-libs/gst/player/gstplayer.c +++ b/gst-libs/gst/player/gstplayer.c @@ -5042,3 +5042,23 @@ gst_player_get_text_sink (GstPlayer * self) 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 f444918..5ee3592 100644 --- a/gst-libs/gst/player/gstplayer.h +++ b/gst-libs/gst/player/gstplayer.h @@ -228,6 +228,8 @@ gboolean gst_player_set_text_sink (GstPlayer * player, GstElement * text_sink 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__ */ -- 1.9.1