mirror of
https://github.com/mpv-player/mpv
synced 2024-12-18 04:45:33 +00:00
fli seeking implemented
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3545 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
cf33c343cf
commit
f5247261c2
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user