diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-09-28 12:36:55 -0400 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2012-10-29 13:28:05 +0000 |
commit | c676ef34230a915b329720b56a9047927a3f40e6 (patch) | |
tree | e293c35832c3fd8931cce6865bc4ed8f83691911 | |
parent | 0796583f5977c74d6e9b97f4735acb76b9a4b875 (diff) |
hlssink: add a playlist-length propertyhlssink-fixes
-rw-r--r-- | gst/hls/gsthlssink.c | 20 | ||||
-rw-r--r-- | gst/hls/gsthlssink.h | 1 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gst/hls/gsthlssink.c b/gst/hls/gsthlssink.c index 9c7c1d217..aaf4e08b7 100644 --- a/gst/hls/gsthlssink.c +++ b/gst/hls/gsthlssink.c @@ -37,6 +37,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_hls_sink_debug); #define DEFAULT_PLAYLIST_ROOT NULL #define DEFAULT_MAX_FILES 10 #define DEFAULT_TARGET_DURATION 15 +#define DEFAULT_PLAYLIST_LENGTH 5 enum { @@ -45,7 +46,8 @@ enum PROP_PLAYLIST_LOCATION, PROP_PLAYLIST_ROOT, PROP_MAX_FILES, - PROP_TARGET_DURATION + PROP_TARGET_DURATION, + PROP_PLAYLIST_LENGTH }; static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", @@ -149,6 +151,12 @@ gst_hls_sink_class_init (GstHlsSinkClass * klass) "streaming server)", 0, G_MAXUINT, DEFAULT_TARGET_DURATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_PLAYLIST_LENGTH, + g_param_spec_uint ("playlist-length", "Playlist length", + "Length of HLS playlist. To allow players to conform to section 6.3.3 " + "of the HLS specification, this should be at least 3.", + 1, G_MAXUINT, DEFAULT_PLAYLIST_LENGTH, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } static void @@ -158,7 +166,7 @@ gst_hls_sink_reset (GstHlsSink * sink) sink->multifilesink = NULL; sink->last_stream_time = 0; - sink->playlist = gst_m3u8_playlist_new (6, 5, FALSE); + sink->playlist = gst_m3u8_playlist_new (6, sink->playlist_length, FALSE); } static void @@ -174,6 +182,7 @@ gst_hls_sink_init (GstHlsSink * sink, GstHlsSinkClass * sink_class) sink->location = g_strdup (DEFAULT_LOCATION); sink->playlist_location = g_strdup (DEFAULT_PLAYLIST_LOCATION); sink->playlist_root = g_strdup (DEFAULT_PLAYLIST_ROOT); + sink->playlist_length = DEFAULT_PLAYLIST_LENGTH; sink->max_files = DEFAULT_MAX_FILES; sink->target_duration = DEFAULT_TARGET_DURATION; sink->count = 0; @@ -368,6 +377,10 @@ gst_hls_sink_set_property (GObject * object, guint prop_id, case PROP_TARGET_DURATION: sink->target_duration = g_value_get_uint (value); break; + case PROP_PLAYLIST_LENGTH: + sink->playlist_length = g_value_get_uint (value); + sink->playlist->window_size = sink->playlist_length; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -396,6 +409,9 @@ gst_hls_sink_get_property (GObject * object, guint prop_id, case PROP_TARGET_DURATION: g_value_set_uint (value, sink->target_duration); break; + case PROP_PLAYLIST_LENGTH: + g_value_set_uint (value, sink->playlist_length); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/gst/hls/gsthlssink.h b/gst/hls/gsthlssink.h index e678e0c73..a40586740 100644 --- a/gst/hls/gsthlssink.h +++ b/gst/hls/gsthlssink.h @@ -47,6 +47,7 @@ struct _GstHlsSink gchar *location; gchar *playlist_location; gchar *playlist_root; + guint playlist_length; GstM3U8Playlist *playlist; guint index; gint max_files; |