int i_frame;
/* Output buffer */
+ char *p_out_buffer;
char *p_out;
+ unsigned int i_out;
/* Codec params */
void *context;
p_sys->i_subpacket = 0;
p_sys->i_frame = 0;
- p_sys->p_out = malloc( 4096 * 10 );
+ p_sys->p_out_buffer = malloc( 4096 * 10 );
+ p_sys->p_out = 0;
+ p_sys->i_out = 0;
return VLC_SUCCESS;
}
CloseDll( p_dec );
if( p_dec->p_sys->p_frame ) free( p_dec->p_sys->p_frame );
- if( p_dec->p_sys->p_out ) free( p_dec->p_sys->p_out );
+ if( p_dec->p_sys->p_out_buffer ) free( p_dec->p_sys->p_out_buffer );
free( p_dec->p_sys );
}
char *ppsz_path[] =
{
".",
- "z:\\home\\videolan\\vlc",
- "/home/videolan/vlc",
#ifndef WIN32
"/usr/local/RealPlayer8/Codecs",
"/usr/RealPlayer8/Codecs",
}
#endif
+ /* Output 1024 samples at a time
+ * (the audio output doesn't like big audio packets) */
+ if( p_sys->i_out )
+ {
+ int i_out;
+ int i_samples = p_sys->i_out * 8 /
+ p_dec->fmt_out.audio.i_bitspersample /
+ p_dec->fmt_out.audio.i_channels;
+
+ i_samples = __MIN( i_samples, 1024 );
+ i_out = i_samples * p_dec->fmt_out.audio.i_bitspersample *
+ p_dec->fmt_out.audio.i_channels / 8;
+
+ p_aout_buffer = p_dec->pf_aout_buffer_new( p_dec, i_samples );
+ if( p_aout_buffer == NULL ) return NULL;
+ memcpy( p_aout_buffer->p_buffer, p_sys->p_out, i_out );
+
+ p_sys->i_out -= i_out;
+ p_sys->p_out += i_out;
+
+ /* Date management */
+ p_aout_buffer->start_date = aout_DateGet( &p_sys->end_date );
+ p_aout_buffer->end_date =
+ aout_DateIncrement( &p_sys->end_date, i_samples );
+
+ return p_aout_buffer;
+ }
+
/* If we have a full frame ready then we can start decoding */
if( p_sys->i_frame )
{
- char *p_out = p_sys->p_out;
- unsigned int i_out, i_result;
- int i_samples;
+ unsigned int i_result;
+
+ p_sys->p_out = p_sys->p_out_buffer;
if( p_sys->dll )
i_result = p_sys->raDecode( p_sys->context, p_sys->p_frame +
p_sys->i_frame_size - p_sys->i_frame,
p_dec->fmt_in.audio.i_blockalign,
- p_out, &i_out, -1 );
+ p_sys->p_out, &p_sys->i_out, -1 );
else
i_result = p_sys->wraDecode( p_sys->context, p_sys->p_frame +
p_sys->i_frame_size - p_sys->i_frame,
p_dec->fmt_in.audio.i_blockalign,
- p_out, &i_out, -1 );
-
- i_samples = i_out * 8 / p_dec->fmt_out.audio.i_bitspersample /
- p_dec->fmt_out.audio.i_channels;
+ p_sys->p_out, &p_sys->i_out, -1 );
#if 0
msg_Err( p_dec, "decoded: %i samples (%i)",
- i_samples, i_result );
+ p_sys->i_out * 8 / p_dec->fmt_out.audio.i_bitspersample /
+ p_dec->fmt_out.audio.i_channels, i_result );
#endif
p_sys->i_frame -= p_dec->fmt_in.audio.i_blockalign;
- p_aout_buffer = p_dec->pf_aout_buffer_new( p_dec, i_samples );
- if( p_aout_buffer == NULL ) return NULL;
- memcpy( p_aout_buffer->p_buffer, p_out, i_out );
-
- /* Date management */
- p_aout_buffer->start_date = aout_DateGet( &p_sys->end_date );
- p_aout_buffer->end_date =
- aout_DateIncrement( &p_sys->end_date, i_samples );
-
- return p_aout_buffer;
+ return Decode( p_dec, pp_block );
}