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

Jeremy Drake mplayer at jdrake.com
Sun Dec 17 22:39:41 CET 2006


On Sun, 17 Dec 2006, Jeremy Drake wrote:

> On Sun, 17 Dec 2006, Nico Sabbi wrote:
>
> > Jeremy Drake wrote:
> > > On Sun, 17 Dec 2006, Nico Sabbi wrote:
> > >
> > >
> > > > today I've been busy with the output stream patch; tomorrow I'll look into
> > > > this seeking issue
> > >
> > >
> > > I created a function:
> > > int tivo_stream_seek(stream_t*s, off_t pos)
> > > {
> > > 	demuxer_t* demuxer = ((demux_stream_t*)s->priv)->demuxer;
> > > 	return stream_seek(demuxer->stream, pos);
> > > }
> > >
> > > And set s->seek = &tivo_stream_seek after new_ds_stream, and now I can
> > > seek (sort of, seeking backwards has some issues, don't know why).
>
> If I had a better understanding of the code...  I may try to fix up my
> seek function some to get it to behave better.  I am thinking I may need
> to flush something somewhere... Is there something to flush out whatever
> may currently be pending in the stream I add packets to?

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.

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

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);
	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;
	return retval;
}

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.


-- 
Board the windows, up your car insurance, and don't leave any booze in
plain sight.  It's St. Patrick's day in Chicago again.  The legend has
it that St. Patrick drove the snakes out of Ireland.  In fact, he was
arrested for drunk driving.  The snakes left because people kept
throwing up on them.



More information about the MPlayer-dev-eng mailing list