From 66f7b4862fe9fd1828a6729df5d04a499af227db Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 24 Dec 2012 00:08:35 +0100 Subject: hlsenc: use the basename to generate the list entries The segment path is desumed from the playlist path, recording a relative path in the playlist while serving the file could lead to misleading results. --- libavformat/hlsenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libavformat/hlsenc.c') diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index eade740..418c87d 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -85,7 +85,8 @@ static int append_entry(HLSContext *hls, uint64_t duration) if (!en) return AVERROR(ENOMEM); - av_get_frame_filename(en->name, sizeof(en->name), hls->basename, + av_get_frame_filename(en->name, sizeof(en->name), + av_basename(hls->basename), hls->number -1); en->duration = duration; -- cgit v1.1 From 6dd93ee6f1b050ad7c4b247899e83efa293ee405 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 25 Dec 2012 08:59:38 +0100 Subject: hlsenc: check append_entry return value --- libavformat/hlsenc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libavformat/hlsenc.c') diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 418c87d..e039687 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -259,9 +259,12 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) av_compare_ts(pkt->pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0 && pkt->flags & AV_PKT_FLAG_KEY) { - append_entry(hls, av_rescale(pkt->pts - hls->end_pts, - st->time_base.num, - st->time_base.den)); + ret = append_entry(hls, av_rescale(pkt->pts - hls->end_pts, + st->time_base.num, + st->time_base.den)); + if (ret) + return ret; + hls->end_pts = pkt->pts; av_write_frame(oc, NULL); /* Flush any buffered data */ -- cgit v1.1