[vlc-commits] twolame: implement flushing on close
Ilkka Ollakka
git at videolan.org
Wed Jan 8 12:21:57 CET 2014
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Mon Jan 6 20:15:37 2014 +0200| [2c34c934467e389fcd606cfe7b56f534ee263c03] | committer: Ilkka Ollakka
twolame: implement flushing on close
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c34c934467e389fcd606cfe7b56f534ee263c03
---
modules/codec/twolame.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
index 092fd7d..996f4aa 100644
--- a/modules/codec/twolame.c
+++ b/modules/codec/twolame.c
@@ -261,13 +261,29 @@ static void Bufferize( encoder_t *p_enc, int16_t *p_in, int i_nb_samples )
static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
+ block_t *p_chain = NULL;
+
+ if( unlikely( !p_aout_buf ) ) {
+ int i_used = 0;
- /* FIXME:p_aout_buf is NULL when it's time to flush, does twolame has buffer to flush?*/
- if( unlikely( !p_aout_buf ) ) return NULL;
+ i_used = twolame_encode_flush_interleaved( p_sys->p_twolame,
+ p_sys->p_out_buffer, MAX_CODED_FRAME_SIZE );
+
+ if( i_used < 0 )
+ return NULL;
+
+ p_block = block_Alloc( i_used );
+ memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used );
+ p_block->i_length = (mtime_t)1000000 *
+ (mtime_t)MPEG_FRAME_SIZE / (mtime_t)p_enc->fmt_out.audio.i_rate;
+ p_block->i_dts = p_block->i_pts = p_sys->i_pts;
+ p_sys->i_pts += p_block->i_length;
+
+ return p_block;
+ }
int16_t *p_buffer = (int16_t *)p_aout_buf->p_buffer;
int i_nb_samples = p_aout_buf->i_nb_samples;
- block_t *p_chain = NULL;
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_nb_samples /
More information about the vlc-commits
mailing list