diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-03-02 22:43:00 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-03-02 22:43:00 +0000 |
commit | c96ecb56ab59611dbca40616566b159937dff958 (patch) | |
tree | c3aeaf79c4456d6213c658461e057829ae3e5c4b | |
parent | f574d29a8c23c07e04c7cdc91e9e9a877ee70277 (diff) | |
download | xine-lib-c96ecb56ab59611dbca40616566b159937dff958.tar.gz xine-lib-c96ecb56ab59611dbca40616566b159937dff958.tar.bz2 |
Reorganise DTS audio type detection (ready for LE16 & BE14); changelog entry.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/demuxers/demux_dts.c | 47 |
2 files changed, 29 insertions, 19 deletions
@@ -10,6 +10,7 @@ xine-lib (1.1.11) unreleased scripts use xine-lib's automake macros. * Fixed an off-by-one in the FLAC security fix patch. This breakage was causing failure to play some files. + * Support 16-bit big-endian DTS audio. xine-lib (1.1.10.1) 2008-02-07 * Security fixes: diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c index 2ea119858..c99a0688a 100644 --- a/src/demuxers/demux_dts.c +++ b/src/demuxers/demux_dts.c @@ -154,42 +154,48 @@ static int open_dts_file(demux_dts_t *this) { /* 16 bits and big endian bitstream */ if (syncword == 0x7ffe8001) { dts_version = 0; + break; } - /* 14 bits and little endian bitstream */ - if ((syncword == 0xff1f00e8) && - ((peak[i] & 0xf0) == 0xf0) && (peak[i+1] == 0x07)) { + else if ((syncword == 0xff1f00e8) && + ((peak[i] & 0xf0) == 0xf0) && (peak[i+1] == 0x07)) { dts_version = 3; - } - - if ( dts_version != -1 ) { - this->data_start = i-4; - lprintf("found DTS syncword at offset %d\n", i-4); - break; + break; } syncword = (syncword << 8) | peak[i]; } + if (dts_version == -1) { + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": unsupported DTS stream type, or not a DTS stream\n"); + return 0; + } + + this->data_start = i-4; + lprintf("found DTS syncword at offset %d\n", i-4); + if (i < peak_size-9) { unsigned int nblks, fsize, sfreq; - /* 16 bits and big endian bitstream */ - if (dts_version == 0) { + switch (dts_version) + { + case 0: /* BE16 */ nblks = ((peak[this->data_start+4] & 0x01) << 6) | ((peak[this->data_start+5] & 0xfc) >> 2); fsize = (((peak[this->data_start+5] & 0x03) << 12) |(peak[this->data_start+6] << 4) | ((peak[this->data_start+7] & 0xf0) >> 4)) + 1; sfreq = (peak[this->data_start+8] & 0x3c) >> 2; - } + break; - /* 14 bits and little endian bitstream */ - if (dts_version == 3) { + case 3: /* LE14 */ nblks = ((peak[this->data_start+4] & 0x07) << 4) | ((peak[this->data_start+7] & 0x3c) >> 2); fsize = (((peak[this->data_start+7] & 0x03) << 12) | (peak[this->data_start+6] << 4) | ((peak[this->data_start+9] & 0x3c) >> 2)) + 1; sfreq = peak[this->data_start+8] & 0x0f; + break; + } if ((sfreq > sizeof(dts_sample_rates)/sizeof(int)) || @@ -199,13 +205,16 @@ static int open_dts_file(demux_dts_t *this) { /* Big assumption - this is CBR data */ this->samples_per_frame = (nblks + 1) * 32; - /* 16 bits and big endian bitstream */ - if (dts_version == 0) { + switch (dts_version) + { + case 0: /* BE16 */ + case 1: /* LE16 */ this->frame_size = fsize * 8 / 16 * 2; - } - /* 14 bits and little endian bitstream */ - else if (dts_version == 3) { + break; + case 2: /* BE14 */ + case 3: /* LE14 */ this->frame_size = fsize * 8 / 14 * 2; + break; } this->sample_rate = dts_sample_rates[sfreq]; |