Ticket #12047: 0002-divide-framerate-by-number-of-ticks-fields-per-frame.patch

File 0002-divide-framerate-by-number-of-ticks-fields-per-frame.patch, 1.5 KB (added by Karl Egly, 6 years ago)
  • mythtv/libs/libmythtv/avformatdecoder.cpp

    From 118f76af069d7c1a23d99b6ca7d9c3eccb942aab Mon Sep 17 00:00:00 2001
    From: Karl Dietz <dekarl@mythtv.org>
    Date: Sun, 27 Apr 2014 02:19:55 +0200
    Subject: [PATCH 2/2] divide framerate by number of ticks (fields) per frame
    
    Inspired by av_guess_frame_rate, see
    https://www.ffmpeg.org/doxygen/trunk/group__lavf__misc.html#ga12c049178414cc221dfafd4e7f836dea
    Why don't we just use that?
    
    Fixes #12047
    ---
     mythtv/libs/libmythtv/avformatdecoder.cpp |    9 +++++++++
     1 file changed, 9 insertions(+)
    
    diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
    index 552d3fe..528ee83 100644
    a b float AvFormatDecoder::normalized_fps(AVStream *stream, AVCodecContext *enc) 
    13421342    float fps, avg_fps, codec_fps, container_fps, estimated_fps;
    13431343    avg_fps = codec_fps = container_fps = estimated_fps = 0.0f;
    13441344
     1345    /* this is not a good source for FPS according to
     1346     * https://trac.bunkus.org/wiki/FAQ:WrongFrameRateDisplayed
     1347     */
    13451348    if (stream->avg_frame_rate.den && stream->avg_frame_rate.num)
     1349    {
    13461350        avg_fps = av_q2d(stream->avg_frame_rate); // MKV default_duration
     1351        if (st->codec->ticks_per_frame > 1)
     1352        {
     1353            avg_fps /= st->codec->ticks_per_frame;
     1354        }
     1355    }
    13471356
    13481357    if (enc->time_base.den && enc->time_base.num) // tbc
    13491358        codec_fps = 1.0f / av_q2d(enc->time_base) / enc->ticks_per_frame;