From fd4a7480e74008c0e654ad9bf790a8fa6625e661 Mon Sep 17 00:00:00 2001 From: iovar Date: Wed, 8 Nov 2006 16:01:00 +0000 Subject: added --overwrite option and updated manpage accordingly git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@152 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- rMD-exp/doc/recordmydesktop.1 | 11 ++++++++++- rMD-exp/include/recordmydesktop.h | 4 +++- rMD-exp/src/init_encoder.c | 4 ++-- rMD-exp/src/parseargs.c | 6 +++++- 4 files changed, 20 insertions(+), 5 deletions(-) (limited to 'rMD-exp') diff --git a/rMD-exp/doc/recordmydesktop.1 b/rMD-exp/doc/recordmydesktop.1 index 8602262..6fa7da5 100644 --- a/rMD-exp/doc/recordmydesktop.1 +++ b/rMD-exp/doc/recordmydesktop.1 @@ -327,6 +327,15 @@ Misc Options: Number of secs(default),minutes or hours before capture starts(number can be float). .br .TP +.B + \-\-overwrite + If there is already a file with the same name, delete it. + Default action is to add a number postfix to the new file. + For example when not specifying a name, if out.ogg exists, + the new file will be out.ogg.1 and if that exists too, out.ogg.2 + and so on (no ad-infinitum though, more like ad-short-integer...) +.br +.TP .B \-o filename Name of recorded video(default out.ogg). @@ -352,7 +361,7 @@ If no other option is specified, filename can be given without the \-o switch. .br \-\-no\-sound| \-\-with\-shared| \-\-no\-cond\-shared| \-shared\-threshold n| \-\-full\-shots| .br -\-\-quick\-subsampling| \-workdir DIR| \-\-zero\-compression| \-\-no\-wm\-check| \-o filename]^filename +\-\-quick\-subsampling| \-workdir DIR| \-\-zero\-compression| \-\-no\-wm\-check| \-\-overwrite| \-o filename]^filename .br .br .br diff --git a/rMD-exp/include/recordmydesktop.h b/rMD-exp/include/recordmydesktop.h index 8a9b09e..4c3ad18 100644 --- a/rMD-exp/include/recordmydesktop.h +++ b/rMD-exp/include/recordmydesktop.h @@ -161,6 +161,7 @@ typedef struct _ProgArgs{ int encOnTheFly; //encode while recording, no caching(default 0) char *workdir; //directory to be used for cache files(default $HOME) int zerocompression;//image data are always flushed uncompressed + int overwrite;//overwite a previously existing file(do not add a .number postfix) }ProgArgs; @@ -398,7 +399,8 @@ int capture_busy, (args)->windowid=(args)->x=(args)->y\ =(args)->width=(args)->height=(args)->quietmode\ =(args)->nosound=(args)->full_shots=(args)->encOnTheFly\ - =(args)->zerocompression=(args)->nowmcheck=0;\ + =(args)->zerocompression=(args)->nowmcheck\ + =(args)->overwrite=0;\ (args)->noshared=1;\ (args)->dropframes=(args)->nocondshared=0;\ (args)->no_quick_subsample=1;\ diff --git a/rMD-exp/src/init_encoder.c b/rMD-exp/src/init_encoder.c index 4edfef1..84d36aa 100644 --- a/rMD-exp/src/init_encoder.c +++ b/rMD-exp/src/init_encoder.c @@ -66,8 +66,8 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t,int buffer_ready){ ogg_stream_init(&(enc_data_t)->m_ogg_ts,y1); if(!pdata->args.nosound) ogg_stream_init(&(enc_data_t)->m_ogg_vs,y2); - - IncrementalNaming(&(pdata)->args.filename); + if(!pdata->args.overwrite) + IncrementalNaming(&(pdata)->args.filename); (enc_data_t)->fp=fopen((pdata)->args.filename,"w"); if((enc_data_t)->fp==NULL){ fprintf(stderr,"Cannot open file %s for writting!\n",(pdata)->args.filename); diff --git a/rMD-exp/src/parseargs.c b/rMD-exp/src/parseargs.c index 72a2681..c7d20fd 100644 --- a/rMD-exp/src/parseargs.c +++ b/rMD-exp/src/parseargs.c @@ -36,7 +36,7 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ "\t -v_quality n| -s_quality n| -v_bitrate n| --no-framedrop| -dummy-cursor color|\n" "\t --no-cursor| -freq N(number>0)| -channels N(number>0)| -device SOUND_DEVICE|\n" "\t --no-sound| --with-shared| --no-cond-shared| -shared-threshold n| --full-shots|\n" - "\t --quick-subsampling| -workdir DIR| --zero-compression| --no-wm-check| -o filename]^filename\n\n\n" + "\t --quick-subsampling| -workdir DIR| --zero-compression| --no-wm-check| --overwite| -o filename]^filename\n\n\n" "General Options:\n" "\t-h or --help\t\tPrint this help and exit.\n" @@ -77,6 +77,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ "\t--zero-compression\tImage data are always cached uncompressed.\n" "\t-workdir DIR\t\tLocation where a temporary directory will be created to hold project files(default $HOME).\n" "\t-delay n[H|h|M|m]\tNumber of secs(default),minutes or hours before capture starts(number can be float)\n" + "\t--overwrite\t\tIf there is already a file with the same name, delete it\n" + "\t\t\t\t(default is to add a number postfix to the new one).\n" "\t-o filename\t\tName of recorded video(default out.ogg).\n" "\n\tIf no other options are specified, filename can be given without the -o switch.\n\n\n"; @@ -399,6 +401,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ else if(!strcmp(argv[i],"--on-the-fly-encoding")){ arg_return->encOnTheFly=1; } + else if(!strcmp(argv[i],"--overwrite")) + arg_return->overwrite=1; else if(!strcmp(argv[i],"--no-wm-check")) arg_return->nowmcheck=1; else if(!strcmp(argv[i],"--zero-compression")){ -- cgit v1.2.1