On Thu, 30 Oct 2008 14:57:25 -0400, Vincent Le Ligeour <[EMAIL PROTECTED]> wrote: > Hi, > > I've written an ffmpeg audio decoding class for the game I currently > develop (Performous aka UltraSTar-NG). > I'm currently having problem with the audio frame timing. In fact with > some ogg files some svn release does not act the same way (20080326 > version alway returns a correct value, whereas 20081014 always returns > values on what seems to be key audio frames and error elsewhere). > > I would have "the" method to have the timestamp of a given decoded > audio frame.
If it's decoded, then you know exactly how many samples there are. You can take the last known timestamp and add (samples / samples-per-sec) to get the new timestamp. Keep in mind that its unlikely for the OS to process the exact correct number of samples-per-second, and that you will need some code to stretch or shrink the decoded buffers (by droping or duplicating every Nth sample) if precise audio timing is important to you. (However, with a game the music usually doesn't need to be timed, and the sound effects are usually short and just need to start within a certain tolerance. So you probably don't need any fancy stretch/shrink.) -- Michael Conrad IntelliTree Solutions llc. 513-552-6362 [EMAIL PROTECTED] _______________________________________________ libav-user mailing list libav-user@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/libav-user