summaryrefslogtreecommitdiff
path: root/recordmydesktop/src
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r--recordmydesktop/src/capture_sound.c1
-rw-r--r--recordmydesktop/src/opendev.c13
-rw-r--r--recordmydesktop/src/parseargs.c25
-rw-r--r--recordmydesktop/src/recordmydesktop.c8
4 files changed, 38 insertions, 9 deletions
diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c
index 8e3bfd3..ef65bbc 100644
--- a/recordmydesktop/src/capture_sound.c
+++ b/recordmydesktop/src/capture_sound.c
@@ -51,6 +51,7 @@ void *CaptureSound(ProgData *pdata){
OpenDev(pdata->args.device,
&pdata->args.channels,
&pdata->args.frequency,
+ &pdata->args.buffsize,
NULL,
NULL,
NULL//let's hope that the device capabilities didn't magically change
diff --git a/recordmydesktop/src/opendev.c b/recordmydesktop/src/opendev.c
index 1461023..6e13933 100644
--- a/recordmydesktop/src/opendev.c
+++ b/recordmydesktop/src/opendev.c
@@ -30,13 +30,18 @@
#include <recordmydesktop.h>
-snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *frequency,snd_pcm_uframes_t *periodsize,unsigned int *periodtime,int *hard_pause){
+snd_pcm_t *OpenDev( const char *pcm_dev,
+ unsigned int *channels,
+ unsigned int *frequency,
+ snd_pcm_uframes_t *buffsize,
+ snd_pcm_uframes_t *periodsize,
+ unsigned int *periodtime,
+ int *hard_pause){
snd_pcm_t *mhandle;
snd_pcm_hw_params_t *hwparams;
unsigned int periods=2;
unsigned int exactrate = *frequency;
- snd_pcm_uframes_t buffsize=1024;
snd_pcm_hw_params_alloca(&hwparams);
@@ -79,7 +84,7 @@ snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *freq
return NULL;
}
- if (snd_pcm_hw_params_set_buffer_size_near(mhandle, hwparams,&buffsize)<0){
+ if (snd_pcm_hw_params_set_buffer_size_near(mhandle, hwparams,buffsize)<0){
fprintf(stderr, "Couldn't set buffer size.\n");
return NULL;
}
@@ -93,11 +98,11 @@ snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *freq
}
if(periodsize!=NULL)
snd_pcm_hw_params_get_period_size(hwparams,periodsize,0);
- snd_pcm_hw_params_get_buffer_size(hwparams,&buffsize);
if(periodtime!=NULL)
snd_pcm_hw_params_get_period_time(hwparams,periodtime,0);
fprintf(stderr,"Recording on device %s is set to:\n%d channels at %dHz\n",pcm_dev,*channels,*frequency);
+ fprintf(stderr,"Buffer size set to %d frames.\n",(int)(*buffsize));
snd_pcm_prepare(mhandle);
return mhandle;
diff --git a/recordmydesktop/src/parseargs.c b/recordmydesktop/src/parseargs.c
index c7d20fd..7340110 100644
--- a/recordmydesktop/src/parseargs.c
+++ b/recordmydesktop/src/parseargs.c
@@ -34,7 +34,7 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
"\trecordmydesktop [-h| --help| --version| -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)| -device SOUND_DEVICE|\n"
+ "\t --no-cursor| -freq N(number>0)| -channels N(number>0)|-buffer-size 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| --overwite| -o filename]^filename\n\n\n"
@@ -60,8 +60,9 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
"\t-fps N(number>0.0)\tA positive number denoting desired framerate.\n\n"
"Sound Options:\n"
- "\t-channels N(number>0)\tA positive number denoting desired sound channels in recording.\n"
- "\t-freq N(number>0)\tA positive number denoting desired sound frequency.\n"
+ "\t-channels N\t\tA positive number denoting desired sound channels in recording.\n"
+ "\t-freq N\t\t\tA positive number denoting desired sound frequency.\n"
+ "\t-buffer-size N\t\tA positive number denoting the desired sound buffer size(in frames)\n"
"\t-device SOUND_DEVICE\tSound device(default hw0:0).\n"
"\t--no-sound\t\tDo not record sound.\n\n"
@@ -73,7 +74,7 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
"\t-s_quality n\t\tDesired audio quality(-1 to 10).\n\n"
"Misc Options:\n"
- "\t--no-wm-check\tDo not try to detect the window manager(and set options according to it)\n"
+ "\t--no-wm-check\t\tDo not try to detect the window manager(and set options according to it)\n"
"\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"
@@ -381,6 +382,22 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
}
i++;
}
+ else if(!strcmp(argv[i],"-buffer-size")){
+ if(i+1<argc){
+ int num=atoi(argv[i+1]);
+ if(num>0)
+ arg_return->buffsize=num;
+ else{
+ fprintf(stderr,"Argument Usage: -buffer-size N(number>0)\n");
+ return 1;
+ }
+ }
+ else{
+ fprintf(stderr,"Argument Usage: -buffer-size N(number>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/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c
index 0a9aa79..b2923a5 100644
--- a/recordmydesktop/src/recordmydesktop.c
+++ b/recordmydesktop/src/recordmydesktop.c
@@ -160,7 +160,13 @@ int main(int argc,char **argv){
XShmGetImage(pdata.dpy,pdata.specs.root,pdata.shimage,pdata.brwin.rgeom.x,pdata.brwin.rgeom.y,AllPlanes);
}
if(!pdata.args.nosound){
- pdata.sound_handle=OpenDev(pdata.args.device,&pdata.args.channels,&pdata.args.frequency,&pdata.periodsize, &pdata.periodtime,&pdata.hard_pause);
+ pdata.sound_handle=OpenDev( pdata.args.device,
+ &pdata.args.channels,
+ &pdata.args.frequency,
+ &pdata.args.buffsize,
+ &pdata.periodsize,
+ &pdata.periodtime,
+ &pdata.hard_pause);
if(pdata.sound_handle==NULL){
fprintf(stderr,"Error while opening/configuring soundcard %s\nTry running with the --no-sound or specify a correct device.\n",pdata.args.device);
exit(3);
© All Rights Reserved