On Sat, 6 Oct 2012, Luca Barbato wrote:
---
libavformat/segment.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 8ac04e2..07bb675 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -37,6 +37,7 @@ typedef struct {
AVFormatContext *avf;
char *format; /**< Set by a private option. */
char *list; /**< Set by a private option. */
+ int list_type; /**< Set by a private option. */
float time; /**< Set by a private option. */
int size; /**< Set by a private option. */
int wrap; /**< Set by a private option. */
@@ -48,6 +49,11 @@ typedef struct {
AVIOContext *pb;
} SegmentContext;
+enum {
+ LIST_FLAT,
+ LIST_HLS
+};
+
static int segment_mux_init(AVFormatContext *s)
{
SegmentContext *seg = s->priv_data;
@@ -72,6 +78,17 @@ static int segment_mux_init(AVFormatContext *s)
return 0;
}
+static void segment_hls_header(SegmentContext *seg)
+{
+ avio_printf(seg->pb, "#EXTM3U\n");
+
+ avio_printf(seg->pb, "#EXT-X-VERSION:3\n");
+
+ avio_printf(seg->pb, "#EXT-X-TARGETDURATION:%d\n", (int)seg->time);
+
+ avio_printf(seg->pb, "#EXT-X-MEDIA-SEQUENCE:%d)", seg->number % seg->size);
This doesn't look right. The #EXT-X-MEDIA-SEQUENCE tag indicates the
index in the sequence for the first entry in the list. So as long as you
just add more entries to the end of the list, this value should stay
unchanged - you should increment it only when you remove elements from
the start.
To do this properly for live stuff, you probably also want to change
writing of the playlists to rewrite the full playlist each time, instead
of keeping the playlist file open and just appending one line. And not
empty the playlist when you reach the target size, but just remove the
first element from it.
// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel