]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avf_concat.c
Merge commit '4521645b1aee9e9ad8f5cea7b2392cd5f6ffcd26'
[ffmpeg] / libavfilter / avf_concat.c
index c0bd621cb4f4fc5c8d6568e07cc9bcbf9a3c5abf..f13e8d0120e94d0ad1ebd72920e68f8d817cfbdc 100644 (file)
@@ -42,6 +42,7 @@ typedef struct {
     unsigned cur_idx; /**< index of the first input of current segment */
     int64_t delta_ts; /**< timestamp to add to produce output timestamps */
     unsigned nb_in_active; /**< number of active inputs in current segment */
+    unsigned unsafe;
     struct concat_in {
         int64_t pts;
         int64_t nb_frames;
@@ -64,6 +65,9 @@ static const AVOption concat_options[] = {
     { "a", "specify the number of audio streams",
       OFFSET(nb_streams[AVMEDIA_TYPE_AUDIO]),
       AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A|F},
+    { "unsafe", "enable unsafe mode",
+      OFFSET(unsafe),
+      AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A|A|F},
     { 0 }
 };
 
@@ -143,7 +147,8 @@ static int config_output(AVFilterLink *outlink)
                    ctx->input_pads[out_no].name, outlink->w, outlink->h,
                    outlink->sample_aspect_ratio.num,
                    outlink->sample_aspect_ratio.den);
-            return AVERROR(EINVAL);
+            if (!cat->unsafe)
+                return AVERROR(EINVAL);
         }
     }
 
@@ -195,7 +200,7 @@ static void process_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
         av_log(ctx, AV_LOG_ERROR, "Frame after EOF on input %s\n",
                ctx->input_pads[in_no].name);
         avfilter_unref_buffer(buf);
-    } if (in_no >= cat->cur_idx + ctx->nb_outputs) {
+    } else if (in_no >= cat->cur_idx + ctx->nb_outputs) {
         ff_bufqueue_add(ctx, &cat->in[in_no].queue, buf);
     } else {
         push_frame(ctx, in_no, buf);