[FFmpeg-devel] [PATCH] lavf/segment: deprecate "ext" format in favor of "csv"
Clément Bœsch
ubitux at gmail.com
Sat Aug 18 11:46:49 CEST 2012
On Thu, Aug 16, 2012 at 06:15:10PM +0200, Stefano Sabatini wrote:
> The new option name is more descriptive.
> ---
> doc/muxers.texi | 13 ++++++++-----
> libavformat/segment.c | 10 ++++++++--
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index fabd23f..0f77bd5 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.
>
> - at item ext
> + at 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}, at var{segment_start_time}, at var{segment_end_time}
> @end example
> @@ -504,7 +504,10 @@ muxer according to the provided pattern, and should not contain the
> @var{segment_start_time} and @var{segment_end_time} specify
> the segment start and end time expressed in seconds.
>
> -A list file with suffix @code{".ext"} will auto-select this format.
> +A list file with suffix @code{".csv"} or @code{".ext"} will
> +auto-select this format.
> +
> + at 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 +562,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 +572,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 db96a41..23f3337 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
> @@ -285,13 +287,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 +=
> @@ -420,6 +425,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 },
Why not, but I'm not sure the CSV in this context really is following the
rfc4180 users might expect...
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120818/ff5ac4fd/attachment.asc>
More information about the ffmpeg-devel
mailing list