summaryrefslogtreecommitdiff
path: root/rMD-exp/src/cache_audio.c
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-26 03:08:30 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-26 03:08:30 +0000
commit942f01938f9799801c925bfe296c880fef2be846 (patch)
tree56c05b57437cf7843d0f3af60ed343d4dbe2e573 /rMD-exp/src/cache_audio.c
parenta304339236a566a7a1976597e33aea2009b14796 (diff)
audio caching
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@117 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'rMD-exp/src/cache_audio.c')
-rw-r--r--rMD-exp/src/cache_audio.c38
1 files changed, 38 insertions, 0 deletions
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);
+}
© All Rights Reserved