Browse code

lavfi/concat: implement unsafe mode.

Nicolas George authored on 2012/10/26 04:27:41
Showing 2 changed files
... ...
@@ -4643,6 +4643,9 @@ streams in each segment. Default is 1.
4643 4643
 Set the number of output audio streams, that is also the number of video
4644 4644
 streams in each segment. Default is 0.
4645 4645
 
4646
+@item unsafe
4647
+Activate unsafe mode: do not fail if segments have a different format.
4648
+
4646 4649
 @end table
4647 4650
 
4648 4651
 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
... ...
@@ -42,6 +42,7 @@ typedef struct {
42 42
     unsigned cur_idx; /**< index of the first input of current segment */
43 43
     int64_t delta_ts; /**< timestamp to add to produce output timestamps */
44 44
     unsigned nb_in_active; /**< number of active inputs in current segment */
45
+    unsigned unsafe;
45 46
     struct concat_in {
46 47
         int64_t pts;
47 48
         int64_t nb_frames;
... ...
@@ -64,6 +65,9 @@ static const AVOption concat_options[] = {
64 64
     { "a", "specify the number of audio streams",
65 65
       OFFSET(nb_streams[AVMEDIA_TYPE_AUDIO]),
66 66
       AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A|F},
67
+    { "unsafe", "enable unsafe mode",
68
+      OFFSET(unsafe),
69
+      AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A|A|F},
67 70
     { 0 }
68 71
 };
69 72
 
... ...
@@ -143,7 +147,8 @@ static int config_output(AVFilterLink *outlink)
143 143
                    ctx->input_pads[out_no].name, outlink->w, outlink->h,
144 144
                    outlink->sample_aspect_ratio.num,
145 145
                    outlink->sample_aspect_ratio.den);
146
-            return AVERROR(EINVAL);
146
+            if (!cat->unsafe)
147
+                return AVERROR(EINVAL);
147 148
         }
148 149
     }
149 150