From 10a9b78d402756c4b553d08e1b10e9a4a48c9db5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 5 Mar 2016 09:47:27 +0200 Subject: [PATCH] player: Add is_live flag to the GstPlayerMediaInfo https://bugzilla.gnome.org/show_bug.cgi?id=763126 --- docs/libs/gst-plugins-bad-libs-sections.txt | 1 + gst-libs/gst/player/gstplayer-media-info-private.h | 2 +- gst-libs/gst/player/gstplayer-media-info.c | 16 ++++++++++++++++ gst-libs/gst/player/gstplayer-media-info.h | 2 ++ gst-libs/gst/player/gstplayer.c | 7 ++++--- win32/common/libgstplayer.def | 1 + 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 922da0f..602dfc1 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -1858,6 +1858,7 @@ gst_player_media_info_get_duration gst_player_media_info_get_title gst_player_media_info_get_container_format gst_player_media_info_is_seekable +gst_player_media_info_is_live gst_player_media_info_get_image_sample gst_player_media_info_get_tags gst_player_media_info_get_stream_list diff --git a/gst-libs/gst/player/gstplayer-media-info-private.h b/gst-libs/gst/player/gstplayer-media-info-private.h index b8757be..c5f6aad 100644 --- a/gst-libs/gst/player/gstplayer-media-info-private.h +++ b/gst-libs/gst/player/gstplayer-media-info-private.h @@ -96,7 +96,7 @@ struct _GstPlayerMediaInfo gchar *uri; gchar *title; gchar *container; - gboolean seekable; + gboolean seekable, is_live; GstTagList *tags; GstSample *image_sample; diff --git a/gst-libs/gst/player/gstplayer-media-info.c b/gst-libs/gst/player/gstplayer-media-info.c index a42b611..3715178 100644 --- a/gst-libs/gst/player/gstplayer-media-info.c +++ b/gst-libs/gst/player/gstplayer-media-info.c @@ -408,6 +408,7 @@ static void gst_player_media_info_init (GstPlayerMediaInfo * info) { info->duration = -1; + info->is_live = FALSE; info->seekable = FALSE; } @@ -556,6 +557,7 @@ gst_player_media_info_copy (GstPlayerMediaInfo * ref) info = gst_player_media_info_new (ref->uri); info->duration = ref->duration; info->seekable = ref->seekable; + info->is_live = ref->is_live; if (ref->tags) info->tags = gst_tag_list_ref (ref->tags); if (ref->title) @@ -642,6 +644,20 @@ gst_player_media_info_is_seekable (const GstPlayerMediaInfo * info) } /** + * gst_player_media_info_is_live: + * @info: a #GstPlayerMediaInfo + * + * Returns: %TRUE if the media is live. + */ +gboolean +gst_player_media_info_is_live (const GstPlayerMediaInfo * info) +{ + g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), FALSE); + + return info->is_live; +} + +/** * gst_player_media_info_get_stream_list: * @info: a #GstPlayerMediaInfo * diff --git a/gst-libs/gst/player/gstplayer-media-info.h b/gst-libs/gst/player/gstplayer-media-info.h index a458b75..7ffd6b4 100644 --- a/gst-libs/gst/player/gstplayer-media-info.h +++ b/gst-libs/gst/player/gstplayer-media-info.h @@ -169,6 +169,8 @@ const gchar* gst_player_media_info_get_uri (const GstPlayerMediaInfo *info); gboolean gst_player_media_info_is_seekable (const GstPlayerMediaInfo *info); +gboolean gst_player_media_info_is_live + (const GstPlayerMediaInfo *info); GstClockTime gst_player_media_info_get_duration (const GstPlayerMediaInfo *info); GList* gst_player_media_info_get_stream_list diff --git a/gst-libs/gst/player/gstplayer.c b/gst-libs/gst/player/gstplayer.c index d50080e..4e06041 100644 --- a/gst-libs/gst/player/gstplayer.c +++ b/gst-libs/gst/player/gstplayer.c @@ -2235,6 +2235,7 @@ gst_player_media_info_create (GstPlayer * self) media_info = gst_player_media_info_new (self->uri); media_info->duration = gst_player_get_duration (self); media_info->tags = self->global_tags; + media_info->is_live = self->is_live; self->global_tags = NULL; query = gst_query_new_seeking (GST_FORMAT_TIME); @@ -2256,10 +2257,10 @@ gst_player_media_info_create (GstPlayer * self) media_info->image_sample = get_from_tags (self, media_info, get_cover_sample); GST_DEBUG_OBJECT (self, "uri: %s title: %s duration: %" GST_TIME_FORMAT - " seekable: %s container: %s image_sample %p", + " seekable: %s live: %s container: %s image_sample %p", media_info->uri, media_info->title, GST_TIME_ARGS (media_info->duration), - media_info->seekable ? "yes" : "no", media_info->container, - media_info->image_sample); + media_info->seekable ? "yes" : "no", media_info->is_live ? "yes" : "no", + media_info->container, media_info->image_sample); GST_DEBUG_OBJECT (self, "end"); return media_info; diff --git a/win32/common/libgstplayer.def b/win32/common/libgstplayer.def index 84d31e7..034f31d 100644 --- a/win32/common/libgstplayer.def +++ b/win32/common/libgstplayer.def @@ -40,6 +40,7 @@ EXPORTS gst_player_media_info_get_title gst_player_media_info_get_type gst_player_media_info_get_uri + gst_player_media_info_is_live gst_player_media_info_is_seekable gst_player_new gst_player_pause -- 2.7.4