[libavg-devel] Audio Support Patch

Nick Hebner hebnern at gmail.com
Tue Jan 8 07:41:15 CET 2008


On Jan 7, 2008 2:31 PM, Ulrich von Zadow <uzadow at libavg.de> wrote:

> Nick Hebner wrote:
> > Hey again,
> >
> > I am working on modifying seeking to work correctly with audio, and have
> > come up with some points for discussion.
> >
> > The main problem that I have run into is seeking is currently based on a
> > frame number. This is fine for video, but when we have audio only nodes,
> > we will not have frame numbers to seek to. I think that the best thing
> > to do here is to change seeking (at least at the decoder/demuxer level)
> > to be based on stream time as this applies to audio as well as video
> > streams.
>
> I hadn't thought of that, but: yes, we need a seekToTime().
>
> > Now we obviously need to retain seeking by frame numbers for backwards
> > compatibility (and its a nice option to have), and as I see it, there
> > are two ways to accomplish this.
> >
> > 1. Have two seek methods in IVideoDecoder: seekFrame(int DestFrame) and
> > seekTime(long long DestTime). seekFrame() may be internally built on
> > seekTime() using the nominal framerate to calculate the time.
> >
> > 2. Simply provide an accessor to the nominal framerate and allow higher
> > level nodes to implement their own seekFrame() behavior. This seems a
> > bit cleaner and simpler to me, and is my preference currently.
>
> Actually, I think I prefer keeping seekToFrame() around. libavg seeks
> extremely fast in I-frame-only movies, and this allows you to see a
> movie more as a collection of images than as a sequence of images
> ordered in time. We have used this, for instance, to prerender lots of
> images of an object from different perspectives, with the frame numbers
> corresponding to an angle. There is really no concept of time in these
> 'movies'. Also, it's quite easy to have little rounding and off-by-one
> bugs in the conversion of frame numbers to time stamps, so having this
> implemented in the library would probably save some people some time.
>

That makes sense. What I meant by 'higher' levels is the video node. My
seeking commit changed IVideoDecoder::seek(int DestFrame) to
IVideoDecoder::seek(long long DestTime), and added
IVideoDecoder::getNominalFPS(). Video::seekToFrame() uses getNominalFPS() to
compute the correct frame number, so seeking by frame number still works
correctly, just the decoder seeking interface has been generalized for both
audio and video. Seeking by time at the IVideoDecoder level seems more
natural because ffmpeg seeks by timestamps. The correct timestamp was
formerly determined in the same way that it is now, just internal to the
decoder.

>
> > Once these issues are sorted, would we like to add a seekToTime() method
> > to the video node as an alternative to seeking by frame?
>
> Sounds good :-).
>
> I haven't yet found the time to look through your commits - will do
> soon, though. I promise.
>
> Cheers,
>
>  Uli
>
> --
>
> Ulrich von Zadow | +49-172-7872715
> Jabber: cocacoder at jabber.berlin.ccc.de
> Skype: uzadow
>
> _______________________________________________
> libavg-devel mailing list
> libavg-devel at datenhain.de
> https://mail.datenhain.de/mailman/listinfo/libavg-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.datenhain.de/pipermail/libavg-devel/attachments/20080107/77f33b9d/attachment.htm 


More information about the libavg-devel mailing list