From be082b6a7eebccab9434223107553edea282d6d5 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Thu, 22 Aug 2013 16:55:24 -0400 Subject: [PATCH] FFmpeg: use stream time_base to estimate FPS, not codec Fixes the estimated frame length when we don't get an explicit DTS for the frame. Also fixes a comment typo. --- src/arch/MovieTexture/MovieTexture_FFMpeg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index 2af8b07b96..226d1920e2 100644 --- a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -258,7 +258,7 @@ int MovieDecoder_FFMpeg::DecodePacket( float fTargetTime ) m_fPTS = float( m_Packet.dts * av_q2d(m_pStream->time_base) ); /* dts is the timestamp of the first frame in this packet. Only use it once; - * if we get more than one frame from the same packet (eg. f;lushing the last + * if we get more than one frame from the same packet (eg. flushing the last * frame), extrapolate. */ m_Packet.dts = int64_t(AV_NOPTS_VALUE); } @@ -319,7 +319,7 @@ int MovieDecoder_FFMpeg::DecodePacket( float fTargetTime ) } /* Length of this frame: */ - m_fLastFrameDelay = (float)m_pStream->codec->time_base.num / m_pStream->codec->time_base.den; + m_fLastFrameDelay = (float) av_q2d(m_pStream->time_base); m_fLastFrameDelay += m_Frame.repeat_pict * (m_fLastFrameDelay * 0.5f); ++m_iFrameNumber;