summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Kretz <kretz@kde.org>2007-11-23 18:06:26 +0100
committerMatthias Kretz <kretz@kde.org>2007-11-23 18:06:26 +0100
commitc1f730ab426636b5fea1dc657d2278950ace5de6 (patch)
tree60927ef5a5341543b0d27221d9b6b9b4fa410823
parent3a6cd7956f573a2f81354467a038586e1df35d81 (diff)
downloadxine-lib-c1f730ab426636b5fea1dc657d2278950ace5de6.tar.gz
xine-lib-c1f730ab426636b5fea1dc657d2278950ace5de6.tar.bz2
fix one warning; remove unused variable; make float->int conversion a bit more accurate (compared to oggdec); fix one debug printf
-rw-r--r--src/libxineadec/xine_vorbis_decoder.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libxineadec/xine_vorbis_decoder.c b/src/libxineadec/xine_vorbis_decoder.c
index c7b1e5761..297d16349 100644
--- a/src/libxineadec/xine_vorbis_decoder.c
+++ b/src/libxineadec/xine_vorbis_decoder.c
@@ -160,7 +160,7 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
if( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ){
/* error case; not a vorbis header */
xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res);
- xine_hexdump(this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64);
+ xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64);
return;
}
@@ -221,7 +221,6 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
*/
int i,j;
- int clipflag=0;
int bout=(samples<this->convsize?samples:this->convsize);
audio_buffer_t *audio_buffer;
@@ -233,15 +232,13 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
ogg_int16_t *ptr=audio_buffer->mem+i;
float *mono=pcm[i];
for(j=0;j<bout;j++){
- int val=mono[j]*32767.f;
+ int val=(mono[j] + 1.0f) * 32768.f;
+ val -= 32768;
/* might as well guard against clipping */
if(val>32767){
val=32767;
- clipflag=1;
- }
- if(val<-32768){
+ } else if(val<-32768){
val=-32768;
- clipflag=1;
}
*ptr=val;
ptr+=this->vi.channels;
@@ -259,8 +256,9 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
/* tell libvorbis how many samples we actually consumed */
vorbis_synthesis_read(&this->vd,bout);
}
- }
- lprintf("output not open\n");
+ } else {
+ lprintf("output not open\n");
+ }
}
static void vorbis_dispose (audio_decoder_t *this_gen) {