diff options
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r-- | recordmydesktop/src/rmd_initialize_data.c | 3 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_parseargs.c | 25 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_types.h | 4 |
3 files changed, 16 insertions, 16 deletions
diff --git a/recordmydesktop/src/rmd_initialize_data.c b/recordmydesktop/src/rmd_initialize_data.c index 6754f7b..dec594f 100644 --- a/recordmydesktop/src/rmd_initialize_data.c +++ b/recordmydesktop/src/rmd_initialize_data.c @@ -214,7 +214,6 @@ void SetupDefaultArgs(ProgArgs *args) { args->noframe = 0; args->jack_nports = 0; args->jack_ringbuffer_secs = 3.0; - args->jack_port_names = NULL; args->zerocompression = 1; args->no_quick_subsample = 1; args->cursor_color = 1; @@ -236,6 +235,8 @@ void SetupDefaultArgs(ProgArgs *args) { args->display = NULL; } + memset(args->jack_port_names, 0, sizeof(args->jack_port_names)); + args->device = (char *) malloc(strlen(DEFAULT_AUDIO_DEVICE) + 1); strcpy(args->device, DEFAULT_AUDIO_DEVICE); diff --git a/recordmydesktop/src/rmd_parseargs.c b/recordmydesktop/src/rmd_parseargs.c index f0b3dcc..cb039a1 100644 --- a/recordmydesktop/src/rmd_parseargs.c +++ b/recordmydesktop/src/rmd_parseargs.c @@ -478,23 +478,20 @@ boolean ParseArgs(int argc, char **argv, ProgArgs *arg_return) { #ifdef HAVE_LIBJACK int k=i+1; arg_return->jack_nports=0; - while((k<argc)&&(argv[k][0]!='-')){ + while((k<argc)&&(argv[k][0]!='-')&&k-i-1<RMD_MAX_JACK_PORTS){ arg_return->jack_nports++; - k++; - } - if(arg_return->jack_nports>0){ - arg_return->jack_port_names=malloc(sizeof(char*)* - arg_return->jack_nports); - for(k=i+1;k<i+1+arg_return->jack_nports;k++){ - arg_return->jack_port_names[k-i-1]= - malloc(strlen(argv[k])+1); - strcpy(arg_return->jack_port_names[k-i-1], - argv[k]); - } - i+=arg_return->jack_nports; + + arg_return->jack_port_names[k-i-1]=malloc(strlen(argv[k])+1); + strcpy(arg_return->jack_port_names[k-i-1],argv[k]); + arg_return->use_jack=1; + + k++; } - else{ + + i+=arg_return->jack_nports; + + if (arg_return->jack_nports==0) { fprintf(stderr,"Argument Usage: --use-jack port1" " port2... portn\n"); return FALSE; diff --git a/recordmydesktop/src/rmd_types.h b/recordmydesktop/src/rmd_types.h index 3324760..629f43d 100644 --- a/recordmydesktop/src/rmd_types.h +++ b/recordmydesktop/src/rmd_types.h @@ -83,6 +83,8 @@ typedef int boolean; #define TRUE (!FALSE) #endif +#define RMD_MAX_JACK_PORTS (100) + // Forward declarations typedef struct _ProgData ProgData; @@ -149,7 +151,7 @@ typedef struct _ProgArgs{ //(do not add a .number postfix) int use_jack; //record audio with jack unsigned int jack_nports; - char **jack_port_names; + char *jack_port_names[RMD_MAX_JACK_PORTS]; float jack_ringbuffer_secs; }ProgArgs; |