diff options
author | Robin KAY <komadori@users.sourceforge.net> | 2002-11-26 18:51:32 +0000 |
---|---|---|
committer | Robin KAY <komadori@users.sourceforge.net> | 2002-11-26 18:51:32 +0000 |
commit | 0c90474427f37b31889b2adea9d1c39c8b7e7618 (patch) | |
tree | e07dc8c532a5ef3debea4b34437dc7d3b0e00d8a | |
parent | df308d6eac8943344bb3fe491ee0453340a487b3 (diff) | |
download | xine-lib-0c90474427f37b31889b2adea9d1c39c8b7e7618.tar.gz xine-lib-0c90474427f37b31889b2adea9d1c39c8b7e7618.tar.bz2 |
change demux_eawve to use forward seeking. quick hack to input_http to support forward relative seeking.
CVS patchset: 3378
CVS date: 2002/11/26 18:51:32
-rw-r--r-- | src/demuxers/demux_eawve.c | 27 | ||||
-rw-r--r-- | src/input/input_http.c | 14 |
2 files changed, 14 insertions, 27 deletions
diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c index 4efc78e1d..2ac79b7cd 100644 --- a/src/demuxers/demux_eawve.c +++ b/src/demuxers/demux_eawve.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_eawve.c,v 1.7 2002/11/20 11:57:40 mroi Exp $ + * $Id: demux_eawve.c,v 1.8 2002/11/26 18:51:32 komadori Exp $ * * demux_eawve.c, Demuxer plugin for Electronic Arts' WVE file format * @@ -107,27 +107,6 @@ static uint32_t read_arbitary(input_plugin_t *input) } /* - * Skip a number of bytes - */ - -static int skip_bytes(input_plugin_t *input, int bytes) -{ - if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) { - return input->seek(input, bytes, SEEK_CUR); - } - else { - int i, dummy; - - for (i=0;i<bytes;i++) { - if (input->read(input, (void*)&dummy, 1) != 1) { - return -1; - } - } - return input->get_current_pos(input); - } -} - -/* * Process WVE file header * Returns 1 if the WVE file is valid and successfully opened, 0 otherwise */ @@ -221,7 +200,7 @@ static int process_header(demux_eawve_t *this) return 0; } - if (skip_bytes(this->input, size - this->input->get_current_pos(this->input)) < 0) { + if (this->input->seek(this->input, size - this->input->get_current_pos(this->input), SEEK_CUR) < 0) { return 0; } @@ -297,7 +276,7 @@ static int demux_eawve_send_chunk(demux_eawve_t *this) break; default: { - if (skip_bytes(this->input, header.size) < 0) { + if (this->input->seek(this->input, header.size, SEEK_CUR) < 0) { printf("demux_eawve: read error\n"); this->status = DEMUX_FINISHED; } diff --git a/src/input/input_http.c b/src/input/input_http.c index 1fbe13133..f180bc292 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -582,10 +582,18 @@ static off_t http_plugin_get_current_pos (input_plugin_t *this_gen){ return this->curpos; } -static off_t http_plugin_seek(input_plugin_t *this_gen, - off_t offset, int origin) { - +static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) { http_input_plugin_t *this = (http_input_plugin_t *) this_gen; + + if ((origin == SEEK_CUR) && (offset >= 0)) { + char *tmp; + assert((tmp = malloc(1024)) != NULL); + for (;((int)offset) - 1024 > 0; offset -= 1024) { + this->curpos += http_plugin_read(this_gen, tmp, 1024); + } + this->curpos += http_plugin_read(this_gen, tmp, offset); + } + /* dummy implementation: don't seek, just return current position */ return this->curpos; } |