changeset 3544:61b89c10e4e8

fli seeking implemented
author arpi
date Mon, 17 Dec 2001 00:24:03 +0000
parents 5a11cbf8791f
children 8ebf03f7db55
files libmpdemux/demux_fli.c libmpdemux/demuxer.c
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_fli.c	Mon Dec 17 00:07:20 2001 +0000
+++ b/libmpdemux/demux_fli.c	Mon Dec 17 00:24:03 2001 +0000
@@ -22,6 +22,22 @@
   unsigned int *frame_size;
 } fli_frames_t;
 
+void demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,int flags){
+  fli_frames_t *frames = (fli_frames_t *)demuxer->priv;
+  sh_video_t *sh_video = demuxer->video->sh;
+  int newpos=(flags&1)?0:frames->current_frame;
+  if(flags&2){
+      // float 0..1
+      newpos+=rel_seek_secs*frames->num_frames;
+  } else {
+      // secs
+      newpos+=rel_seek_secs*sh_video->fps;
+  }
+  if(newpos<0) newpos=0; else
+  if(newpos>frames->num_frames) newpos=frames->num_frames;
+  frames->current_frame=newpos;
+}
+
 // return value:
 //     0 = EOF or no stream found
 //     1 = successfully read a packet
@@ -30,7 +46,7 @@
   sh_video_t *sh_video = demuxer->video->sh;
 
   // see if the end has been reached
-  if (frames->current_frame == frames->num_frames)
+  if (frames->current_frame >= frames->num_frames)
     return 0;
 
   // fetch the frame from the file
--- a/libmpdemux/demuxer.c	Mon Dec 17 00:07:20 2001 +0000
+++ b/libmpdemux/demuxer.c	Mon Dec 17 00:24:03 2001 +0000
@@ -595,6 +595,7 @@
 int demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags);
 int demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags);
 int demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags);
+int demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,int flags);
 void demux_seek_mov(demuxer_t *demuxer,float pts,int flags);
 
 int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
@@ -641,6 +642,9 @@
   case DEMUXER_TYPE_MOV:
       demux_seek_mov(demuxer,rel_seek_secs,flags);  break;
 
+  case DEMUXER_TYPE_FLI:
+      demux_seek_fli(demuxer,rel_seek_secs,flags);  break;
+
 } // switch(demuxer->file_format)
 
 return 1;