summaryrefslogtreecommitdiff
path: root/rMD-exp/src/encode_sound_buffer.c
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-28 15:14:57 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-28 15:14:57 +0000
commit5076dbf5c8974316119d6bad42c413a3e3bf5ec9 (patch)
tree588c643d5219145f6947c41cda11d7d5e0e72b33 /rMD-exp/src/encode_sound_buffer.c
parent29d2e46787bee6bc3a951734d40a215088d58692 (diff)
mostly changes on cache writting/loading/encoding,which is now functional.Also var other minor changes
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@124 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'rMD-exp/src/encode_sound_buffer.c')
-rw-r--r--rMD-exp/src/encode_sound_buffer.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/rMD-exp/src/encode_sound_buffer.c b/rMD-exp/src/encode_sound_buffer.c
index 85e277d..73f6d48 100644
--- a/rMD-exp/src/encode_sound_buffer.c
+++ b/rMD-exp/src/encode_sound_buffer.c
@@ -90,4 +90,32 @@ void *EncodeSoundBuffer(void *pdata){
pthread_exit(&errno);
}
-
+void SyncEncodeSoundBuffer(ProgData *pdata,signed char *buff){
+ float **vorbis_buffer;
+ int count=0,i,j;
+ int sampread=pdata->periodsize/(2*pdata->args.channels);
+ 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++){
+ vorbis_buffer[j][i]=((buff[count+1]<<8)|
+ (0x00ff&(int)buff[count]))/32768.f;
+ count+=2;
+ }
+ }
+
+ vorbis_analysis_wrote(&pdata->enc_data->m_vo_dsp,sampread);
+
+ while(vorbis_analysis_blockout(&pdata->enc_data->m_vo_dsp,&pdata->enc_data->m_vo_block)==1){
+
+ vorbis_analysis(&pdata->enc_data->m_vo_block,NULL);
+ vorbis_bitrate_addblock(&pdata->enc_data->m_vo_block);
+
+ while(vorbis_bitrate_flushpacket(&pdata->enc_data->m_vo_dsp,&pdata->enc_data->m_ogg_pckt2)){
+ pthread_mutex_lock(&pdata->libogg_mutex);
+ ogg_stream_packetin(&pdata->enc_data->m_ogg_vs,&pdata->enc_data->m_ogg_pckt2);
+ pthread_mutex_unlock(&pdata->libogg_mutex);
+ }
+ }
+ pdata->avd-=pdata->periodtime;
+}
+
© All Rights Reserved