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) |
|---|
-
mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
650 650 GetDecoder()->GetVideoCodecID(), 651 651 GetDecoder()->GetVideoCodecPrivate(), 652 652 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*/); 654 655 655 656 if (!videoOutput) 656 657 { … … 665 666 videoOutput->SetVideoScalingAllowed(db_scale); 666 667 667 668 // 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); 669 670 670 671 if (videoOutput->hasMCAcceleration() && !decode_extra_audio) 671 672 { -
mythtv/libs/libmythtv/videooutbase.cpp
67 67 void *codec_priv, 68 68 const QSize &video_dim, float video_aspect, 69 69 WId win_id, const QRect &display_rect, 70 float video_playback_rate, 70 71 WId embed_id) 71 72 { 72 73 (void) codec_priv; … … 172 173 if (vo->Init( 173 174 video_dim.width(), video_dim.height(), video_aspect, 174 175 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)) 176 178 { 177 179 return vo; 178 180 } … … 370 372 * \return true if successful, false otherwise. 371 373 */ 372 374 bool 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) 374 377 { 375 378 (void)winid; 376 379 (void)embedid; … … 397 400 398 401 embedding = false; 399 402 403 SetVideoFrameRate(prate); 404 400 405 return true; 401 406 } 402 407 … … 415 420 416 421 void VideoOutput::SetVideoFrameRate(float playback_fps) 417 422 { 423 video_playback_rate = playback_fps; 418 424 if (db_vdisp_profile) 419 425 db_vdisp_profile->SetOutput(playback_fps); 420 426 } -
mythtv/libs/libmythtv/videoout_xv.h
60 60 ~VideoOutputXv(); 61 61 62 62 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); 64 65 65 66 bool SetDeinterlacingEnabled(bool); 66 67 bool SetupDeinterlace(bool interlaced, const QString& ovrf=""); -
mythtv/libs/libmythtv/videoout_xv.cpp
426 426 if ((width == 1920 || width == 1440) && height == 1088) 427 427 height = 1080; // ATSC 1920x1080 428 428 429 if (display_res && display_res->SwitchToVideo(width, height ))429 if (display_res && display_res->SwitchToVideo(width, height, (short) roundf(video_playback_rate))) 430 430 { 431 431 // Switching to custom display resolution succeeded 432 432 // Make a note of the new size … … 1605 1605 */ 1606 1606 bool VideoOutputXv::Init( 1607 1607 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) 1609 1610 { 1610 1611 needrepaint = true; 1611 1612 … … 1662 1663 // Basic setup 1663 1664 VideoOutput::Init(width, height, aspect, 1664 1665 winid, winx, winy, winw, winh, 1665 embedid);1666 prate, embedid); 1666 1667 1667 1668 // Set resolution/measurements (check XRandR, Xinerama, config settings) 1668 1669 InitDisplayMeasurements(width, height); -
mythtv/libs/libmythtv/videooutbase.h
40 40 void *codec_priv, 41 41 const QSize &video_dim, float video_aspect, 42 42 WId win_id, const QRect &display_rect, 43 float video_playback_rate, 43 44 WId embed_id); 44 45 45 46 VideoOutput(); … … 47 48 48 49 virtual bool Init(int width, int height, float aspect, 49 50 WId winid, int winx, int winy, int winw, 50 int winh, WId embedid = 0);51 int winh, float video_playback_rate, WId embedid = 0); 51 52 virtual void InitOSD(OSD *osd); 52 53 virtual void SetVideoFrameRate(float); 53 54 … … 282 283 QSize video_dim; ///< Pixel dimensions of video buffer 283 284 QSize video_disp_dim; ///< Pixel dimensions of video display area 284 285 float video_aspect; ///< Physical aspect ratio of video 286 float video_playback_rate; ///< Playback frame rate of video 285 287 286 288 /// Normally this is the same as videoAspect, but may not be 287 289 /// if the user has toggled the aspect override mode. -
mythtv/libs/libmythui/DisplayRes.cpp
40 40 // Initialize GUI mode 41 41 mode[GUI].Init(); 42 42 tW = tH = 0; 43 GetMythDB()->GetResolutionSetting("GuiVidMode", tW, tH );43 GetMythDB()->GetResolutionSetting("GuiVidMode", tW, tH, tAspect, tRate); 44 44 GetDisplaySize(tW_mm, tH_mm); 45 45 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); 47 47 48 48 49 49 // Initialize default VIDEO mode … … 89 89 { 90 90 tmode next_mode = VIDEO; // default VIDEO mode 91 91 DisplayResScreen next = mode[next_mode]; 92 next.AddRefreshRate(irate); 92 93 93 94 // try to find video override mode 94 95 uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); … … 133 134 // need to change video mode? 134 135 short target_rate = 0; 135 136 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)); 137 139 138 140 VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 139 141 .arg(next.Width()).arg(next.Height()).arg(target_rate)); -
mythtv/libs/libmythui/DisplayResScreen.cpp
90 90 if (dsr[i].Width()==d.Width() && dsr[i].Height()==d.Height()) 91 91 { 92 92 const vector<short>& rates = dsr[i].RefreshRates(); 93 if (rates.size() )93 if (rates.size() && d.RefreshRate() != 0) 94 94 { 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]; 99 105 } 106 return i; 100 107 } 101 108 } 102 109 return -1;
