aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-12-21 12:05:46 +0100
committerLuca Barbato <lu_zero@gentoo.org>2012-12-23 12:13:41 +0100
commit7e98956e721ac87c68cd45a8b18ba74e29e1535b (patch)
tree2b3e6f1dbdfb29d586af403138136067cc68d146
parentb6d7d4efae60845a93be6948ef78482bba1fc291 (diff)
downloadffmpeg-7e98956e721ac87c68cd45a8b18ba74e29e1535b.tar.gz
hlsenc: correctly report target duration
-rw-r--r--libavformat/hlsenc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 9d3b46645e..e269358658 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -122,15 +122,21 @@ static int hls_window(AVFormatContext *s, int last)
{
HLSContext *hls = s->priv_data;
ListEntry *en;
+ int target_duration = 0;
int ret = 0;
if ((ret = avio_open2(&hls->pb, s->filename, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0)
goto fail;
+ for (en = hls->list; en; en = en->next) {
+ if (target_duration < en->duration)
+ target_duration = en->duration;
+ }
+
avio_printf(hls->pb, "#EXTM3U\n");
avio_printf(hls->pb, "#EXT-X-VERSION:3\n");
- avio_printf(hls->pb, "#EXT-X-TARGETDURATION:%d\n", (int)hls->time);
+ avio_printf(hls->pb, "#EXT-X-TARGETDURATION:%d\n", target_duration);
avio_printf(hls->pb, "#EXT-X-MEDIA-SEQUENCE:%d\n",
FFMAX(0, hls->number - hls->size));