History

avformat/hlsenc: Use HLS version 2 if rounded durations are enabled

This allows for wider compatibility with older devices, such as those running iOS 3. The only difference between HLS version 2 and version 3 is that version 3 supports non-integer EXTINF values, and as such, we can default to version 2 if we're using whole-integer EXTINFs anyways, when `-hls_flags round_durations` is set. As this code seems to otherwise consistently use the lowest compatible version, this seems to fit in properly with existing behavior. Testing confirms with that this patch, HLS output can work all the way back to iOS 3.

Lucy committed 4 years ago

Commit 1af36981 parent 900424c2 files · +7 −1Browse files

Unified · Split

2 files
  1. doc/muxers.texi +2 −0
  2. libavformat/hlsenc.c +5 −1
doc/muxers.texi+2−0
@@ -1060,6 +1060,8 @@ and remove the @code{#EXT-X-ENDLIST} from the old segment list. · 1059 unmodified lines
1060@item round_durations1060@item round_durations
1061Round the duration info in the playlist file segment info to integer1061Round the duration info in the playlist file segment info to integer
1062values, instead of using floating point.1062values, instead of using floating point.
1063If there are no other features requiring higher HLS versions be used,
1064then this will allow ffmpeg to output a HLS version 2 m3u8.
1063 1065
1064@item discont_start1066@item discont_start
1065Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the1067Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the
libavformat/hlsenc.c+5−1
@@ -1550,7 +1550,11 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) · 1549 unmodified lines
1550 double *prog_date_time_p = (hls->flags & HLS_PROGRAM_DATE_TIME) ? &prog_date_time : NULL;1550 double *prog_date_time_p = (hls->flags & HLS_PROGRAM_DATE_TIME) ? &prog_date_time : NULL;
1551 int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);1551 int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
1552 1552
1553 hls->version = 3;1553 hls->version = 2;
1554 if (!(hls->flags & HLS_ROUND_DURATIONS)) {
1555 hls->version = 3;
1556 }
1557
1554 if (byterange_mode) {1558 if (byterange_mode) {
1555 hls->version = 4;1559 hls->version = 4;
1556 sequence = 0;1560 sequence = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t