changeset 1623:5908dd344067

added demuxer->seekable flag to generalize seeking ability test
author arpi
date Wed, 22 Aug 2001 16:42:37 +0000
parents a0d4fa6b9435
children 2eedc348e92a
files demux_avi.c demuxer.c demuxer.h
diffstat 3 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/demux_avi.c	Wed Aug 22 16:24:00 2001 +0000
+++ b/demux_avi.c	Wed Aug 22 16:42:37 2001 +0000
@@ -433,6 +433,7 @@
 	  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");
--- a/demuxer.c	Wed Aug 22 16:24:00 2001 +0000
+++ b/demuxer.c	Wed Aug 22 16:42:37 2001 +0000
@@ -51,6 +51,7 @@
   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 @@
   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 @@
     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;}
--- a/demuxer.h	Wed Aug 22 16:24:00 2001 +0000
+++ b/demuxer.h	Wed Aug 22 16:42:37 2001 +0000
@@ -62,6 +62,7 @@
   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