summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/combined/flac_decoder.c27
-rw-r--r--src/demuxers/demux_flac.c7
3 files changed, 25 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e52905bd..50a240d43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -75,6 +75,8 @@ xine-lib (1.1.1?) 20??-??-??
* Build fix (undefined symbol) for when using older ffmpeg.
* TTA demuxer fixes; allow seeking.
* More meta-information tags. (Nothing sets these yet, though.)
+ * Added basic support for .qtl (Quicktime media link).
+ * "Fixed" playback of 24-bit FLAC.
xine-lib (1.1.17) 2009-12-01
* Add support for Matroska SIMPLEBLOCK.
diff --git a/src/combined/flac_decoder.c b/src/combined/flac_decoder.c
index 312749c7b..0b2250678 100644
--- a/src/combined/flac_decoder.c
+++ b/src/combined/flac_decoder.c
@@ -114,7 +114,7 @@ flac_write_callback (const FLAC__StreamDecoder *decoder,
flac_decoder_t *this = (flac_decoder_t *)client_data;
audio_buffer_t *audio_buffer = NULL;
int samples_left = frame->header.blocksize;
- int bytes_per_sample = (frame->header.bits_per_sample == 8)?1:2;
+ int bytes_per_sample = (frame->header.bits_per_sample <= 8) ? 1 : 2;
int buf_samples;
int8_t *data8;
int16_t *data16;
@@ -131,21 +131,31 @@ flac_write_callback (const FLAC__StreamDecoder *decoder,
else
buf_samples = samples_left;
-
- if( frame->header.bits_per_sample == 8 ) {
+ switch (frame->header.bits_per_sample) {
+ case 8:
data8 = (int8_t *)audio_buffer->mem;
for( j=0; j < buf_samples; j++ )
for( i=0; i < frame->header.channels; i++ )
*data8++ = buffer[i][j];
+ break;
- } else {
-
+ case 16:
data16 = (int16_t *)audio_buffer->mem;
for( j=0; j < buf_samples; j++ )
for( i=0; i < frame->header.channels; i++ )
*data16++ = buffer[i][j];
+ break;
+
+ case 24:
+ data16 = (int16_t *)audio_buffer->mem;
+
+ for( j=0; j < buf_samples; j++ )
+ for( i=0; i < frame->header.channels; i++ )
+ *data16++ = buffer[i][j] >> 8;
+ break;
+
}
audio_buffer->num_frames = buf_samples;
@@ -250,14 +260,13 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
if (!this->output_open)
{
+ const int bits = this->bits_per_sample;
this->output_open = (this->stream->audio_out->open) (
this->stream->audio_out,
this->stream,
- bits_per_sample,
- sample_rate,
+ bits > 16 ? 16 : bits,
+ this->sample_rate,
mode);
-
-
}
this->buf_pos = 0;
} else if (this->output_open)
diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c
index 0c2545441..ffb49e74e 100644
--- a/src/demuxers/demux_flac.c
+++ b/src/demuxers/demux_flac.c
@@ -363,12 +363,15 @@ static void demux_flac_send_headers(demux_plugin_t *this_gen) {
return;
}
+ /* lie about 24bps */
+ int bits = this->bits_per_sample > 16 ? 16 : this->bits_per_sample;
+
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
buf->type = BUF_AUDIO_FLAC;
buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END;
buf->decoder_info[0] = 0;
buf->decoder_info[1] = this->sample_rate;
- buf->decoder_info[2] = this->bits_per_sample;
+ buf->decoder_info[2] = bits;
buf->decoder_info[3] = this->channels;
/* copy the faux WAV header */
buf->size = sizeof(xine_waveformatex) + FLAC_STREAMINFO_SIZE;
@@ -385,7 +388,7 @@ static void demux_flac_send_headers(demux_plugin_t *this_gen) {
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE,
this->sample_rate);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS,
- this->bits_per_sample);
+ bits);
this->status = DEMUX_OK;
}