From a81e5493dde0cbd1d81f6e8dcc3f0cc071cb76c3 Mon Sep 17 00:00:00 2001 From: arpi Date: Wed, 22 Aug 2001 16:42:37 +0000 Subject: [PATCH] added demuxer->seekable flag to generalize seeking ability test git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1624 b3059339-0415-0410-9bf9-f77b7e298cf2 --- demux_avi.c | 1 + demuxer.c | 14 +++++++++----- demuxer.h | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/demux_avi.c b/demux_avi.c index f7bc09d966..34dff21ecd 100644 --- a/demux_avi.c +++ b/demux_avi.c @@ -433,6 +433,7 @@ demuxer_t* demux_open_avi(demuxer_t* demuxer){ priv->idx_pos_v=demuxer->movi_start; pts_from_bps=1; // force BPS sync! } + demuxer->seekable=0; } if(!ds_fill_buffer(d_video)){ mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: missing video stream!? contact the author, it may be a bug :(\n"); diff --git a/demuxer.c b/demuxer.c index 6d71f278e5..639fca8185 100644 --- a/demuxer.c +++ b/demuxer.c @@ -51,6 +51,7 @@ demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){ d->stream=stream; d->movi_start=stream->start_pos; d->movi_end=stream->end_pos; + d->seekable=1; d->synced=0; d->filepos=0; d->audio=new_demuxer_stream(d,a_id); @@ -413,7 +414,7 @@ switch(file_format){ break; } case DEMUXER_TYPE_AVI: { - return demux_open_avi(demuxer); + return (demuxer_t*) demux_open_avi(demuxer); // break; } case DEMUXER_TYPE_ASF: { @@ -492,10 +493,13 @@ int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ sh_audio_t *sh_audio=d_audio->sh; sh_video_t *sh_video=d_video->sh; -//if(demuxer->file_format==DEMUXER_TYPE_AVI && demuxer->idx_size<=0){ -// printf("Can't seek in raw .AVI streams! (index required, try with the -idx switch!) \n"); -// return 0; -//} +if(!demuxer->seekable){ + if(demuxer->file_format==DEMUXER_TYPE_AVI) + mp_msg(MSGT_SEEK,MSGL_WARN,"Can't seek in raw .AVI streams! (index required, try with the -idx switch!) \n"); + else + mp_msg(MSGT_SEEK,MSGL_WARN,"Can't seek in this file! \n"); + return 0; +} // clear demux buffers: if(sh_audio){ ds_free_packs(d_audio);sh_audio->a_buffer_len=0;} diff --git a/demuxer.h b/demuxer.h index 694f77e698..caa6e47902 100644 --- a/demuxer.h +++ b/demuxer.h @@ -62,6 +62,7 @@ typedef struct demuxer_st { int file_format; // file format: mpeg/avi/asf off_t movi_start; off_t movi_end; + int seekable; // flag // demux_stream_t *audio; // audio buffer/demuxer demux_stream_t *video; // video buffer/demuxer