mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
hlsenc: correctly report target duration
This commit is contained in:
parent
b6d7d4efae
commit
7e98956e72
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user