[MPlayer-dev-eng] How To Make A Demuxer Seek

Mike Melanson melanson at pcisys.net
Sun Mar 17 01:24:14 CET 2002


Hi team,
	So I'm trying to implement seeking in the FILM demuxer to the best
of my understanding. First off, FILM file chunks have a key frame bit
which makes seeking feasible. This is the strategy I'm using:

1) When opening the file and building a chunk index, count the number of
chunks in the 1st second of the file and assume this is the average number
of chunks per second.

2) When reading a chunk into a demuxer packet, my demuxer keeps track of
the current chunk number and just increments the number after reading a
chunk.

3) Per my understanding of seeking, it involves adjusting the current
chunk number so that when the fill_buffer() function is called, it starts
getting packets with PTSs from the right time. That's why I'm computing:
  int new_current_chunk = current_chunk +
    rel_seek_secs * chunks_per_second;
If the new_current_chunk isn't a key frame, I search back until the number
is sitting on a key frame. Then I set the current_chunk to the
new_current_chunk.

	It doesn't work. Within the first 10 seconds of a file, I can
press the back button and the FILM correctly seeks to the beginning. But
pressing the back button after the first 10 seconds or pressing the
forward button at any time basically causes MPlayer to freeze
playing. When I press 'q' in this state, after a few seconds, it will
quit. PgUp and PgDn both do the right thing, though.

	What am I missing? Thanks...
-- 
	-Mike Melanson




More information about the MPlayer-dev-eng mailing list