From 75e89ead10fc06fe1b5267fff3d6e66ef8210609 Mon Sep 17 00:00:00 2001 From: melanson Date: Sun, 25 Nov 2001 01:48:55 +0000 Subject: [PATCH] fixed FLI demuxer so that it skips over app-specific frames git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3106 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_fli.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libmpdemux/demux_fli.c b/libmpdemux/demux_fli.c index 367fbaac64..09970fb86a 100644 --- a/libmpdemux/demux_fli.c +++ b/libmpdemux/demux_fli.c @@ -55,6 +55,8 @@ demuxer_t* demux_open_fli(demuxer_t* demuxer){ fli_frames_t *frames = (fli_frames_t *)malloc(sizeof(fli_frames_t)); int frame_number; int speed; + unsigned int frame_size; + int magic_number; // go back to the beginning stream_reset(demuxer->stream); @@ -107,11 +109,21 @@ demuxer_t* demux_open_fli(demuxer_t* demuxer){ while ((!stream_eof(demuxer->stream)) && (frame_number < frames->num_frames)) { frames->filepos[frame_number] = stream_tell(demuxer->stream); - frames->frame_size[frame_number] = stream_read_dword_le(demuxer->stream); - stream_skip(demuxer->stream, frames->frame_size[frame_number] - 4); - frame_number++; + frame_size = stream_read_dword_le(demuxer->stream); + magic_number = stream_read_word_le(demuxer->stream); + stream_skip(demuxer->stream, frame_size - 6); + + // if this chunk has the right magic number, index it + if (magic_number == 0xF1FA) + { + frames->frame_size[frame_number] = frame_size; + frame_number++; + } } + // save the actual number of frames indexed + frames->num_frames = frame_number; + demuxer->priv = frames; return demuxer;