Commit cb792fd5 authored by Tristan Matthews's avatar Tristan Matthews

speex: cosmetics

parent 08feb323
......@@ -558,18 +558,18 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
i_pcm_output_size = p_sys->p_header->frame_size;
p_frame_holder = (short*)xmalloc( sizeof(short)*i_pcm_output_size );
speex_bits_read_from( &p_sys->bits, (char*)p_oggpacket->packet,
speex_bits_read_from( &p_sys->bits, (char*)p_oggpacket->packet,
p_oggpacket->bytes);
i_bits_before = speex_bits_remaining( &p_sys->bits );
i_bits_before = speex_bits_remaining( &p_sys->bits );
speex_decode_int(p_sys->p_state, &p_sys->bits, p_frame_holder);
i_bits_after = speex_bits_remaining( &p_sys->bits );
i_bits_in_speex_frame = i_bits_before - i_bits_after;
i_bits_in_speex_frame = i_bits_before - i_bits_after;
i_bytes_in_speex_frame = ( i_bits_in_speex_frame +
(8 - (i_bits_in_speex_frame % 8)) )
/ 8;
/ 8;
p_new_block = block_Alloc( i_bytes_in_speex_frame );
p_new_block = block_Alloc( i_bytes_in_speex_frame );
memset( p_new_block->p_buffer, 0xff, i_bytes_in_speex_frame );
/*
......@@ -644,7 +644,7 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
*/
if ( p_sys->bits.buf_size==0 )
{
p_sys->p_header = (SpeexHeader *)malloc(sizeof(SpeexHeader));
p_sys->p_header = malloc(sizeof(SpeexHeader));
if ( !p_sys->p_header )
{
msg_Err( p_dec, "Could not allocate a Speex header.");
......@@ -654,7 +654,7 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
const SpeexMode *mode = speex_lib_get_mode((p_sys->rtp_rate / 8000) >> 1);
speex_init_header( p_sys->p_header,p_sys->rtp_rate, 1, mode );
speex_bits_init( &p_sys->bits );
speex_bits_init( &p_sys->bits );
p_sys->p_state = speex_decoder_init( mode );
if ( !p_sys->p_state )
{
......@@ -663,22 +663,22 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
return NULL;
}
/*
/*
Assume that variable bit rate is enabled. Also assume
that there is only one frame per packet.
*/
p_sys->p_header->vbr = 1;
p_sys->p_header->frames_per_packet = 1;
p_dec->fmt_out.audio.i_channels = p_sys->p_header->nb_channels;
p_dec->fmt_out.audio.i_channels = p_sys->p_header->nb_channels;
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels =
pi_channels_maps[p_sys->p_header->nb_channels];
p_dec->fmt_out.audio.i_rate = p_sys->p_header->rate;
p_dec->fmt_out.audio.i_rate = p_sys->p_header->rate;
if ( speex_mode_query( &speex_nb_mode,
SPEEX_MODE_FRAME_SIZE,
&i_speex_frame_size ) )
if ( speex_mode_query( &speex_nb_mode,
SPEEX_MODE_FRAME_SIZE,
&i_speex_frame_size ) )
{
msg_Err( p_dec, "Could not determine the frame size." );
speex_decoder_destroy( p_sys->p_state );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment