summaryrefslogtreecommitdiff
path: root/rMD-exp
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
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')
-rw-r--r--rMD-exp/include/recordmydesktop.h1
-rw-r--r--rMD-exp/src/cache_audio.c38
-rw-r--r--rMD-exp/src/recordmydesktop.c2
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);
© All Rights Reserved