[MPlayer-dev-eng] .TiVo file support (fwd)

Jeremy Drake mplayer at jdrake.com
Sun Dec 17 23:51:37 CET 2006


On Sun, 17 Dec 2006, Jeremy Drake wrote:

> I got it behaving like I think it should, I can seek in both directions.
> I cannot get the progress bar still, but that's due, I think, to the
> movi_end not being set when the demux_mpg_open function is called.

I got the progress bar in mplayer working right now.  I had to set
s->end_pos to my demuxer->movi_end (corrected for the header) prior to
creating the MPEG demuxer.  This allowed that demuxer's movi_end to be
initialized to the correct value at the correct time.  The gmplayer seek
bar is still not moving, but I can use it to seek to different parts of
the file.  I had to do a fix in my seek function as the MPEG demuxer hits
an eof and then resets it and goes back to the beginning.  Here is the
latest code:

> This is my seek function which goes into the new_ds_stream's s->seek
> function pointer.

static int tivo_stream_seek(stream_t*s, off_t pos)
{
	demux_stream_t* ds = s->priv;
	int retval;
	ds_free_packs (ds);
	mp_dbg(MSGT_DEMUX, MSGL_DBG3, "tivo_stream_seek to 0x%"PRIX64"\n",
(int64_t)pos);
	/* XXX reset eof if the other guy did */
	ds->demuxer->stream->eof = s->eof;
	retval = stream_seek(ds->demuxer->stream,
((tivo_demux_priv*)ds->demuxer->priv)->begin_at + pos);
	s->pos = ds->dpos = stream_tell(ds->demuxer->stream) -
((tivo_demux_priv*)ds->demuxer->priv)->begin_at;
	/* XXX set other guy's eof if stream_seek set it */
	s->eof = ds->demuxer->stream->eof;
	return retval;
}


It looks like most stuff is working now.  The latest version of the code
is at
http://tivodecode.cvs.sourceforge.net/tivodecode/mplayer_demuxer/demux_tivo.c?view=markup

Please take a look and let me know how evil my hacks are to get things
working... ;)


> I do not like that I have to poke these vars, but it seems that a seek
> func is expected to.  Note that I correct the positions now by the
> begin_at value, as the mpeg stream begins at that point in the file, so
> the mpeg demuxer needs to only deal with stuff after that.  I think I
> may be able to do something with movi_start, if I could set it properly
> along with movi_end.  But the correction by begin_at seems to do the
> trick.



-- 
A fool's brain digests philosophy into folly, science into
superstition, and art into pedantry.  Hence University education.
		-- G. B. Shaw



More information about the MPlayer-dev-eng mailing list