Commit ebd703f0 authored by Stefano Sabatini's avatar Stefano Sabatini

lavf/segment: deprecate "ext" format in favor of "csv"

The new option name is more descriptive.
parent d8157635
...@@ -490,9 +490,9 @@ The following values are recognized: ...@@ -490,9 +490,9 @@ The following values are recognized:
@item flat @item flat
Generate a flat list for the created segments, one segment per line. Generate a flat list for the created segments, one segment per line.
@item ext @item csv, ext
Generate a list for the created segments, one segment per line, Generate a list for the created segments, one segment per line,
each line matching the format: each line matching the format (comma-separated values):
@example @example
@var{segment_filename},@var{segment_start_time},@var{segment_end_time} @var{segment_filename},@var{segment_start_time},@var{segment_end_time}
@end example @end example
...@@ -504,7 +504,11 @@ RFC4180) is applied if required. ...@@ -504,7 +504,11 @@ RFC4180) is applied if required.
@var{segment_start_time} and @var{segment_end_time} specify @var{segment_start_time} and @var{segment_end_time} specify
the segment start and end time expressed in seconds. the segment start and end time expressed in seconds.
A list file with the suffix @code{".ext"} will auto-select this format. A list file with the suffix @code{".csv"} or @code{".ext"} will
auto-select this format.
@code{ext} is deprecated in favor or @code{csv}.
@item m3u8 @item m3u8
Generate an extended M3U8 file, version 4, compliant with Generate an extended M3U8 file, version 4, compliant with
@url{http://tools.ietf.org/id/draft-pantos-http-live-streaming-08.txt}. @url{http://tools.ietf.org/id/draft-pantos-http-live-streaming-08.txt}.
...@@ -559,7 +563,7 @@ ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.list out%03d.nu ...@@ -559,7 +563,7 @@ ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.list out%03d.nu
As the example above, but segment the input file according to the split As the example above, but segment the input file according to the split
points specified by the @var{segment_times} option: points specified by the @var{segment_times} option:
@example @example
ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.ext -segment_times 1,2,3,5,8,13,21 out%03d.nut ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 out%03d.nut
@end example @end example
@item @item
...@@ -569,7 +573,7 @@ with the segment option @var{segment_time_delta} to account for ...@@ -569,7 +573,7 @@ with the segment option @var{segment_time_delta} to account for
possible roundings operated when setting key frame times. possible roundings operated when setting key frame times.
@example @example
ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -vcodec mpeg4 -acodec pcm_s16le -map 0 \ ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -vcodec mpeg4 -acodec pcm_s16le -map 0 \
-f segment -segment_list out.ext -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
@end example @end example
In order to force key frames on the input file, transcoding is In order to force key frames on the input file, transcoding is
required. required.
......
...@@ -39,11 +39,13 @@ ...@@ -39,11 +39,13 @@
typedef enum { typedef enum {
LIST_TYPE_UNDEFINED = -1, LIST_TYPE_UNDEFINED = -1,
LIST_TYPE_FLAT = 0, LIST_TYPE_FLAT = 0,
LIST_TYPE_EXT, LIST_TYPE_CSV,
LIST_TYPE_M3U8, LIST_TYPE_M3U8,
LIST_TYPE_NB, LIST_TYPE_NB,
} ListType; } ListType;
#define LIST_TYPE_EXT LIST_TYPE_CSV
typedef struct { typedef struct {
const AVClass *class; /**< Class for private options. */ const AVClass *class; /**< Class for private options. */
int segment_idx; ///< index of the segment file to write, starting from 0 int segment_idx; ///< index of the segment file to write, starting from 0
...@@ -310,13 +312,16 @@ static int seg_write_header(AVFormatContext *s) ...@@ -310,13 +312,16 @@ static int seg_write_header(AVFormatContext *s)
if (seg->list) { if (seg->list) {
if (seg->list_type == LIST_TYPE_UNDEFINED) { if (seg->list_type == LIST_TYPE_UNDEFINED) {
if (av_match_ext(seg->list, "ext" )) seg->list_type = LIST_TYPE_EXT; if (av_match_ext(seg->list, "csv" )) seg->list_type = LIST_TYPE_CSV;
else if (av_match_ext(seg->list, "ext" )) seg->list_type = LIST_TYPE_EXT;
else if (av_match_ext(seg->list, "m3u8")) seg->list_type = LIST_TYPE_M3U8; else if (av_match_ext(seg->list, "m3u8")) seg->list_type = LIST_TYPE_M3U8;
else seg->list_type = LIST_TYPE_FLAT; else seg->list_type = LIST_TYPE_FLAT;
} }
if ((ret = segment_list_open(s)) < 0) if ((ret = segment_list_open(s)) < 0)
goto fail; goto fail;
} }
if (seg->list_type == LIST_TYPE_EXT)
av_log(s, AV_LOG_WARNING, "'ext' list type option is deprecated in favor of 'csv'\n");
for (i = 0; i< s->nb_streams; i++) for (i = 0; i< s->nb_streams; i++)
seg->has_video += seg->has_video +=
...@@ -445,6 +450,7 @@ static const AVOption options[] = { ...@@ -445,6 +450,7 @@ static const AVOption options[] = {
{ "segment_list_size", "set the maximum number of playlist entries", OFFSET(list_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, E }, { "segment_list_size", "set the maximum number of playlist entries", OFFSET(list_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, E },
{ "segment_list_type", "set the segment list type", OFFSET(list_type), AV_OPT_TYPE_INT, {.dbl = LIST_TYPE_UNDEFINED}, -1, LIST_TYPE_NB-1, E, "list_type" }, { "segment_list_type", "set the segment list type", OFFSET(list_type), AV_OPT_TYPE_INT, {.dbl = LIST_TYPE_UNDEFINED}, -1, LIST_TYPE_NB-1, E, "list_type" },
{ "flat", "flat format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_FLAT }, INT_MIN, INT_MAX, 0, "list_type" }, { "flat", "flat format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_FLAT }, INT_MIN, INT_MAX, 0, "list_type" },
{ "csv", "csv format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_CSV }, INT_MIN, INT_MAX, 0, "list_type" },
{ "ext", "extended format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_EXT }, INT_MIN, INT_MAX, 0, "list_type" }, { "ext", "extended format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_EXT }, INT_MIN, INT_MAX, 0, "list_type" },
{ "m3u8", "M3U8 format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_M3U8 }, INT_MIN, INT_MAX, 0, "list_type" }, { "m3u8", "M3U8 format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_M3U8 }, INT_MIN, INT_MAX, 0, "list_type" },
{ "segment_time", "set segment duration", OFFSET(time_str),AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, { "segment_time", "set segment duration", OFFSET(time_str),AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment