player: Add is_live flag to the GstPlayerMediaInfo

https://bugzilla.gnome.org/show_bug.cgi?id=763126
This commit is contained in:
Sebastian Dröge 2016-03-05 09:47:27 +02:00
parent b53f682d75
commit 10a9b78d40
6 changed files with 25 additions and 4 deletions

View file

@ -1858,6 +1858,7 @@ gst_player_media_info_get_duration
gst_player_media_info_get_title gst_player_media_info_get_title
gst_player_media_info_get_container_format gst_player_media_info_get_container_format
gst_player_media_info_is_seekable gst_player_media_info_is_seekable
gst_player_media_info_is_live
gst_player_media_info_get_image_sample gst_player_media_info_get_image_sample
gst_player_media_info_get_tags gst_player_media_info_get_tags
gst_player_media_info_get_stream_list gst_player_media_info_get_stream_list

View file

@ -96,7 +96,7 @@ struct _GstPlayerMediaInfo
gchar *uri; gchar *uri;
gchar *title; gchar *title;
gchar *container; gchar *container;
gboolean seekable; gboolean seekable, is_live;
GstTagList *tags; GstTagList *tags;
GstSample *image_sample; GstSample *image_sample;

View file

@ -408,6 +408,7 @@ static void
gst_player_media_info_init (GstPlayerMediaInfo * info) gst_player_media_info_init (GstPlayerMediaInfo * info)
{ {
info->duration = -1; info->duration = -1;
info->is_live = FALSE;
info->seekable = FALSE; info->seekable = FALSE;
} }
@ -556,6 +557,7 @@ gst_player_media_info_copy (GstPlayerMediaInfo * ref)
info = gst_player_media_info_new (ref->uri); info = gst_player_media_info_new (ref->uri);
info->duration = ref->duration; info->duration = ref->duration;
info->seekable = ref->seekable; info->seekable = ref->seekable;
info->is_live = ref->is_live;
if (ref->tags) if (ref->tags)
info->tags = gst_tag_list_ref (ref->tags); info->tags = gst_tag_list_ref (ref->tags);
if (ref->title) if (ref->title)
@ -641,6 +643,20 @@ gst_player_media_info_is_seekable (const GstPlayerMediaInfo * info)
return info->seekable; return info->seekable;
} }
/**
* 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: * gst_player_media_info_get_stream_list:
* @info: a #GstPlayerMediaInfo * @info: a #GstPlayerMediaInfo

View file

@ -169,6 +169,8 @@ const gchar* gst_player_media_info_get_uri
(const GstPlayerMediaInfo *info); (const GstPlayerMediaInfo *info);
gboolean gst_player_media_info_is_seekable gboolean gst_player_media_info_is_seekable
(const GstPlayerMediaInfo *info); (const GstPlayerMediaInfo *info);
gboolean gst_player_media_info_is_live
(const GstPlayerMediaInfo *info);
GstClockTime gst_player_media_info_get_duration GstClockTime gst_player_media_info_get_duration
(const GstPlayerMediaInfo *info); (const GstPlayerMediaInfo *info);
GList* gst_player_media_info_get_stream_list GList* gst_player_media_info_get_stream_list

View file

@ -2235,6 +2235,7 @@ gst_player_media_info_create (GstPlayer * self)
media_info = gst_player_media_info_new (self->uri); media_info = gst_player_media_info_new (self->uri);
media_info->duration = gst_player_get_duration (self); media_info->duration = gst_player_get_duration (self);
media_info->tags = self->global_tags; media_info->tags = self->global_tags;
media_info->is_live = self->is_live;
self->global_tags = NULL; self->global_tags = NULL;
query = gst_query_new_seeking (GST_FORMAT_TIME); 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); 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 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->uri, media_info->title, GST_TIME_ARGS (media_info->duration),
media_info->seekable ? "yes" : "no", media_info->container, media_info->seekable ? "yes" : "no", media_info->is_live ? "yes" : "no",
media_info->image_sample); media_info->container, media_info->image_sample);
GST_DEBUG_OBJECT (self, "end"); GST_DEBUG_OBJECT (self, "end");
return media_info; return media_info;

View file

@ -40,6 +40,7 @@ EXPORTS
gst_player_media_info_get_title gst_player_media_info_get_title
gst_player_media_info_get_type gst_player_media_info_get_type
gst_player_media_info_get_uri gst_player_media_info_get_uri
gst_player_media_info_is_live
gst_player_media_info_is_seekable gst_player_media_info_is_seekable
gst_player_new gst_player_new
gst_player_pause gst_player_pause