summaryrefslogtreecommitdiff
path: root/src/libxineadec
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-05-29 19:00:05 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-05-29 19:00:05 +0200
commitdcd3bdb0ea6df1a110f317ad4d8995653d9ba5a9 (patch)
tree714708e14bc8b4ac0f0d12748bf4620339e7e6bd /src/libxineadec
parent046a8f021304f131a46e290cab40ee8c8db9c6ea (diff)
downloadxine-lib-dcd3bdb0ea6df1a110f317ad4d8995653d9ba5a9.tar.gz
xine-lib-dcd3bdb0ea6df1a110f317ad4d8995653d9ba5a9.tar.bz2
Use the integer versions of Speex decoding functions, this avoids an iteration over the decoded frames to transform them to integer, and also avoids an improper saturation.
Diffstat (limited to 'src/libxineadec')
-rw-r--r--src/libxineadec/xine_speex_decoder.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/libxineadec/xine_speex_decoder.c b/src/libxineadec/xine_speex_decoder.c
index b729dc3bb..034e726a6 100644
--- a/src/libxineadec/xine_speex_decoder.c
+++ b/src/libxineadec/xine_speex_decoder.c
@@ -72,8 +72,6 @@ typedef struct speex_decoder_s {
SpeexStereoState stereo;
int expect_metadata;
- float output[MAX_FRAME_SIZE];
-
int header_count;
xine_stream_t *stream;
@@ -296,9 +294,8 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
for (j = 0; j < this->nframes; j++) {
int ret;
int bitrate;
- ogg_int16_t * ptr = audio_buffer->mem;
- ret = speex_decode (this->st, &this->bits, this->output);
+ ret = speex_decode_int (this->st, &this->bits, audio_buffer->mem);
if (ret==-1)
break;
@@ -312,27 +309,13 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
}
if (this->channels == 2) {
- speex_decode_stereo (this->output, this->frame_size, &this->stereo);
+ speex_decode_stereo_int (audio_buffer->mem, this->frame_size, &this->stereo);
}
speex_decoder_ctl (this->st, SPEEX_GET_BITRATE, &bitrate);
if (bitrate <= 1) bitrate = 16000; /* assume 16 kbit */
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, bitrate);
- /*PCM saturation (just in case)*/
- for (i=0; i < this->frame_size * this->channels; i++)
- {
- if (this->output[i]>32000.0)
- this->output[i]=32000.0;
- else if (this->output[i]<-32000.0)
- this->output[i]=-32000.0;
- }
-
- /*Convert to short and play */
- for (i=0; i< this->frame_size * this->channels; i++) {
- *ptr++ = (ogg_int16_t)this->output[i];
- }
-
audio_buffer->vpts = this->pts;
this->pts=0;
audio_buffer->num_frames = this->frame_size;