diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-04-09 18:28:49 +0100 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-04-09 18:28:49 +0100 |
commit | 39939c95eff90545285a9a8f761d9fa6e9349358 (patch) | |
tree | b8ea1fa3f2ddf1627eeecbd889f47226b01a45d8 /src/audio_dec/xine_dts_decoder.c | |
parent | 19357940a57c565ebe319729bd08d6e4800aff5d (diff) | |
parent | 628c4cbd9d023e74a7c6805d7ec0f163f2c172d1 (diff) | |
download | xine-lib-39939c95eff90545285a9a8f761d9fa6e9349358.tar.gz xine-lib-39939c95eff90545285a9a8f761d9fa6e9349358.tar.bz2 |
Merge from 1.2 main.
Diffstat (limited to 'src/audio_dec/xine_dts_decoder.c')
-rw-r--r-- | src/audio_dec/xine_dts_decoder.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/audio_dec/xine_dts_decoder.c b/src/audio_dec/xine_dts_decoder.c index 2b8dabd10..4f9171d6e 100644 --- a/src/audio_dec/xine_dts_decoder.c +++ b/src/audio_dec/xine_dts_decoder.c @@ -199,19 +199,27 @@ static void dts_decode_frame (dts_decoder_t *this, const int64_t pts, const int audio_buffer->num_frames = this->ac5_pcm_length; - data_out[0] = 0x72; data_out[1] = 0xf8; /* spdif syncword */ - data_out[2] = 0x1f; data_out[3] = 0x4e; /* .............. */ - data_out[4] = ac5_spdif_type; /* DTS data */ - data_out[5] = 0; /* Unknown */ - data_out[6] = (this->ac5_length << 3) & 0xff; /* ac5_length * 8 */ - data_out[7] = ((this->ac5_length ) >> 5) & 0xff; - - if( this->ac5_pcm_length ) { - if( this->ac5_pcm_length % 2) { - swab(data_in, &data_out[8], this->ac5_length ); - } else { - swab(data_in, &data_out[8], this->ac5_length + 1); + // Checking if AC5 data plus IEC958 header will fit into frames samples data + if ( this->ac5_length + 8 <= this->ac5_pcm_length * 2 * 2 ) { + data_out[0] = 0x72; data_out[1] = 0xf8; /* spdif syncword */ + data_out[2] = 0x1f; data_out[3] = 0x4e; /* .............. */ + data_out[4] = ac5_spdif_type; /* DTS data */ + data_out[5] = 0; /* Unknown */ + data_out[6] = (this->ac5_length << 3) & 0xff; /* ac5_length * 8 */ + data_out[7] = ((this->ac5_length ) >> 5) & 0xff; + + if( this->ac5_pcm_length ) { + if( this->ac5_pcm_length % 2) { + swab(data_in, &data_out[8], this->ac5_length ); + } else { + swab(data_in, &data_out[8], this->ac5_length + 1); + } } + // Transmit it without header otherwise, receivers will autodetect DTS + } else { + lprintf("AC5 data is too large (%i > %i), sending without IEC958 header\n", + this->ac5_length + 8, this->ac5_pcm_length * 2 * 2); + memcpy(data_out, data_in, this->ac5_length); } } else { /* Software decode */ |