[vlc-devel] commit: Used AVCodecContext::ticks_per_frame when available. ( Laurent Aimar )

git version control git at videolan.org
Fri Jun 19 01:24:09 CEST 2009


vlc | branch: 1.0-bugfix | Laurent Aimar <fenrir at videolan.org> | Fri Jun 19 00:47:57 2009 +0200| [ee886eaf4f59e18f1135530d1eeb735328421432] | committer: Derk-Jan Hartman 

Used AVCodecContext::ticks_per_frame when available.

It fixes a regression with interpolated timestamps for some
mpeg-I/II and for h264.
(cherry picked from commit 06105bd193c8b7f002087197a1f4d7258aca3d3c)

Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ee886eaf4f59e18f1135530d1eeb735328421432
---

 modules/codec/avcodec/video.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index e902843..6e0e5ba 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1046,9 +1046,17 @@ static void ffmpeg_NextPts( decoder_t *p_dec )
     }
     else if( p_sys->p_context->time_base.den > 0 )
     {
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,20,0)
+        int i_tick = i_tick = p_sys->p_context->ticks_per_frame;
+        if( i_tick <= 0 )
+            i_tick = 1;
+#else
+        int i_tick = 1;
+#endif
+
         p_sys->i_pts += INT64_C(1000000) *
             (2 + p_sys->p_ff_pic->repeat_pict) *
-            p_sys->p_context->time_base.num /
+            i_tick * p_sys->p_context->time_base.num /
             (2 * p_sys->p_context->time_base.den);
     }
 }




More information about the vlc-devel mailing list