[FFmpeg-devel] [PATCH] remove the hls_wrap option
Steven Liu
lingjiujianke at gmail.com
Sat Mar 26 23:42:38 CET 2016
2016-03-27 2:42 GMT+08:00 Bodecs Bela <bodecsb at vivanet.hu>:
>
>
> 2016.03.26. 15:10 keltezéssel, Steven Liu írta:
>
>> Because the hls_flags use delete_segments flag can delete the old
>>
>> segment files and instead of the hls_wrap option, so remove it.
>>
>> I suggest to leave hls_wrap option to be available. If you use this
> option, the set of output file names is the same as the value of hls_wrap,
> so it depends on you and sometimes it is very convinent. Mainly when you
> use ffmpeg in scripting environment.
>
> There have a problem:
There are 3 segment files in playlist,set hls_time 2,and the keyframe is
not uniform:
test-0.ts
test-1.ts
test-2.ts
It's dangerous when refreshing the segment files for player.
There are repeated or jump segments problem.
Signed-off-by: LiuQi <liuqi at gosun.com>
>>
>> ---
>>
>> doc/muxers.texi | 9 ---------
>>
>> libavformat/hlsenc.c | 8 +++-----
>>
>> 2 files changed, 3 insertions(+), 14 deletions(-)
>>
>>
>> diff --git a/doc/muxers.texi b/doc/muxers.texi
>>
>> index c36c72c..4dabfd1 100644
>>
>> --- a/doc/muxers.texi
>>
>> +++ b/doc/muxers.texi
>>
>> @@ -284,15 +284,6 @@ Set output format options using a :-separated list of
>> key=value
>>
>> parameters. Values containing @code{:} special characters must be
>>
>> escaped.
>>
>>
>>
>> - at item hls_wrap @var{wrap}
>>
>> -Set the number after which the segment filename number (the number
>>
>> -specified in each segment file) wraps. If set to 0 the number will be
>>
>> -never wrapped. Default value is 0.
>>
>> -
>>
>> -This option is useful to avoid to fill the disk with many segment
>>
>> -files, and limits the maximum number of segment files written to disk
>>
>> -to @var{wrap}.
>>
>> -
>>
>> @item start_number @var{number}
>>
>> Start the playlist sequence number from @var{number}. Default value is
>>
>> 0.
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>
>> index fd36b21..a22543a 100644
>>
>> --- a/libavformat/hlsenc.c
>>
>> +++ b/libavformat/hlsenc.c
>>
>> @@ -84,7 +84,6 @@ typedef struct HLSContext {
>>
>>
>>
>> float time; // Set by a private option.
>>
>> int max_nb_segments; // Set by a private option.
>>
>> - int wrap; // Set by a private option.
>>
>> uint32_t flags; // enum HLSFlags
>>
>> uint32_t pl_type; // enum PlaylistType
>>
>> char *segment_filename;
>>
>> @@ -373,7 +372,7 @@ static int hls_append_segment(struct AVFormatContext
>> *s, HLSContext *hls, double
>>
>> en = hls->segments;
>>
>> hls->segments = en->next;
>>
>> if (en && hls->flags & HLS_DELETE_SEGMENTS &&
>>
>> - !(hls->flags & HLS_SINGLE_FILE || hls->wrap)) {
>>
>> + !(hls->flags & HLS_SINGLE_FILE)) {
>>
>> en->next = hls->old_segments;
>>
>> hls->old_segments = en;
>>
>> if ((ret = hls_delete_old_segments(hls)) < 0)
>>
>> @@ -561,13 +560,13 @@ static int hls_start(AVFormatContext *s)
>>
>> av_free(fn_copy);
>>
>> }
>>
>> } else if (av_get_frame_filename(oc->filename,
>> sizeof(oc->filename),
>>
>> - c->basename, c->wrap ? c->sequence %
>> c->wrap : c->sequence) < 0) {
>>
>> + c->basename, c->sequence) < 0) {
>>
>> av_log(oc, AV_LOG_ERROR, "Invalid segment filename template
>> '%s' you can try use -use_localtime 1 with it\n", c->basename);
>>
>> return AVERROR(EINVAL);
>>
>> }
>>
>> if( c->vtt_basename) {
>>
>> if (av_get_frame_filename(vtt_oc->filename,
>> sizeof(vtt_oc->filename),
>>
>> - c->vtt_basename, c->wrap ? c->sequence %
>> c->wrap : c->sequence) < 0) {
>>
>> + c->vtt_basename, c->sequence) < 0) {
>>
>> av_log(vtt_oc, AV_LOG_ERROR, "Invalid segment filename
>> template '%s'\n", c->vtt_basename);
>>
>> return AVERROR(EINVAL);
>>
>> }
>>
>> @@ -911,7 +910,6 @@ static const AVOption options[] = {
>>
>> {"hls_list_size", "set maximum number of playlist entries",
>> OFFSET(max_nb_segments), AV_OPT_TYPE_INT, {.i64 = 5}, 0,
>> INT_MAX,
>> E},
>>
>> {"hls_ts_options","set hls mpegts list of options for the container
>> format used for hls", OFFSET(format_options_str), AV_OPT_TYPE_STRING,
>> {.str
>> = NULL}, 0, 0, E},
>>
>> {"hls_vtt_options","set hls vtt list of options for the container
>> format used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING,
>> {.str = NULL}, 0, 0, E},
>>
>> - {"hls_wrap", "set number after which the index wraps",
>> OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E},
>>
>> {"hls_allow_cache", "explicitly set whether the client MAY (1) or
>> MUST
>> NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64
>> =
>> -1}, INT_MIN, INT_MAX, E},
>>
>> {"hls_base_url", "url to prepend to each playlist entry",
>> OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E},
>>
>> {"hls_segment_filename", "filename template for segment files",
>> OFFSET(segment_filename), AV_OPT_TYPE_STRING, {.str = NULL},
>> 0, 0, E},
>>
>>
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> bb
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list