From 7b6cf2d356d6579b348906d15e0f99b2081d0f16 Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Mon, 30 Dec 2013 15:38:45 +0100 Subject: Make vorbis handle regular BUF_SPECIAL_DECODER_CONFIG. Less audio fifo load (remember those bufs held for resending after user audio switch). Used by qt so far. --- src/combined/xine_vorbis_decoder.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/combined/xine_vorbis_decoder.c b/src/combined/xine_vorbis_decoder.c index bdbeca0a6..8fd9fc88a 100644 --- a/src/combined/xine_vorbis_decoder.c +++ b/src/combined/xine_vorbis_decoder.c @@ -159,6 +159,34 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; + /* Disassemble a regular decoder configuration packet. + Calm down, there is only 1 level of recursion ;-) */ + if ((buf->decoder_flags & BUF_FLAG_SPECIAL) && (buf->decoder_info[1] == BUF_SPECIAL_DECODER_CONFIG)) { + uint8_t *head = buf->decoder_info_ptr[2], *data, *olddata = buf->content; + int len = buf->decoder_info[2], part, i, oldsize = buf->size, oldflags = buf->decoder_flags; + if (!head || (--len < 0)) + return; + i = *head++; + if ((len -= i) < 0) + return; + data = head + i; + buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_FRAME_END; + for (; i >= 0; i--) { + part = i ? *head++ : len; + if (part > len) + part = len; + buf->content = data; + buf->size = part; + vorbis_decode_data (this_gen, buf); + data += part; + len -= part; + } + buf->decoder_flags = oldflags; + buf->content = olddata; + buf->size = oldsize; + return; + } + memset( &this->op, 0, sizeof(this->op) ); /* data accumulation */ -- cgit v1.2.3