summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/doc/recordmydesktop.124
-rw-r--r--recordmydesktop/include/rmdmacro.h4
-rw-r--r--recordmydesktop/include/rmdtypes.h2
-rw-r--r--recordmydesktop/src/initialize_data.c3
-rw-r--r--recordmydesktop/src/parseargs.c36
-rw-r--r--recordmydesktop/src/rmd_jack.c10
6 files changed, 43 insertions, 36 deletions
diff --git a/recordmydesktop/doc/recordmydesktop.1 b/recordmydesktop/doc/recordmydesktop.1
index 01e265b..b3fc345 100644
--- a/recordmydesktop/doc/recordmydesktop.1
+++ b/recordmydesktop/doc/recordmydesktop.1
@@ -275,7 +275,15 @@ Sound Options:
.TP
.B
\-buffer\-size N(number>0)
- A positive number denoting the desired sound buffer size(in frames).
+ A positive number denoting the desired sound buffer size(in frames, when using ALSA or OSS).
+.br
+.TP
+.B
+ \-ring\-buffer\-size N(float number>0)
+ A float number denoting the desired ring buffer size (in seconds,when using JACK only).
+ The overall size of the buffer in bytes will be:
+ ring_buffer_size*samplerate*number_of_ports*sizeof(jack_default_audio_sample_t),
+ where sizeof(jack_default_audio_sample_t) is normally 4.
.br
.TP
.B
@@ -376,19 +384,7 @@ If no other option is specified, filename can be given without the \-o switch.
.br
.SH USAGE
.TP
-.B recordmydesktop
-.br
-[\-h| \-\-help| \-\-version| \-\-print\-config| \-delay n[H|h|M|m]| \-windowid id_of_window|
-.br
-\-display DISPLAY| \-x X| \-y Y|\-width N| \-height N| \-fps N(number>0)| \-\-on\-the\-fly\-encoding|
-.br
-\-v_quality n| \-s_quality n| \-v_bitrate n| \-\-no\-framedrop| \-dummy\-cursor color|
-.br
-\-\-no\-cursor| \-freq N(number>0)| \-channels N(number>0)| \-buffer\-size N(number>0)| \-device SOUND_DEVICE|
-.br
-\-use\-jack port1 port2... portn| \-\-no\-sound| \-\-with\-shared| \-\-no\-cond\-shared| \-shared\-threshold n| \-\-full\-shots|
-.br
-\-\-quick\-subsampling| \-workdir DIR| \-\-zero\-compression| \-\-no\-wm\-check| \-\-overwrite| \-o filename]^filename
+.B recordmydesktop [OPTIONS]^filename
.br
.br
.br
diff --git a/recordmydesktop/include/rmdmacro.h b/recordmydesktop/include/rmdmacro.h
index 982f986..ebeb8bf 100644
--- a/recordmydesktop/include/rmdmacro.h
+++ b/recordmydesktop/include/rmdmacro.h
@@ -105,9 +105,6 @@
#define DEFAULT_AUDIO_DEVICE "/dev/dsp"
#endif
-#ifdef HAVE_JACK_H
- #define BUFFERS_IN_RING 0x0020
-#endif
#define CLIP_EVENT_AREA(e,brwin,wgeom){\
@@ -212,6 +209,7 @@
(args)->use_jack=\
(args)->jack_nports=\
(args)->nocondshared=0;\
+ (args)->jack_ringbuffer_secs=3.0;\
(args)->jack_port_names=NULL;\
(args)->no_quick_subsample=\
(args)->noshared=1;\
diff --git a/recordmydesktop/include/rmdtypes.h b/recordmydesktop/include/rmdtypes.h
index 005ae5a..f8d9f4a 100644
--- a/recordmydesktop/include/rmdtypes.h
+++ b/recordmydesktop/include/rmdtypes.h
@@ -177,6 +177,7 @@ typedef struct _ProgArgs{
int use_jack; //record audio with jack
unsigned int jack_nports;
char **jack_port_names;
+ float jack_ringbuffer_secs;
}ProgArgs;
//this struct holds anything related to encoding AND
@@ -247,6 +248,7 @@ typedef struct _JackData{
unsigned int buffersize, //buffer size for every port in frames.
frequency, //samplerate with which jack server was started.
nports; //number of ports.
+ float ringbuffer_secs;
char **port_names; //names of ports(as specified in args).
jack_port_t **ports; //connections to thes ports.
jack_default_audio_sample_t **portbuf; //retrieval of audio buffers.
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);
© All Rights Reserved