aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-27 00:42:26 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-28 23:00:07 +0100
commit6a3833e1411e788819fd132aa60cf3f66acbbe03 (patch)
tree5c3890739eb413ef2d97cb830608cc8da9afebf3 /ffmpeg_opt.c
parentdcac15a84c8fc087ec85b2172db13d2e0d543e50 (diff)
downloadffmpeg-6a3833e1411e788819fd132aa60cf3f66acbbe03.tar.gz
ffmpeg_opt: Do not overwrite output if there is no input
Fixes Ticket4254 Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 39c5f49d67..fb7490adf6 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -110,6 +110,7 @@ static int no_file_overwrite = 0;
static int do_psnr = 0;
static int input_sync;
static int override_ffserver = 0;
+static int input_stream_potentially_available = 0;
static void uninit_options(OptionsContext *o)
{
@@ -1008,6 +1009,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
av_dict_free(&opts[i]);
av_freep(&opts);
+ input_stream_potentially_available = 1;
+
return 0;
}
@@ -2104,6 +2107,12 @@ loop_end:
}
}
+ if (!(oc->oformat->flags & AVFMT_NOSTREAMS) && !input_stream_potentially_available) {
+ av_log(NULL, AV_LOG_ERROR,
+ "No input streams but output needs an input stream\n");
+ exit_program(1);
+ }
+
if (!(oc->oformat->flags & AVFMT_NOFILE)) {
/* test if it already exists to avoid losing precious files */
assert_file_overwrite(filename);
@@ -2608,6 +2617,9 @@ static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
filtergraphs[nb_filtergraphs - 1]->graph_desc = av_strdup(arg);
if (!filtergraphs[nb_filtergraphs - 1]->graph_desc)
return AVERROR(ENOMEM);
+
+ input_stream_potentially_available = 1;
+
return 0;
}
@@ -2622,6 +2634,9 @@ static int opt_filter_complex_script(void *optctx, const char *opt, const char *
return AVERROR(ENOMEM);
filtergraphs[nb_filtergraphs - 1]->index = nb_filtergraphs - 1;
filtergraphs[nb_filtergraphs - 1]->graph_desc = graph_desc;
+
+ input_stream_potentially_available = 1;
+
return 0;
}