diff options
-rw-r--r-- | rMD-exp/include/recordmydesktop.h | 1 | ||||
-rw-r--r-- | rMD-exp/src/cache_audio.c | 38 | ||||
-rw-r--r-- | rMD-exp/src/recordmydesktop.c | 2 |
3 files changed, 41 insertions, 0 deletions
diff --git a/rMD-exp/include/recordmydesktop.h b/rMD-exp/include/recordmydesktop.h index 1c3ebe0..4997a72 100644 --- a/rMD-exp/include/recordmydesktop.h +++ b/rMD-exp/include/recordmydesktop.h @@ -589,5 +589,6 @@ void SizePack2_8_16(int *start,int *size,int limit); void *CacheImageBuffer(void *pdata); void InitCacheData(ProgData *pdata,EncData *enc_data_t,CacheData *cache_data_t); void InitCacheData(ProgData *pdata,EncData *enc_data_t,CacheData *cache_data_t); +void *CacheSoundBuffer(void *pdata); #endif diff --git a/rMD-exp/src/cache_audio.c b/rMD-exp/src/cache_audio.c index 5bd625f..7b17d7b 100644 --- a/rMD-exp/src/cache_audio.c +++ b/rMD-exp/src/cache_audio.c @@ -25,5 +25,43 @@ **********************************************************************************/ #include <recordmydesktop.h> +void *CacheSoundBuffer(void *pdata){ +//We are simply going to throw sound on the disk. +//It's sound is tiny compared to that of image, so +//compressing would reducethe overall size by only an +//insignificant fraction. + pthread_mutex_t smut; + pthread_mutex_init(&smut,NULL); + while((((ProgData *)pdata)->running)){ + SndBuffer *buff; + + if(Paused){ + pthread_mutex_t tmut; + pthread_mutex_init(&tmut,NULL); + pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&tmut); + } + + if(((ProgData *)pdata)->sound_buffer==NULL) + pthread_cond_wait(&((ProgData *)pdata)->sound_data_read,&smut); + + pthread_mutex_lock(&((ProgData *)pdata)->sound_buffer_mutex); + buff=((ProgData *)pdata)->sound_buffer; + //advance the list + ((ProgData *)pdata)->sound_buffer=((ProgData *)pdata)->sound_buffer->next; + pthread_mutex_unlock(&((ProgData *)pdata)->sound_buffer_mutex); + + fwrite(buff->data,((ProgData *)pdata)->periodsize,1,((ProgData *)pdata)->cache_data->afp); + + + + ((ProgData *)pdata)->avd-=((ProgData *)pdata)->periodtime; + + free(buff->data); + free(buff); + } + + fclose(((ProgData *)pdata)->cache_data->afp); + pthread_exit(&errno); +} diff --git a/rMD-exp/src/recordmydesktop.c b/rMD-exp/src/recordmydesktop.c index df7fbb3..c02ecdf 100644 --- a/rMD-exp/src/recordmydesktop.c +++ b/rMD-exp/src/recordmydesktop.c @@ -58,6 +58,7 @@ int main(int argc,char **argv){ image_cache_t, sound_capture_t, sound_encode_t, + sound_cache_t, flush_to_ogg_t; XShmSegmentInfo shminfo; int i; @@ -189,6 +190,7 @@ int main(int argc,char **argv){ if(!pdata.args.nosound){ pthread_create(&sound_capture_t,NULL,CaptureSound,(void *)&pdata); + pthread_create(&sound_cache_t,NULL,CacheSoundBuffer,(void *)&pdata); // pthread_create(&sound_encode_t,NULL,EncodeSoundBuffer,(void *)&pdata); } // pthread_create(&flush_to_ogg_t,NULL,FlushToOgg,(void *)&pdata); |