summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-07-29 16:13:37 +0000
committerbiocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-07-29 16:13:37 +0000
commit4eeb8595e11d5a6ea62e8f235c99189c8e402b1d (patch)
tree63899b4413b1dca683ff4967d5ca9320a79c66a1
parente89b002f4a18baa57763cf7581b5453f11b3a23f (diff)
change in channels bug fixed
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@33 f606c939-3180-4ac9-a4b8-4b8779d57d0a
-rw-r--r--recordmydesktop/include/recordmydesktop.h2
-rw-r--r--recordmydesktop/src/capture_sound.c2
-rw-r--r--recordmydesktop/src/opendev.c10
-rw-r--r--recordmydesktop/src/recordmydesktop.c2
4 files changed, 10 insertions, 6 deletions
diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h
index a994432..bb5dcf0 100644
--- a/recordmydesktop/include/recordmydesktop.h
+++ b/recordmydesktop/include/recordmydesktop.h
@@ -427,7 +427,7 @@ int ZPixmapToBMP(XImage *imgz,BRWindow *brwin,char *fname,int nbytes,int scale);
unsigned char *MakeDummyPointer(DisplaySpecs *specs,int size,int color,int type,unsigned char *npxl);
void *CaptureSound(void *pdata);
void *EncodeSoundBuffer(void *pdata);
-snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int channels,unsigned int *frequency,snd_pcm_uframes_t *periodsize,unsigned int *periodtime,int *hardpause);
+snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *frequency,snd_pcm_uframes_t *periodsize,unsigned int *periodtime,int *hardpause);
void InitEncoder(ProgData *pdata,EncData *enc_data_t);
void MakeMatrices();
#endif
diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c
index a8b3846..9449be2 100644
--- a/recordmydesktop/src/capture_sound.c
+++ b/recordmydesktop/src/capture_sound.c
@@ -50,7 +50,7 @@ void *CaptureSound(void *pdata){
((ProgData *)pdata)->sound_handle=
OpenDev(((ProgData *)pdata)->args.device,
- ((ProgData *)pdata)->args.channels,
+ &((ProgData *)pdata)->args.channels,
&((ProgData *)pdata)->args.frequency,
NULL,
NULL,
diff --git a/recordmydesktop/src/opendev.c b/recordmydesktop/src/opendev.c
index d8a4179..c0be942 100644
--- a/recordmydesktop/src/opendev.c
+++ b/recordmydesktop/src/opendev.c
@@ -30,7 +30,7 @@
#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 *periodsize,unsigned int *periodtime,int *hard_pause){
snd_pcm_t *mhandle;
snd_pcm_hw_params_t *hwparams;
@@ -64,15 +64,19 @@ snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int channels,unsigned int *frequ
fprintf(stderr, "Playback frequency %dHz is not available...\nUsing %dHz instead.\n",*frequency,exactrate);
*frequency=exactrate;
}
- if (snd_pcm_hw_params_set_channels_near(mhandle, hwparams, &channels)<0){
+ if (snd_pcm_hw_params_set_channels_near(mhandle, hwparams, channels)<0){
fprintf(stderr, "Couldn't set channels number.\n");
return NULL;
}
+ if(*channels>2){
+ fprintf(stderr,"Channels number should be 1(mono) or 2(stereo).\n");
+ return NULL;
+ }
if (snd_pcm_hw_params_set_periods_near(mhandle, hwparams, &periods,0)<0) {
fprintf(stderr, "Couldn't set periods.\n");
return NULL;
}
- buffsize=(((exactrate*channels)))>>channels;
+ buffsize=(exactrate*(*channels))/2;
if (snd_pcm_hw_params_set_buffer_size_near(mhandle, hwparams,&buffsize)<0){
fprintf(stderr, "Couldn't set buffer size.\n");
return NULL;
diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c
index a873f70..41a8bca 100644
--- a/recordmydesktop/src/recordmydesktop.c
+++ b/recordmydesktop/src/recordmydesktop.c
@@ -133,7 +133,7 @@ int main(int argc,char **argv){
exit(0);
}
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.periodsize, &pdata.periodtime,&pdata.hard_pause);
if(pdata.sound_handle==NULL){
fprintf(stderr,"Error while opening/configuring soundcard %s\nProcceeding with no sound\n",pdata.args.device);
pdata.args.nosound=1;
© All Rights Reserved