diff options
author | František Dvořák <valtri@users.sourceforge.net> | 2003-11-23 23:20:56 +0000 |
---|---|---|
committer | František Dvořák <valtri@users.sourceforge.net> | 2003-11-23 23:20:56 +0000 |
commit | 4f591c826f6daad4913c24fee3699224ff8be0d5 (patch) | |
tree | 3005d4c6efc1fb6d361169938ce22e3bae95f614 /src | |
parent | 31057fce7b6ac70bcde8e2f791f82895e50a4971 (diff) | |
download | xine-lib-4f591c826f6daad4913c24fee3699224ff8be0d5.tar.gz xine-lib-4f591c826f6daad4913c24fee3699224ff8be0d5.tar.bz2 |
Implement seek timeout in RIP and drop input capability INPUT_CAP_SLOW_SEEK.
Check for seek success in mp3 and avi demuxers.
CVS patchset: 5775
CVS date: 2003/11/23 23:20:56
Diffstat (limited to 'src')
-rw-r--r-- | src/demuxers/demux_avi.c | 3 | ||||
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 8 | ||||
-rw-r--r-- | src/input/input_plugin.h | 12 | ||||
-rw-r--r-- | src/xine-engine/input_rip.c | 12 |
4 files changed, 16 insertions, 19 deletions
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 2c201e0dc..8a86840fe 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.180 2003/11/23 00:57:06 tmattern Exp $ + * $Id: demux_avi.c,v 1.181 2003/11/23 23:20:57 valtri Exp $ * * demultiplexer for avi streams * @@ -753,6 +753,7 @@ static avi_t *AVI_init(demux_avi_t *this) { xine_log (this->stream->xine, XINE_LOG_MSG, _("demux_avi: failed to seek to the next chunk (pos %lld)\n"), next_chunk); + break; /* probably slow seek */ } } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 076d4f396..25d00ed54 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.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_mpgaudio.c,v 1.125 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_mpgaudio.c,v 1.126 2003/11/23 23:20:57 valtri Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -809,14 +809,14 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); /* read id3 info only from inputs with seeking and without "live" flag */ - if ((this->input->get_capabilities(this->input) & (INPUT_CAP_SEEKABLE | INPUT_CAP_SLOW_SEEK)) == INPUT_CAP_SEEKABLE) { + if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE != 0) { off_t pos; /* check ID3 v1 at the end of the stream */ pos = this->input->get_length(this->input) - 128; if(pos > 0) { - this->input->seek (this->input, pos, SEEK_SET); - read_id3_tags (this); + if (pos == this->input->seek (this->input, pos, SEEK_SET)) + read_id3_tags (this); } } diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 6a8cf099d..f578bcb99 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -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: input_plugin.h,v 1.52 2003/10/13 14:52:53 valtri Exp $ + * $Id: input_plugin.h,v 1.53 2003/11/23 23:20:57 valtri Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -228,16 +228,6 @@ struct input_plugin_s { #define INPUT_CAP_BLOCK 0x00000002 /* - * INPUT_CAP_SLOW_SEEK: - * it's set when seeking to end is impossible or problematic - * because of low bandwidth, - * used for non-seekable streams with seeking emulated - * by the RIP input plugin - */ - -#define INPUT_CAP_SLOW_SEEK 0x00000004 - -/* * INPUT_CAP_AUDIOLANG: * INPUT_CAP_SPULANG: * input plugin knows something about audio/spu languages, diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index cc5b86ab0..84a0858f3 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -29,12 +29,11 @@ * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo * - * $Id: input_rip.c,v 1.14 2003/11/11 18:45:00 f1rmb Exp $ + * $Id: input_rip.c,v 1.15 2003/11/23 23:20:58 valtri Exp $ */ /* TODO: * - resume feature (via #append) - * - SEEK_SLOW replace by timeout * - gui activation (after restarting playback) * - long files support */ @@ -61,6 +60,7 @@ #define SCRATCH_SIZE 1024 #define MAX_TARGET_LEN 256 +#define SEEK_TIMEOUT 2.5 typedef struct { input_plugin_t input_plugin; /* inherited structure */ @@ -326,6 +326,8 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen; uint32_t blocksize; off_t newpos, toread, reqpos, pos; + struct timeval time1, time2; + double interval = 0; lprintf("seek, offset %lld, origin %d (curpos %lld, savepos %lld)\n", offset, origin, this->curpos, this->savepos); @@ -390,7 +392,8 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) } /* read and catch remaining data after this->savepos */ - while (this->curpos < newpos) { + gettimeofday(&time1, NULL); + while (this->curpos < newpos && interval < SEEK_TIMEOUT) { if( blocksize ) { buf_element_t *buf; @@ -410,6 +413,9 @@ static off_t rip_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin) break; } } + gettimeofday(&time2, NULL); + interval = (double)(time2.tv_sec - time1.tv_sec) + + (double)(time2.tv_usec - time1.tv_usec) / 1000000; } lprintf(" => new position %lld\n", this->curpos); |