diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2006-07-07 22:17:03 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2006-07-07 22:17:03 +0000 |
commit | b3e6c23b68b84e1a8a99b46be32b04a226784678 (patch) | |
tree | f07d6db15df75b3e99eecadf65a3cdc921a6469f /src | |
parent | 28a872073da59d22a28905941d00ff76aa5bac8c (diff) | |
download | xine-lib-b3e6c23b68b84e1a8a99b46be32b04a226784678.tar.gz xine-lib-b3e6c23b68b84e1a8a99b46be32b04a226784678.tar.bz2 |
Fix CD track info retrieval, avoid long pauses.
This is a partial reversion of 1.71->1.72.
(Patch from Christopher Martin, <christopher.martin@utoronto.ca>)
CVS patchset: 8092
CVS date: 2006/07/07 22:17:03
Diffstat (limited to 'src')
-rw-r--r-- | src/input/input_cdda.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 5d989e979..8ccf47992 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.86 2006/05/03 19:46:07 dsalt Exp $ + * $Id: input_cdda.c,v 1.87 2006/07/07 22:17:03 dsalt Exp $ */ #ifdef HAVE_CONFIG_H @@ -2175,11 +2175,20 @@ static uint32_t cdda_plugin_get_capabilities (input_plugin_t *this_gen) { static off_t cdda_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { + /* only allow reading in block-sized chunks */ + + return 0; +} + +static buf_element_t *cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, + off_t nlen) { + cdda_input_plugin_t *this = (cdda_input_plugin_t *) this_gen; + buf_element_t *buf; + unsigned char frame_data[CD_RAW_FRAME_SIZE]; int err = 0; - /* only allow reading in block-sized chunks */ - if (len != CD_RAW_FRAME_SIZE) + if (nlen != CD_RAW_FRAME_SIZE) return 0; if (this->current_frame > this->last_frame) @@ -2213,26 +2222,14 @@ static off_t cdda_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) { if( err < 0 ) return 0; - memcpy(buf, this->cache[this->current_frame-this->cache_first], CD_RAW_FRAME_SIZE); + memcpy(frame_data, this->cache[this->current_frame-this->cache_first], CD_RAW_FRAME_SIZE); this->current_frame++; - return CD_RAW_FRAME_SIZE; -} - -static buf_element_t *cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, - off_t nlen) { - - buf_element_t *buf; - buf = fifo->buffer_pool_alloc(fifo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; - - buf->size = cdda_plugin_read(this_gen, buf->content, nlen); - if (buf->size == 0) { - buf->free_buffer(buf); - buf = NULL; - } + buf->size = CD_RAW_FRAME_SIZE; + memcpy(buf->mem, frame_data, CD_RAW_FRAME_SIZE); return buf; } |