diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-12-13 10:48:07 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-12-13 10:48:07 +0000 |
commit | 032222eaf85ff3514bdd0f531bcc82bfee41b124 (patch) | |
tree | 453ed03e309470ac5bfc54665e49a85fe09c0ae5 /recordmydesktop/src/opendev.c | |
parent | 610b67611baf101c38c915802ceb3c985ea03007 (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/src/opendev.c')
-rw-r--r-- | recordmydesktop/src/opendev.c | 13 |
1 files changed, 9 insertions, 4 deletions
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; |