summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/doc/recordmydesktop.15
-rw-r--r--recordmydesktop/src/cache_audio.c9
-rw-r--r--recordmydesktop/src/capture_sound.c9
-rw-r--r--recordmydesktop/src/encode_sound_buffer.c11
-rw-r--r--recordmydesktop/src/initialize_data.c2
-rw-r--r--recordmydesktop/src/load_cache.c9
6 files changed, 18 insertions, 27 deletions
diff --git a/recordmydesktop/doc/recordmydesktop.1 b/recordmydesktop/doc/recordmydesktop.1
index bb1de6c..1e2d0c2 100644
--- a/recordmydesktop/doc/recordmydesktop.1
+++ b/recordmydesktop/doc/recordmydesktop.1
@@ -262,7 +262,7 @@ Sound Options:
.TP
.B
\-buffer\-size N(number>0)
- A positive number denoting the desired sound buffer size(in frames for ALSA, bytes for OSS).
+ A positive number denoting the desired sound buffer size(in frames).
.br
.TP
.B
@@ -440,4 +440,5 @@ John Varouhakis(johnvarouhakis@gmail.com)
.BR xwininfo(1)
.br
.BR ffmpeg2theora(1)
-.br \ No newline at end of file
+.br
+
diff --git a/recordmydesktop/src/cache_audio.c b/recordmydesktop/src/cache_audio.c
index edcabb3..bff4df2 100644
--- a/recordmydesktop/src/cache_audio.c
+++ b/recordmydesktop/src/cache_audio.c
@@ -33,6 +33,8 @@ void *CacheSoundBuffer(ProgData *pdata){
#ifdef HAVE_LIBASOUND
int framesize=((snd_pcm_format_width(SND_PCM_FORMAT_S16_LE))/8)*
pdata->args.channels;
+#else
+ int framesize=pdata->args.channels<<1;//Always signed 16 bit data
#endif
while((pdata->running)){
SndBuffer *buff;
@@ -58,15 +60,8 @@ void *CacheSoundBuffer(ProgData *pdata){
//advance the list
pdata->sound_buffer=pdata->sound_buffer->next;
pthread_mutex_unlock(&pdata->sound_buffer_mutex);
-#ifdef HAVE_LIBASOUND
fwrite(buff->data,1,pdata->periodsize*framesize,
pdata->cache_data->afp);
-#else
- fwrite(buff->data,1,pdata->args.buffsize,
- pdata->cache_data->afp);
-#endif
-
-
pdata->avd-=pdata->periodtime;
free(buff->data);
diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c
index 4314984..3b69764 100644
--- a/recordmydesktop/src/capture_sound.c
+++ b/recordmydesktop/src/capture_sound.c
@@ -94,7 +94,8 @@ void *CaptureSound(ProgData *pdata){
#ifdef HAVE_LIBASOUND
newbuf->data=(signed char *)malloc(frames*framesize);
#else
- newbuf->data=(signed char *)malloc(pdata->args.buffsize);
+ newbuf->data=(signed char *)malloc(((pdata->args.buffsize<<1)*
+ pdata->args.channels));
#endif
newbuf->next=NULL;
@@ -124,7 +125,8 @@ void *CaptureSound(ProgData *pdata){
do{
int temp_sret=read(pdata->sound_handle,
&newbuf->data[sret],
- pdata->args.buffsize-sret);
+ ((pdata->args.buffsize<<1)*
+ pdata->args.channels)-sret);
if(temp_sret<0){
fprintf(stderr,"An error occured while reading from soundcard"
"%s\n"
@@ -133,7 +135,8 @@ void *CaptureSound(ProgData *pdata){
}
else
sret+=temp_sret;
- }while(sret<pdata->args.buffsize);
+ }while(sret<((pdata->args.buffsize<<1)*
+ pdata->args.channels));
#endif
//queue the new buffer
pthread_mutex_lock(&pdata->sound_buffer_mutex);
diff --git a/recordmydesktop/src/encode_sound_buffer.c b/recordmydesktop/src/encode_sound_buffer.c
index 0e8fa2c..c8a8781 100644
--- a/recordmydesktop/src/encode_sound_buffer.c
+++ b/recordmydesktop/src/encode_sound_buffer.c
@@ -28,11 +28,8 @@
#include <recordmydesktop.h>
void *EncodeSoundBuffer(ProgData *pdata){
-#ifdef HAVE_LIBASOUND
int sampread=pdata->periodsize;
-#else
- int sampread=(pdata->args.buffsize>>1)/pdata->args.channels;
-#endif
+
pdata->v_encoding_clean=0;
while((pdata->running)){
float **vorbis_buffer;
@@ -103,12 +100,8 @@ void *EncodeSoundBuffer(ProgData *pdata){
void SyncEncodeSoundBuffer(ProgData *pdata,signed char *buff){
float **vorbis_buffer;
int count=0,i,j;
-#ifdef HAVE_LIBASOUND
int sampread=(buff!=NULL)?pdata->periodsize:0;
-#else
- int sampread=(buff!=NULL)?((pdata->args.buffsize>>1)/
- pdata->args.channels):0;
-#endif
+
vorbis_buffer=vorbis_analysis_buffer(&pdata->enc_data->m_vo_dsp,sampread);
for(i=0;i<sampread;i++){
for(j=0;j<pdata->args.channels;j++){
diff --git a/recordmydesktop/src/initialize_data.c b/recordmydesktop/src/initialize_data.c
index 4df3a6f..d8f52c0 100644
--- a/recordmydesktop/src/initialize_data.c
+++ b/recordmydesktop/src/initialize_data.c
@@ -139,6 +139,8 @@ int InitializeData(ProgData *pdata,
pdata->args.frequency);
pdata->periodtime=(1000000*pdata->args.buffsize)/
((pdata->args.channels<<1)*pdata->args.frequency);
+ //when using OSS periodsize serves as an alias of buffsize
+ pdata->periodsize=pdata->args.buffsize;
if(pdata->sound_handle<0){
#endif
fprintf(stderr,"Error while opening/configuring soundcard %s\n"
diff --git a/recordmydesktop/src/load_cache.c b/recordmydesktop/src/load_cache.c
index 00ddf96..f75c375 100644
--- a/recordmydesktop/src/load_cache.c
+++ b/recordmydesktop/src/load_cache.c
@@ -135,10 +135,11 @@ void *LoadCache(ProgData *pdata){
#ifdef HAVE_LIBASOUND
int framesize=((snd_pcm_format_width(SND_PCM_FORMAT_S16_LE))/8)*
pdata->args.channels;//audio frame size
- signed char *sound_data=(signed char *)malloc(pdata->periodsize*framesize);
#else
- signed char *sound_data=(signed char *)malloc(pdata->args.buffsize);
+ int framesize=pdata->args.channels<<1;//Always signed 16 bit data
#endif
+ signed char *sound_data=(signed char *)malloc(pdata->periodsize*framesize);
+
u_int32_t YBlocks[(yuv->y_width*yuv->y_height)/Y_UNIT_BYTES],
UBlocks[(yuv->uv_width*yuv->uv_height)/UV_UNIT_BYTES],
VBlocks[(yuv->uv_width*yuv->uv_height)/UV_UNIT_BYTES];
@@ -254,11 +255,7 @@ void *LoadCache(ProgData *pdata){
//audio load and encoding
else{
if(!audio_end){
-#ifdef HAVE_LIBASOUND
int nbytes=fread(sound_data,1,pdata->periodsize*framesize,afp);
-#else
- int nbytes=fread(sound_data,1,pdata->args.buffsize,afp);
-#endif
if(nbytes<=0)
audio_end=1;
else
© All Rights Reserved