[FFmpeg-cvslog] avformat/hlsenc: Add hls flag for starting a playlist with a discontinuity on startup
MrBoogs
git at videolan.org
Sun May 17 17:23:39 CEST 2015
ffmpeg | branch: master | MrBoogs <blendz at shaw.ca> | Tue Apr 21 15:52:03 2015 -0600| [572a8292cbded93c64110b872d2a8abadc92b741] | committer: Michael Niedermayer
avformat/hlsenc: Add hls flag for starting a playlist with a discontinuity on startup
Reviewed-by: Thomas Volkert <silvo at gmx.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=572a8292cbded93c64110b872d2a8abadc92b741
---
libavformat/hlsenc.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index dcb718a..f23a891 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -51,6 +51,7 @@ typedef enum HLSFlags {
HLS_SINGLE_FILE = (1 << 0),
HLS_DELETE_SEGMENTS = (1 << 1),
HLS_ROUND_DURATIONS = (1 << 2),
+ HLS_DISCONT_START = (1 << 3),
} HLSFlags;
typedef struct HLSContext {
@@ -77,6 +78,7 @@ typedef struct HLSContext {
int64_t start_pos; // last segment starting position
int64_t size; // last segment size
int nb_entries;
+ int discontinuity_set;
HLSSegment *segments;
HLSSegment *last_segment;
@@ -263,6 +265,7 @@ static int hls_window(AVFormatContext *s, int last)
target_duration = ceil(en->duration);
}
+ hls->discontinuity_set = 0;
avio_printf(out, "#EXTM3U\n");
avio_printf(out, "#EXT-X-VERSION:%d\n", version);
if (hls->allowcache == 0 || hls->allowcache == 1) {
@@ -273,7 +276,10 @@ static int hls_window(AVFormatContext *s, int last)
av_log(s, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n",
sequence);
-
+ if((hls->flags & HLS_DISCONT_START) && sequence==hls->start_sequence && hls->discontinuity_set==0 ){
+ avio_printf(out, "#EXT-X-DISCONTINUITY\n");
+ hls->discontinuity_set = 1;
+ }
for (en = hls->segments; en; en = en->next) {
if (hls->flags & HLS_ROUND_DURATIONS)
avio_printf(out, "#EXTINF:%d,\n", (int)round(en->duration));
@@ -517,7 +523,7 @@ static const AVOption options[] = {
{"single_file", "generate a single media file indexed with byte ranges", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SINGLE_FILE }, 0, UINT_MAX, E, "flags"},
{"delete_segments", "delete segment files that are no longer part of the playlist", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_DELETE_SEGMENTS }, 0, UINT_MAX, E, "flags"},
{"round_durations", "round durations in m3u8 to whole numbers", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_ROUND_DURATIONS }, 0, UINT_MAX, E, "flags"},
-
+ {"discont_start", "start the playlist with a discontinuity tag", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_DISCONT_START }, 0, UINT_MAX, E, "flags"},
{ NULL },
};
More information about the ffmpeg-cvslog
mailing list