Skip to content

Commit

Permalink
Fix timestamp generation for MPEG-2 DVD streams (and probably others)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Oct 24, 2023
1 parent 27d2707 commit 11b06e1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions decoder/LAVVideo/decoders/avcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,9 @@ STDMETHODIMP CDecAvcodec::ConvertPixFmt(AVFrame *pFrame, LAVFrame *pOutFrame)

STDMETHODIMP_(REFERENCE_TIME) CDecAvcodec::GetFrameDuration()
{
if (m_pAVCtx->framerate.den && m_pAVCtx->framerate.num)
return (REF_SECOND_MULT * m_pAVCtx->framerate.den / m_pAVCtx->framerate.num);

if (m_pAVCtx->time_base.den && m_pAVCtx->time_base.num)
return (REF_SECOND_MULT * m_pAVCtx->time_base.num / m_pAVCtx->time_base.den) *
((m_pAVCtx->codec_descriptor && m_pAVCtx->codec_descriptor->props & AV_CODEC_PROP_FIELDS) ? 2 : 1);
Expand Down

0 comments on commit 11b06e1

Please sign in to comment.