summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-12-13 10:48:07 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-12-13 10:48:07 +0000
commit032222eaf85ff3514bdd0f531bcc82bfee41b124 (patch)
tree453ed03e309470ac5bfc54665e49a85fe09c0ae5 /recordmydesktop
parent610b67611baf101c38c915802ceb3c985ea03007 (diff)
added -buffer-size option,
along with relevant documentation, arg parsing, etc. Removed obolete and unused encoding variable. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@237 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/doc/recordmydesktop.17
-rw-r--r--recordmydesktop/include/recordmydesktop.h42
-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
6 files changed, 69 insertions, 27 deletions
diff --git a/recordmydesktop/doc/recordmydesktop.1 b/recordmydesktop/doc/recordmydesktop.1
index 9de4134..3e100cf 100644
--- a/recordmydesktop/doc/recordmydesktop.1
+++ b/recordmydesktop/doc/recordmydesktop.1
@@ -261,6 +261,11 @@ Sound Options:
.br
.TP
.B
+ \-buffer\-size N(number>0)
+ A positive number denoting the desired sound buffer size(in frames).
+.br
+.TP
+.B
\-device SOUND_DEVICE
Sound device(default hw0:0).
.br
@@ -357,7 +362,7 @@ If no other option is specified, filename can be given without the \-o switch.
.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)| \-device SOUND_DEVICE|
+\-\-no\-cursor| \-freq N(number>0)| \-channels N(number>0)| \-buffer\-size N(number>0)| \-device SOUND_DEVICE|
.br
\-\-no\-sound| \-\-with\-shared| \-\-no\-cond\-shared| \-shared\-threshold n| \-\-full\-shots|
.br
diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h
index 59ac109..d684e8f 100644
--- a/recordmydesktop/include/recordmydesktop.h
+++ b/recordmydesktop/include/recordmydesktop.h
@@ -89,11 +89,6 @@
#define CACHE_FILE_SIZE_LIMIT (500*1<<20)
-//do not be confused
-//this is useless and obsolete.
-//There are no plans for other fotmats
-enum {UNSPECIFIED,OGG_THEORA_VORBIS};
-
/**Structs*/
@@ -138,7 +133,6 @@ typedef struct _ProgArgs{
int width,height; //defaults to window width and height
int quietmode; //no messages to stderr,stdout
char *filename; //output file(default out.[ogg|*])
- int encoding; //encoding(default OGG_THEORA_VORBIS)
int cursor_color; //black or white=>1 or 0
int have_dummy_cursor;//disable/enable drawing of the dummy cursor
int xfixes_cursor; //disable/enable drawing of a cursor obtained
@@ -147,6 +141,7 @@ typedef struct _ProgArgs{
unsigned int frequency; //desired frequency (default 22050)
unsigned int channels; //no of channels(default 2)
char *device; //default sound device(default according to alsa or oss)
+ snd_pcm_uframes_t buffsize;//buffer size(in frames) for sound capturing
int nosound; //do not record sound(default 0)
int noshared; //do not use shared memory extension(default 1)
int nocondshared; //do not use shared memory on large image aquititions
@@ -405,17 +400,24 @@ int capture_busy,
}\
else\
(args)->display=NULL;\
- (args)->windowid=(args)->x=(args)->y\
- =(args)->width=(args)->height=(args)->quietmode\
- =(args)->nosound=(args)->full_shots=(args)->encOnTheFly\
- =(args)->zerocompression=(args)->nowmcheck\
- =(args)->overwrite=0;\
+ (args)->windowid=\
+ (args)->x=\
+ (args)->y=\
+ (args)->width=\
+ (args)->height=\
+ (args)->quietmode=\
+ (args)->nosound=\
+ (args)->full_shots=\
+ (args)->encOnTheFly=\
+ (args)->zerocompression=\
+ (args)->nowmcheck=\
+ (args)->dropframes=\
+ (args)->overwrite=\
+ (args)->nocondshared=0;\
+ (args)->no_quick_subsample=\
(args)->noshared=1;\
- (args)->dropframes=(args)->nocondshared=0;\
- (args)->no_quick_subsample=1;\
(args)->filename=(char *)malloc(8);\
strcpy((args)->filename,"out.ogg");\
- (args)->encoding=OGG_THEORA_VORBIS;\
(args)->cursor_color=1;\
(args)->shared_thres=75;\
(args)->have_dummy_cursor=0;\
@@ -425,6 +427,7 @@ int capture_busy,
(args)->fps=15;\
(args)->channels=1;\
(args)->frequency=22050;\
+ (args)->buffsize=4096;\
(args)->v_bitrate=45000;\
(args)->v_quality=63;\
(args)->s_quality=10;\
@@ -946,7 +949,8 @@ void *CaptureSound(ProgData *pdata);
void *EncodeSoundBuffer(ProgData *pdata);
/**
-* Open sound device, with the desired parameters
+* Try to open sound device, with the desired parameters,
+* and place the obtained ones on their place
*
* \param pcm_dev name of the device
*
@@ -954,18 +958,22 @@ void *EncodeSoundBuffer(ProgData *pdata);
*
* \param frequency desired frequency(gets modified with the acieved value)
*
-* \param periodsize Size of a period
+* \param buffsize Size of buffer
+*
+* \param periodsize Size of a period(can be NULL)
*
-* \param periodtime Duration of a period
+* \param periodtime Duration of a period(can be NULL)
*
* \param hardpause Set to 1 when the device has to be stopped during pause
* and to 0 when it supports pausing
+* (can be NULL)
*
* \returns snd_pcm_t handle on success, NULL on failure
*/
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 *hardpause);
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