diff options
author | Bastien Nocera <hadess@users.sourceforge.net> | 2004-06-14 19:15:36 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@users.sourceforge.net> | 2004-06-14 19:15:36 +0000 |
commit | cfadbbb1e109eed43adac7066686a417944df56c (patch) | |
tree | 603ba271df633739c36881ba68e3e1611912541a | |
parent | 33c816472836929795d3cd2dfab41b0b32ef1aae (diff) | |
download | xine-lib-cfadbbb1e109eed43adac7066686a417944df56c.tar.gz xine-lib-cfadbbb1e109eed43adac7066686a417944df56c.tar.bz2 |
- implemented a crude time-based seeking in the wave demuxer
Fixes GNOME bugzilla 143400
CVS patchset: 6691
CVS date: 2004/06/14 19:15:36
-rw-r--r-- | src/demuxers/demux_wav.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index cfe2b02e2..f20f326d4 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -22,7 +22,7 @@ * MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net) * based on WAV specs that are available far and wide * - * $Id: demux_wav.c,v 1.59 2004/06/13 21:28:55 miguelfreitas Exp $ + * $Id: demux_wav.c,v 1.60 2004/06/14 19:15:36 hadess Exp $ */ #ifdef HAVE_CONFIG_H @@ -73,6 +73,8 @@ typedef struct { demux_class_t demux_class; } demux_wav_class_t; +static int demux_wav_get_stream_length (demux_plugin_t *this_gen); + /* returns 1 if the WAV file was opened successfully, 0 otherwise */ static int open_wav_file(demux_wav_t *this) { uint8_t signature[WAV_SIGNATURE_SIZE]; @@ -316,6 +318,15 @@ static int demux_wav_seek (demux_plugin_t *this_gen, if (!INPUT_IS_SEEKABLE(this->input)) return this->status; + /* time-based seeking, the start_pos code will then align the blocks + * if necessary */ + if (start_time != 0) { + int length = demux_wav_get_stream_length (this_gen); + if (length != 0) { + start_pos = start_time * this->data_size / length; + } + } + /* check the boundary offsets */ if (start_pos <= 0) this->input->seek(this->input, this->data_start, SEEK_SET); |