Browse code

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

The new option name is more descriptive.

Stefano Sabatini authored on 2012/08/17 01:13:17
Showing 2 changed files
... ...
@@ -490,9 +490,9 @@ The following values are recognized:
490 490
 @item flat
491 491
 Generate a flat list for the created segments, one segment per line.
492 492
 
493
-@item ext
493
+@item csv, ext
494 494
 Generate a list for the created segments, one segment per line,
495
-each line matching the format:
495
+each line matching the format (comma-separated values):
496 496
 @example
497 497
 @var{segment_filename},@var{segment_start_time},@var{segment_end_time}
498 498
 @end example
... ...
@@ -504,7 +504,11 @@ RFC4180) is applied if required.
504 504
 @var{segment_start_time} and @var{segment_end_time} specify
505 505
 the segment start and end time expressed in seconds.
506 506
 
507
-A list file with the suffix @code{".ext"} will auto-select this format.
507
+A list file with the suffix @code{".csv"} or @code{".ext"} will
508
+auto-select this format.
509
+
510
+@code{ext} is deprecated in favor or @code{csv}.
511
+
508 512
 @item m3u8
509 513
 Generate an extended M3U8 file, version 4, compliant with
510 514
 @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 559
 As the example above, but segment the input file according to the split
560 560
 points specified by the @var{segment_times} option:
561 561
 @example
562
-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
562
+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
563 563
 @end example
564 564
 
565 565
 @item
... ...
@@ -569,7 +573,7 @@ with the segment option @var{segment_time_delta} to account for
569 569
 possible roundings operated when setting key frame times.
570 570
 @example
571 571
 ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -vcodec mpeg4 -acodec pcm_s16le -map 0 \
572
--f segment -segment_list out.ext -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
572
+-f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
573 573
 @end example
574 574
 In order to force key frames on the input file, transcoding is
575 575
 required.
... ...
@@ -39,11 +39,13 @@
39 39
 typedef enum {
40 40
     LIST_TYPE_UNDEFINED = -1,
41 41
     LIST_TYPE_FLAT = 0,
42
-    LIST_TYPE_EXT,
42
+    LIST_TYPE_CSV,
43 43
     LIST_TYPE_M3U8,
44 44
     LIST_TYPE_NB,
45 45
 } ListType;
46 46
 
47
+#define LIST_TYPE_EXT LIST_TYPE_CSV
48
+
47 49
 typedef struct {
48 50
     const AVClass *class;  /**< Class for private options. */
49 51
     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 310
 
311 311
     if (seg->list) {
312 312
         if (seg->list_type == LIST_TYPE_UNDEFINED) {
313
-            if      (av_match_ext(seg->list, "ext" )) seg->list_type = LIST_TYPE_EXT;
313
+            if      (av_match_ext(seg->list, "csv" )) seg->list_type = LIST_TYPE_CSV;
314
+            else if (av_match_ext(seg->list, "ext" )) seg->list_type = LIST_TYPE_EXT;
314 315
             else if (av_match_ext(seg->list, "m3u8")) seg->list_type = LIST_TYPE_M3U8;
315 316
             else                                      seg->list_type = LIST_TYPE_FLAT;
316 317
         }
317 318
         if ((ret = segment_list_open(s)) < 0)
318 319
             goto fail;
319 320
     }
321
+    if (seg->list_type == LIST_TYPE_EXT)
322
+        av_log(s, AV_LOG_WARNING, "'ext' list type option is deprecated in favor of 'csv'\n");
320 323
 
321 324
     for (i = 0; i< s->nb_streams; i++)
322 325
         seg->has_video +=
... ...
@@ -445,6 +450,7 @@ static const AVOption options[] = {
445 445
     { "segment_list_size", "set the maximum number of playlist entries", OFFSET(list_size), AV_OPT_TYPE_INT,  {.dbl = 0},     0, INT_MAX, E },
446 446
     { "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" },
447 447
     { "flat", "flat format",     0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_FLAT }, INT_MIN, INT_MAX, 0, "list_type" },
448
+    { "csv",  "csv format",      0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_CSV  }, INT_MIN, INT_MAX, 0, "list_type" },
448 449
     { "ext",  "extended format", 0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_EXT  }, INT_MIN, INT_MAX, 0, "list_type" },
449 450
     { "m3u8", "M3U8 format",     0, AV_OPT_TYPE_CONST, {.dbl=LIST_TYPE_M3U8 }, INT_MIN, INT_MAX, 0, "list_type" },
450 451
     { "segment_time",      "set segment duration",                       OFFSET(time_str),AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,       E },