diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-12-09 14:54:00 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-12-09 14:54:00 +0000 |
commit | 9659592e810f34724abbb76d072472ceca4bbc97 (patch) | |
tree | 17fbafcf2b40913a43e266291e6b191a43d10bb4 | |
parent | 5cc91a08f6313e0b758063b7dfd31244d43eb9a0 (diff) |
corrected(added) eos on both streams
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@226 f606c939-3180-4ac9-a4b8-4b8779d57d0a
-rw-r--r-- | recordmydesktop/src/cache_audio.c | 3 | ||||
-rw-r--r-- | recordmydesktop/src/cache_frame.c | 2 | ||||
-rw-r--r-- | recordmydesktop/src/capture_sound.c | 2 | ||||
-rw-r--r-- | recordmydesktop/src/encode_image_buffer.c | 4 | ||||
-rw-r--r-- | recordmydesktop/src/encode_sound_buffer.c | 4 | ||||
-rw-r--r-- | recordmydesktop/src/flush_to_ogg.c | 18 | ||||
-rw-r--r-- | recordmydesktop/src/load_cache.c | 9 |
7 files changed, 24 insertions, 18 deletions
diff --git a/recordmydesktop/src/cache_audio.c b/recordmydesktop/src/cache_audio.c index 156f4a1..99465de 100644 --- a/recordmydesktop/src/cache_audio.c +++ b/recordmydesktop/src/cache_audio.c @@ -30,6 +30,7 @@ void *CacheSoundBuffer(ProgData *pdata){ //It's sound is tiny compared to that of image, so //compressing would reducethe overall size by only an //insignificant fraction. + int framesize=((snd_pcm_format_width(SND_PCM_FORMAT_S16_LE))/8)*pdata->args.channels; pthread_mutex_t smut; pthread_mutex_init(&smut,NULL); while((pdata->running)){ @@ -50,7 +51,7 @@ void *CacheSoundBuffer(ProgData *pdata){ pdata->sound_buffer=pdata->sound_buffer->next; pthread_mutex_unlock(&pdata->sound_buffer_mutex); - fwrite(buff->data,pdata->periodsize,1,pdata->cache_data->afp); + fwrite(buff->data,pdata->periodsize*framesize,1,pdata->cache_data->afp); diff --git a/recordmydesktop/src/cache_frame.c b/recordmydesktop/src/cache_frame.c index 7f8c826..813b9e0 100644 --- a/recordmydesktop/src/cache_frame.c +++ b/recordmydesktop/src/cache_frame.c @@ -222,7 +222,7 @@ void *CacheImageBuffer(ProgData *pdata){ /**@________________@**/ - pdata->avd+=pdata->frametime*2*pdata->args.channels; + pdata->avd+=pdata->frametime; if(nbytes>CACHE_FILE_SIZE_LIMIT){ if(SwapCacheFilesWrite(pdata->cache_data->imgdata,nth_cache,&fp,&ucfp)){ fprintf(stderr,"New cache file could not be created.\nEnding recording...\n"); diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c index 159ccd3..f4a7aea 100644 --- a/recordmydesktop/src/capture_sound.c +++ b/recordmydesktop/src/capture_sound.c @@ -30,7 +30,7 @@ void *CaptureSound(ProgData *pdata){ int frames=pdata->periodsize; - int framesize=snd_pcm_format_width(SND_PCM_FORMAT_S16_LE)*pdata->args.channels; + int framesize=((snd_pcm_format_width(SND_PCM_FORMAT_S16_LE))/8)*pdata->args.channels; pthread_mutex_t pmut; pthread_mutex_init(&pmut,NULL); diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c index b68a71e..979916d 100644 --- a/recordmydesktop/src/encode_image_buffer.c +++ b/recordmydesktop/src/encode_image_buffer.c @@ -45,7 +45,7 @@ void *EncodeImageBuffer(ProgData *pdata){ pthread_mutex_lock(&pdata->libogg_mutex); ogg_stream_packetin(&pdata->enc_data->m_ogg_ts,&pdata->enc_data->m_ogg_pckt1); pthread_mutex_unlock(&pdata->libogg_mutex); - pdata->avd+=pdata->frametime*2*pdata->args.channels; + pdata->avd+=pdata->frametime; } } encoder_busy=0; @@ -76,7 +76,7 @@ void SyncEncodeImageBuffer(ProgData *pdata){ ogg_stream_packetin(&pdata->enc_data->m_ogg_ts, &pdata->enc_data->m_ogg_pckt1); pthread_mutex_unlock(&pdata->libogg_mutex); - pdata->avd+=pdata->frametime*2*pdata->args.channels; + pdata->avd+=pdata->frametime; } } } diff --git a/recordmydesktop/src/encode_sound_buffer.c b/recordmydesktop/src/encode_sound_buffer.c index aeea402..ee19628 100644 --- a/recordmydesktop/src/encode_sound_buffer.c +++ b/recordmydesktop/src/encode_sound_buffer.c @@ -29,7 +29,7 @@ void *EncodeSoundBuffer(ProgData *pdata){ - int sampread=pdata->periodsize/(2*pdata->args.channels); + int sampread=pdata->periodsize; pthread_mutex_t smut; pthread_mutex_init(&smut,NULL); while((pdata->running)){ @@ -93,7 +93,7 @@ void *EncodeSoundBuffer(ProgData *pdata){ void SyncEncodeSoundBuffer(ProgData *pdata,signed char *buff){ float **vorbis_buffer; int count=0,i,j; - int sampread=pdata->periodsize/(2*pdata->args.channels); + int sampread=pdata->periodsize; 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/flush_to_ogg.c b/recordmydesktop/src/flush_to_ogg.c index f28adbe..8fa762f 100644 --- a/recordmydesktop/src/flush_to_ogg.c +++ b/recordmydesktop/src/flush_to_ogg.c @@ -54,20 +54,24 @@ void *FlushToOgg(ProgData *pdata){ } //last packages + pdata->enc_data->m_ogg_ts.e_o_s=1; videoflag=ogg_stream_flush(&pdata->enc_data->m_ogg_ts,&videopage); if(videoflag){ video_bytesout+=fwrite(videopage.header,1,videopage.header_len,pdata->enc_data->fp); video_bytesout+=fwrite(videopage.body,1,videopage.body_len,pdata->enc_data->fp); videoflag=0; } - if(!pdata->args.nosound) - audioflag=ogg_stream_flush(&pdata->enc_data->m_ogg_vs,&audiopage); - if(audioflag){ - audio_bytesout+=fwrite(audiopage.header,1,audiopage.header_len,pdata->enc_data->fp); - audio_bytesout+=fwrite(audiopage.body,1,audiopage.body_len,pdata->enc_data->fp); - audioflag=0; + if(!pdata->args.nosound){ + pdata->enc_data->m_ogg_vs.e_o_s=1; + do{ + audioflag=ogg_stream_flush(&pdata->enc_data->m_ogg_vs,&audiopage); + if(audioflag){ + audio_bytesout+=fwrite(audiopage.header,1,audiopage.header_len,pdata->enc_data->fp); + audio_bytesout+=fwrite(audiopage.body,1,audiopage.body_len,pdata->enc_data->fp); + audioflag=0; + } + }while(!ogg_page_eos(&audiopage)); } - ogg_stream_clear(&pdata->enc_data->m_ogg_ts); if(!pdata->args.nosound) ogg_stream_clear(&pdata->enc_data->m_ogg_vs); diff --git a/recordmydesktop/src/load_cache.c b/recordmydesktop/src/load_cache.c index 8a61159..eee3fb7 100644 --- a/recordmydesktop/src/load_cache.c +++ b/recordmydesktop/src/load_cache.c @@ -48,8 +48,6 @@ void *LoadCache(ProgData *pdata){ FILE *afp=pdata->cache_data->afp; FrameHeader fheader; CachedFrame frame; - signed char *sound_data=(signed char *)malloc(pdata->periodsize); - int j=0, nth_cache=1, audio_end=0, @@ -59,7 +57,10 @@ void *LoadCache(ProgData *pdata){ thread_exit=0,//0 success, -1 couldn't find files,1 couldn't remove divisor=16, blockszy=0,//size of y plane block in bytes - blockszuv=0;//size of u,v plane blocks in bytes + blockszuv=0,//size of u,v plane blocks in bytes + 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); + //we allocate the frame that we will use INIT_FRAME(&frame,&fheader,yuv) //and the we open our files @@ -185,7 +186,7 @@ void *LoadCache(ProgData *pdata){ //audio load and encoding else{ if(!audio_end){ - int nbytes=fread(sound_data,pdata->periodsize,1,afp); + int nbytes=fread(sound_data,pdata->periodsize*framesize,1,afp); if(nbytes<=0) audio_end=1; else |