summaryrefslogtreecommitdiff
path: root/avconv.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2011-11-24 21:42:42 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-11-24 21:42:42 +0100
commit0a4f02117b67c135a27e3490aea1631ad9f4312f (patch)
tree25646babb02476c6ac2e0f6d8c37c61beb1631ab /avconv.c
parent0232f788b6b0855db1771dbf8d7174e2eda2ff45 (diff)
Add option -n to exit if output file exists.
Diffstat (limited to 'avconv.c')
-rw-r--r--avconv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/avconv.c b/avconv.c
index 4cf2e2f37f..4620b2baa8 100644
--- a/avconv.c
+++ b/avconv.c
@@ -119,6 +119,7 @@ static int intra_dc_precision = 8;
static int qp_hist = 0;
static int file_overwrite = 0;
+static int no_file_overwrite = 0;
static int do_benchmark = 0;
static int do_hex_dump = 0;
static int do_pkt_dump = 0;
@@ -3016,11 +3017,11 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
static void assert_file_overwrite(const char *filename)
{
- if (!file_overwrite &&
+ if ((!file_overwrite || no_file_overwrite) &&
(strchr(filename, ':') == NULL || filename[1] == ':' ||
av_strstart(filename, "file:", NULL))) {
if (avio_check(filename, 0) == 0) {
- if (!using_stdin) {
+ if (!using_stdin && (!no_file_overwrite || file_overwrite)) {
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
fflush(stderr);
if (!read_yesno()) {
@@ -4268,6 +4269,7 @@ static const OptionDef options[] = {
{ "f", HAS_ARG | OPT_STRING | OPT_OFFSET, {.off = OFFSET(format)}, "force format", "fmt" },
{ "i", HAS_ARG | OPT_FUNC2, {(void*)opt_input_file}, "input file name", "filename" },
{ "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
+ { "n", OPT_BOOL, {(void*)&no_file_overwrite}, "do not overwrite output files" },
{ "c", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(codec_names)}, "codec name", "codec" },
{ "codec", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(codec_names)}, "codec name", "codec" },
{ "pre", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(presets)}, "preset name", "preset" },