From ebd703f0a0222270f421d0a0b3abebd51dc986b3 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 16 Aug 2012 18:13:17 +0200 Subject: [PATCH] lavf/segment: deprecate "ext" format in favor of "csv" The new option name is more descriptive. --- doc/muxers.texi | 14 +++++++++----- libavformat/segment.c | 10 ++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index df8763b2498..24ffc7c8eea 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -490,9 +490,9 @@ The following values are recognized: @item flat 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, -each line matching the format: +each line matching the format (comma-separated values): @example @var{segment_filename},@var{segment_start_time},@var{segment_end_time} @end example @@ -504,7 +504,11 @@ RFC4180) is applied if required. @var{segment_start_time} and @var{segment_end_time} specify 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 Generate an extended M3U8 file, version 4, compliant with @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 As the example above, but segment the input file according to the split points specified by the @var{segment_times} option: @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 @item @@ -569,7 +573,7 @@ with the segment option @var{segment_time_delta} to account for possible roundings operated when setting key frame times. @example 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 In order to force key frames on the input file, transcoding is required. diff --git a/libavformat/segment.c b/libavformat/segment.c index ecd4ae86946..fe4adddd7f1 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -39,11 +39,13 @@ typedef enum { LIST_TYPE_UNDEFINED = -1, LIST_TYPE_FLAT = 0, - LIST_TYPE_EXT, + LIST_TYPE_CSV, LIST_TYPE_M3U8, LIST_TYPE_NB, } ListType; +#define LIST_TYPE_EXT LIST_TYPE_CSV + typedef struct { const AVClass *class; /**< Class for private options. */ int segment_idx; ///< index of the segment file to write, starting from 0 @@ -310,13 +312,16 @@ static int seg_write_header(AVFormatContext *s) if (seg->list) { 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 seg->list_type = LIST_TYPE_FLAT; } if ((ret = segment_list_open(s)) < 0) 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++) seg->has_video += @@ -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_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" }, + { "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" }, { "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 }, -- 2.39.2