[FFmpeg-devel] [PATCH] AV_TIME_BASE and av_gettime()

Stefano Sabatini stefano.sabatini-lala
Sat Nov 22 19:17:00 CET 2008


On date Saturday 2008-11-22 13:03:08 +0000, Luca Abeni encoded:
> Hi,
> 
> Stefano Sabatini wrote:
> > On date Friday 2008-11-21 08:53:27 +0100, Luca Abeni encoded:
> > [...]
> >> This looks good, and is a nice improvement respect to the current state
> >> of things...
> >> Just one comment: I think you are assuming AV_TIME_BASE == 1000000 (since
> >> you are comparing next_pts with the result of av_gettime()). This is the
> >> case now, but in the future the AV_TIME_BASE value can change (I know this
> >> is a problem, because I did the same mistake in the past, and I've been
> >> asked to fix it :)
> >> I am not ffmpeg.c maintainer (so, I think Michael's approval is needed),
> >> but I think the patch should be applied (after fixing the
> >> AV_TIME_BASE -> microseconds conversion).
> > 
> > Check the patch attached.
> 
> Sorry, I probably described the problem in a confusing way... What I 
> wanted to say is that you should do something like
> 	int64_t pts = av_rescale(ist->next_pts, 1000000, AV_TIME_BASE);
> instead of
> 	nt64_t pts = ist->next_pts;
> 
> I do not think that defining a new av_gettime2() function just for this 
> purpose is a good idea.

Mmh... yes I agree.

Check the patch, I also changed the name pts -> next, I think it's
less prone to confusion since "pts" may be confused with the meaning
of pts in ist->next_pts (which uses another time unit).

BTW if that's OK I think it's also safe to remove the "frame" var,
which is now unused.

Regards.
-- 
FFmpeg = Foolish & Fiendish Majestic Patchable Easy Gem
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-rate-emu-01.patch
Type: text/x-diff
Size: 1520 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081122/0d81cc4d/attachment.patch>



More information about the ffmpeg-devel mailing list