From f5247261c24fcaa1328b664e505e72ce55dbf5fb Mon Sep 17 00:00:00 2001 From: arpi Date: Mon, 17 Dec 2001 00:24:03 +0000 Subject: [PATCH] fli seeking implemented git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3545 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_fli.c | 18 +++++++++++++++++- libmpdemux/demuxer.c | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libmpdemux/demux_fli.c b/libmpdemux/demux_fli.c index f459887c55..6244f9ea50 100644 --- a/libmpdemux/demux_fli.c +++ b/libmpdemux/demux_fli.c @@ -22,6 +22,22 @@ typedef struct _fli_frames_t { 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 @@ int demux_fli_fill_buffer(demuxer_t *demuxer){ 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 diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index ef639632b7..9fe88d0a96 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -595,6 +595,7 @@ return demuxer; 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 @@ switch(demuxer->file_format){ 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;