[FFmpeg-devel] [RFC] Seeking in PVA files

Michael Niedermayer michaelni
Sat Jan 5 18:06:34 CET 2008


On Sat, Jan 05, 2008 at 11:46:02AM +0100, Ivo wrote:
[...]
> > > +static int pva_read_seek(struct AVFormatContext *s, int stream_index,
> > > +                         int64_t timestamp, int flags) {
> > > +    AVStream *st = s->streams[stream_index];
> > > +    PVAContext *pvactx = s->priv_data;
> > > +    int index = av_index_search_timestamp(st, timestamp, flags);
> > > +
> > > +    if (index < 0) return -1;
> > > +
> > > +    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
> > > +    pvactx->continue_pes = 0;
> > > +
> > > +    return 0;
> > > +}
> >
> > i have some doubt that this works. av_index_search_timestamp() just looks
> > in the index
> >
> > you should try av_seek_frame_binary() if the default (read_seek=NULL)
> > doesnt do
> 
> The default read_seek does work, except for the fact the 
> pvactx->continue_pes is not reset. That's why I mimic the default behaviour 
> and then reset the variable. I saw other demuxers with some private 
> seek-dependant variables do the same. Is there a better/shorter way to 
> achieve the same that I overlooked?

continue_pes=0;
return -1;

or

ret= av_seek_frame_binary(s, stream_index, timestamp, flags);
continue_pes=0;
return ret;

maybe?


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080105/a98204a6/attachment.pgp>



More information about the ffmpeg-devel mailing list