diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-02-20 12:30:31 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-02-20 12:30:31 +0000 |
commit | 1e1fcd158ae0b63a215b0d79ea147e0d91a40a79 (patch) | |
tree | cfa8e7b41a73cfacf8ef00c0cbd44f4e19959b8c /recordmydesktop/src | |
parent | 225a939a00490c2e6f45cd068abd514c96dde50e (diff) |
added configurable ringbuffer size,
corrected a mistake that blocked compilation(from last commit at shminfo initialization),
removed the options from USAGE in the manpage and the program ,since it's too bloated to be usefull
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@285 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r-- | recordmydesktop/src/initialize_data.c | 3 | ||||
-rw-r--r-- | recordmydesktop/src/parseargs.c | 36 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_jack.c | 10 |
3 files changed, 30 insertions, 19 deletions
diff --git a/recordmydesktop/src/initialize_data.c b/recordmydesktop/src/initialize_data.c index 8223f19..806ade5 100644 --- a/recordmydesktop/src/initialize_data.c +++ b/recordmydesktop/src/initialize_data.c @@ -125,7 +125,7 @@ int InitializeData(ProgData *pdata, pdata->shimage->bytes_per_line* pdata->shimage->height, IPC_CREAT|0777); - if(shminfo->shmid==-1){ + if(pdata->shminfo.shmid==-1){ fprintf(stderr,"Failed to obtain Shared Memory segment!\n"); return 12; } @@ -177,6 +177,7 @@ int InitializeData(ProgData *pdata, int jack_error=0; pdata->jdata->port_names=pdata->args.jack_port_names; pdata->jdata->nports=pdata->args.jack_nports; + pdata->jdata->ringbuffer_secs=pdata->args.jack_ringbuffer_secs; pdata->jdata->snd_buff_ready_mutex=&pdata->snd_buff_ready_mutex; pdata->jdata->sound_data_read=&pdata->sound_data_read; pdata->jdata->capture_started=0; diff --git a/recordmydesktop/src/parseargs.c b/recordmydesktop/src/parseargs.c index 4643bf1..a2a55c4 100644 --- a/recordmydesktop/src/parseargs.c +++ b/recordmydesktop/src/parseargs.c @@ -46,19 +46,7 @@ void PrintConfig(void){ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ int i; char *usage="\nUsage:\n" - "\trecordmydesktop [-h| --help| --version| --print-config|" - " -delay n[H|h|M|m]| -windowid id_of_window|\n" - "\t-display DISPLAY| -x X| -y Y|-width N| -height N|" - " -fps N(number>0)| --on-the-fly-encoding|\n" - "\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)|" - " -buffer-size N(number>0)| -device SOUND_DEVICE|\n" - "\t -use-jack port1 port2... portn| --no-sound| --with-shared|" - " --no-cond-shared| -shared-threshold n|" - " --full-shots|\n" - "\t --quick-subsampling| -workdir DIR| --zero-compression| --no-wm-check|" - " --overwite| -o filename]^filename\n\n\n" + "\trecordmydesktop [OPTIONS]^filename\n\n\n" "General Options:\n" "\t-h or --help\t\tPrint this help and exit.\n" @@ -97,7 +85,9 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ "\t-freq N\t\t\t\tA positive number denoting desired sound frequency.\n" "\t-buffer-size N\t\t\tA positive number denoting the desired" - " sound buffer size(in frames)\n" + " sound buffer size (in frames,when using ALSA or OSS)\n" + "\t-ring-buffer-size N\t\tA float number denoting the desired" + " ring buffer size (in seconds,when using JACK only).\n" "\t-device SOUND_DEVICE\t\tSound device(default " DEFAULT_AUDIO_DEVICE @@ -504,6 +494,24 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ return 1; } } + else if(!strcmp(argv[i],"-ring-buffer-size")){ + if(i+1<argc){ + float num=atof(argv[i+1]); + if(num>0.0) + arg_return->jack_ringbuffer_secs=num; + else{ + fprintf(stderr,"Argument Usage: --ring-buffer-size" + " N(floating point number>0.0)\n"); + return 1; + } + } + else{ + fprintf(stderr,"Argument Usage: --ring-buffer-size" + " N(floating point number>0.0)\n"); + return 1; + } + i++; + } else if(!strcmp(argv[i],"--no-sound")) arg_return->nosound=1; else if(!strcmp(argv[i],"--drop-frames")) diff --git a/recordmydesktop/src/rmd_jack.c b/recordmydesktop/src/rmd_jack.c index 6d846a1..9047e8f 100644 --- a/recordmydesktop/src/rmd_jack.c +++ b/recordmydesktop/src/rmd_jack.c @@ -136,6 +136,7 @@ void JackShutdown(void *jdata_t){ } int StartJackClient(JackData *jdata){ + float ring_buffer_size=0.0; if(LoadJackLib(jdata->jack_lib_handle)){ fprintf (stderr,"Couldn't load the Jack library (libjack.so)!\n"); @@ -161,11 +162,12 @@ int StartJackClient(JackData *jdata){ //and any recording up to that point will be encoded and saved. jdata->frequency=jack_get_sample_rate_p(jdata->client); jdata->buffersize=jack_get_buffer_size_p(jdata->client); + ring_buffer_size=(jdata->ringbuffer_secs* + jdata->frequency* + sizeof(jack_default_audio_sample_t)* + jdata->nports); jdata->sound_buffer= - (*jack_ringbuffer_create_p)(jdata->nports* - sizeof(jack_default_audio_sample_t)* - jdata->buffersize* - BUFFERS_IN_RING); + (*jack_ringbuffer_create_p)((int)(ring_buffer_size+0.5));//round up jack_set_process_callback_p(jdata->client,JackCapture,jdata); jack_on_shutdown_p(jdata->client,JackShutdown,jdata); |