From: James Courtier-D. <jcd...@us...> - 2004-07-18 17:31:49
|
Update of /cvsroot/xine/xine-lib/src/libdts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25063/xine-lib/src/libdts Modified Files: xine_decoder.c Log Message: Add support for 44100Hz DTS in .wav files. Index: xine_decoder.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libdts/xine_decoder.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- xine_decoder.c 7 Jun 2004 11:03:18 -0000 1.55 +++ xine_decoder.c 18 Jul 2004 17:31:40 -0000 1.56 @@ -49,6 +49,7 @@ #include "buffer.h" #include "dts.h" +#define MAX_AC5_FRAME 4096 typedef struct { audio_decoder_class_t decoder_class; @@ -70,7 +71,7 @@ int sync_state; int ac5_length, ac5_pcm_length, frame_todo; uint32_t syncdword; - uint8_t frame_buffer[3840]; + uint8_t frame_buffer[MAX_AC5_FRAME]; uint8_t *frame_ptr; int output_open; @@ -202,7 +203,7 @@ } #endif - lprintf("length=%d loop=%d pts=%lld\n",this->ac5_pcm_length,n,audio_buffer->vpts); + lprintf("length=%d pts=%lld\n",this->ac5_pcm_length,audio_buffer->vpts); audio_buffer->num_frames = this->ac5_pcm_length; @@ -359,13 +360,27 @@ this->sync_state = 1; this->frame_ptr = this->frame_buffer+4; this->pts = buf->pts; + break; + } + if ((this->syncdword == 0xff1f00e8)) { + + lprintf ("sync found: syncdword=0x%x\n", this->syncdword); + this->frame_buffer[0] = 0xff; + this->frame_buffer[1] = 0x1f; + this->frame_buffer[2] = 0x00; + this->frame_buffer[3] = 0xe8; + + this->sync_state = 1; + this->frame_ptr = this->frame_buffer+4; + this->pts = buf->pts; + break; } break; case 1: /* Looking for enough bytes for sync_info. */ sync_start = current - 1; *this->frame_ptr++ = *current++; - if ((this->frame_ptr - this->frame_buffer) > 16) { + if ((this->frame_ptr - this->frame_buffer) > 19) { int old_dts_flags = this->dts_flags; int old_dts_sample_rate = this->dts_sample_rate; int old_dts_bit_rate = this->dts_bit_rate; @@ -374,8 +389,10 @@ &this->dts_flags, &this->dts_sample_rate, &this->dts_bit_rate, &(this->ac5_pcm_length)); + lprintf("ac5_length=%d\n",this->ac5_length); + lprintf("dts_sample_rate=%d\n",this->dts_sample_rate); - if (this->ac5_length < 80) { /* Invalid dts ac5_pcm_length */ + if ( (this->ac5_length < 80) || (this->ac5_length > MAX_AC5_FRAME) ) { /* Invalid dts ac5_pcm_length */ this->syncdword = 0; current = sync_start; this->sync_state = 0; @@ -384,7 +401,7 @@ lprintf("Frame length = %d\n",this->ac5_pcm_length); - this->frame_todo = this->ac5_length - 17; + this->frame_todo = this->ac5_length - 20; this->sync_state = 2; if (!_x_meta_info_get(this->stream, XINE_META_INFO_AUDIOCODEC) || old_dts_flags != this->dts_flags || |