Ticket #5643: mythtv_refresh_rate_auto_pickv2-trunk.patch

File mythtv_refresh_rate_auto_pickv2-trunk.patch, 8.1 KB (added by henrik.sorensen@…, 4 years ago)

same patch against trunk rev 18198

  • mythtv/libs/libmythtv/NuppelVideoPlayer.cpp

     
    650650            GetDecoder()->GetVideoCodecID(), 
    651651            GetDecoder()->GetVideoCodecPrivate(), 
    652652            video_disp_dim, video_aspect, 
    653             widget->winId(), display_rect, 0 /*embedid*/); 
     653            widget->winId(), display_rect, (video_frame_rate * play_speed),  
     654            0 /*embedid*/); 
    654655 
    655656        if (!videoOutput) 
    656657        { 
     
    665666        videoOutput->SetVideoScalingAllowed(db_scale); 
    666667 
    667668        // We need to tell it this for automatic deinterlacer settings 
    668         videoOutput->SetVideoFrameRate(video_frame_rate * play_speed); 
     669        //videoOutput->SetVideoFrameRate(video_frame_rate * play_speed); 
    669670 
    670671        if (videoOutput->hasMCAcceleration() && !decode_extra_audio) 
    671672        { 
  • mythtv/libs/libmythtv/videooutbase.cpp

     
    6767        void          *codec_priv, 
    6868        const QSize   &video_dim, float        video_aspect, 
    6969        WId            win_id,    const QRect &display_rect, 
     70        float          video_playback_rate, 
    7071        WId            embed_id) 
    7172{ 
    7273    (void) codec_priv; 
     
    172173            if (vo->Init( 
    173174                    video_dim.width(), video_dim.height(), video_aspect, 
    174175                    win_id, display_rect.x(), display_rect.y(), 
    175                     display_rect.width(), display_rect.height(), embed_id)) 
     176                    display_rect.width(), display_rect.height(), 
     177                    video_playback_rate, embed_id)) 
    176178            { 
    177179                return vo; 
    178180            } 
     
    370372 * \return true if successful, false otherwise. 
    371373 */ 
    372374bool VideoOutput::Init(int width, int height, float aspect, WId winid, 
    373                        int winx, int winy, int winw, int winh, WId embedid) 
     375                       int winx, int winy, int winw, int winh,  
     376                       float prate, WId embedid) 
    374377{ 
    375378    (void)winid; 
    376379    (void)embedid; 
     
    397400 
    398401    embedding = false; 
    399402 
     403    SetVideoFrameRate(prate); 
     404 
    400405    return true; 
    401406} 
    402407 
     
    415420 
    416421void VideoOutput::SetVideoFrameRate(float playback_fps) 
    417422{ 
     423    video_playback_rate = playback_fps; 
    418424    if (db_vdisp_profile) 
    419425        db_vdisp_profile->SetOutput(playback_fps); 
    420426} 
  • mythtv/libs/libmythtv/videoout_xv.h

     
    6060   ~VideoOutputXv(); 
    6161 
    6262    bool Init(int width, int height, float aspect, WId winid, 
    63               int winx, int winy, int winw, int winh, WId embedid = 0); 
     63              int winx, int winy, int winw, int winh,  
     64              float videoPlaybackRate, WId embedid = 0); 
    6465 
    6566    bool SetDeinterlacingEnabled(bool); 
    6667    bool SetupDeinterlace(bool interlaced, const QString& ovrf=""); 
  • mythtv/libs/libmythtv/videoout_xv.cpp

     
    426426    if ((width == 1920 || width == 1440) && height == 1088) 
    427427        height = 1080; // ATSC 1920x1080 
    428428 
    429     if (display_res && display_res->SwitchToVideo(width, height)) 
     429    if (display_res && display_res->SwitchToVideo(width, height, (short) roundf(video_playback_rate))) 
    430430    { 
    431431        // Switching to custom display resolution succeeded 
    432432        // Make a note of the new size 
     
    16051605 */ 
    16061606bool VideoOutputXv::Init( 
    16071607    int width, int height, float aspect, 
    1608     WId winid, int winx, int winy, int winw, int winh, WId embedid) 
     1608    WId winid, int winx, int winy, int winw, int winh,  
     1609    float prate, WId embedid) 
    16091610{ 
    16101611    needrepaint = true; 
    16111612 
     
    16621663    // Basic setup 
    16631664    VideoOutput::Init(width, height, aspect, 
    16641665                      winid, winx, winy, winw, winh, 
    1665                       embedid); 
     1666                      prate, embedid); 
    16661667 
    16671668    // Set resolution/measurements (check XRandR, Xinerama, config settings) 
    16681669    InitDisplayMeasurements(width, height); 
  • mythtv/libs/libmythtv/videooutbase.h

     
    4040        void          *codec_priv, 
    4141        const QSize   &video_dim, float        video_aspect, 
    4242        WId            win_id,    const QRect &display_rect, 
     43        float          video_playback_rate, 
    4344        WId            embed_id); 
    4445 
    4546    VideoOutput(); 
     
    4748 
    4849    virtual bool Init(int width, int height, float aspect, 
    4950                      WId winid, int winx, int winy, int winw,  
    50                       int winh, WId embedid = 0); 
     51                      int winh, float video_playback_rate, WId embedid = 0); 
    5152    virtual void InitOSD(OSD *osd); 
    5253    virtual void SetVideoFrameRate(float); 
    5354 
     
    282283    QSize   video_dim;        ///< Pixel dimensions of video buffer 
    283284    QSize   video_disp_dim;   ///< Pixel dimensions of video display area 
    284285    float   video_aspect;     ///< Physical aspect ratio of video 
     286    float   video_playback_rate;  ///< Playback frame rate of video 
    285287 
    286288    /// Normally this is the same as videoAspect, but may not be 
    287289    /// if the user has toggled the aspect override mode. 
  • mythtv/libs/libmythui/DisplayRes.cpp

     
    4040    // Initialize GUI mode 
    4141    mode[GUI].Init(); 
    4242    tW = tH = 0; 
    43     GetMythDB()->GetResolutionSetting("GuiVidMode", tW, tH); 
     43    GetMythDB()->GetResolutionSetting("GuiVidMode", tW, tH, tAspect, tRate); 
    4444    GetDisplaySize(tW_mm, tH_mm); 
    4545    GetMythDB()->GetResolutionSetting("DisplaySize", tW_mm, tH_mm); 
    46     mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, 0); 
     46    mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, tRate); 
    4747 
    4848 
    4949    // Initialize default VIDEO mode 
     
    8989{ 
    9090    tmode next_mode = VIDEO; // default VIDEO mode 
    9191    DisplayResScreen next = mode[next_mode]; 
     92    next.AddRefreshRate(irate); 
    9293 
    9394    // try to find video override mode 
    9495    uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); 
     
    133134    // need to change video mode? 
    134135    short target_rate = 0; 
    135136    DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 
    136     bool chg = !(next == last) || !(last.RefreshRate() == target_rate); 
     137    // If GuiVidModeRefreshRate is 0, assume any refresh rate is good enough. 
     138    bool chg = !(next == last) || (next.RefreshRate() !=0 && !(last.RefreshRate() == target_rate));  
    137139 
    138140    VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 
    139141            .arg(next.Width()).arg(next.Height()).arg(target_rate)); 
  • mythtv/libs/libmythui/DisplayResScreen.cpp

     
    9090        if (dsr[i].Width()==d.Width() && dsr[i].Height()==d.Height()) 
    9191        { 
    9292            const vector<short>& rates = dsr[i].RefreshRates(); 
    93             if (rates.size()) 
     93            if (rates.size() && d.RefreshRate() != 0) 
    9494            { 
    95                 vector<short>::const_iterator it = 
    96                     find(rates.begin(), rates.end(), d.RefreshRate()); 
    97                 target_rate = (it == rates.end()) ? *(--rates.end()) : *it; 
    98                 return i; 
     95                for (uint j=0; j < rates.size(); ++j) 
     96                { 
     97                    // Multiple of target_rate will do 
     98                    if (rates[j] % d.RefreshRate() == 0) 
     99                    { 
     100                        target_rate = rates[j]; 
     101                        return i; 
     102                    } 
     103                } 
     104                target_rate = rates[rates.size() - 1]; 
    99105            } 
     106            return i; 
    100107        } 
    101108    } 
    102109    return -1;