Ticket #5643: mythtv_refresh_rate_auto_pickv3-trunk.patch
| File mythtv_refresh_rate_auto_pickv3-trunk.patch, 18.0 KB (added by henrik.sorensen@…, 4 years ago) |
|---|
-
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 { -
libs/libmythtv/videoout_d3d.cpp
451 451 452 452 bool VideoOutputD3D::Init(int width, int height, float aspect, 453 453 WId winid, int winx, int winy, int winw, 454 int winh, WId embedid)454 int winh, float video_prate, WId embedid) 455 455 { 456 456 VERBOSE(VB_PLAYBACK, LOC + 457 457 "Init w=" << width << " h=" << height); … … 462 462 kPrebufferFramesNormal, kPrebufferFramesSmall, 463 463 kKeepPrebuffer); 464 464 465 VideoOutput::Init(width, height, aspect, winid, 466 winx, winy, winw, winh, embedid);465 VideoOutput::Init(width, height, aspect, winid, winx, 466 winy, winw, winh, video_prate, embedid); 467 467 468 468 m_hWnd = winid; 469 469 -
libs/libmythtv/videoout_quartz.cpp
1334 1334 } 1335 1335 1336 1336 bool VideoOutputQuartz::Init(int width, int height, float aspect, 1337 WId winid, int winx, int winy, 1338 int winw, int winh, WId embedid)1337 WId winid, int winx, int winy, int winw, 1338 int winh, float video_prate, WId embedid) 1339 1339 { 1340 1340 VERBOSE(VB_PLAYBACK, LOC + 1341 1341 QString("Init(WxH %1x%2, aspect=%3, winid=%4\n\t\t\t" … … 1357 1357 vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, 1358 1358 kPrebufferFramesNormal, kPrebufferFramesSmall, 1359 1359 kKeepPrebuffer); 1360 VideoOutput::Init(width, height, aspect, winid, 1361 winx, winy, winw, winh, embedid);1360 VideoOutput::Init(width, height, aspect, winid, winx, 1361 winy, winw, winh, video_prate, embedid); 1362 1362 1363 1363 data->srcWidth = video_dim.width(); 1364 1364 data->srcHeight = video_dim.height(); … … 1508 1508 1509 1509 void VideoOutputQuartz::SetVideoFrameRate(float playback_fps) 1510 1510 { 1511 video_prate = playback_fps; 1511 1512 VERBOSE(VB_PLAYBACK, "SetVideoFrameRate("<<playback_fps<<")"); 1512 1513 } 1513 1514 -
libs/libmythtv/videoout_dx.h
21 21 ~VideoOutputDX(); 22 22 23 23 bool Init(int width, int height, float aspect, WId winid, 24 int winx, int winy, int winw, int winh, WId embedid = 0); 24 int winx, int winy, int winw, int winh, 25 float video_prate, WId embedid = 0); 25 26 void PrepareFrame(VideoFrame *buffer, FrameScanType); 26 27 void Show(FrameScanType ); 27 28 -
libs/libmythtv/videoout_directfb.cpp
354 354 355 355 bool VideoOutputDirectfb::Init(int width, int height, float aspect, WId winid, 356 356 int winx, int winy, int winw, int winh, 357 WId embedid)357 float video_prate, WId embedid) 358 358 { 359 359 // Hack to avoid embedded video output... 360 360 if ((winw < 320) || (winh < 240)) … … 647 647 display_visible_rect.y(), 648 648 display_visible_rect.width(), 649 649 display_visible_rect.height(), 650 embedid))650 video_prate, embedid)) 651 651 { 652 652 return false; 653 653 } -
libs/libmythtv/videoout_d3d.h
20 20 ~VideoOutputD3D(); 21 21 22 22 bool Init(int width, int height, float aspect, WId winid, 23 int winx, int winy, int winw, int winh, WId embedid = 0); 23 int winx, int winy, int winw, int winh, 24 float video_prate, WId embedid = 0); 24 25 25 26 bool InitD3D(); 26 27 void UnInitD3D(); -
libs/libmythtv/videoout_ivtv.h
16 16 ~VideoOutputIvtv(); 17 17 18 18 bool Init(int width, int height, float aspect, WId winid, 19 int winx, int winy, int winw, int winh, WId embedid = 0); 19 int winx, int winy, int winw, int winh, 20 float video_prate, WId embedid = 0); 20 21 void PrepareFrame(VideoFrame *buffer, FrameScanType); 21 22 void Show(FrameScanType ); 22 23 -
libs/libmythtv/videoout_null.cpp
116 116 117 117 bool VideoOutputNull::Init(int width, int height, float aspect, 118 118 WId winid, int winx, int winy, int winw, 119 int winh, WId embedid)119 int winh, float video_prate, WId embedid) 120 120 { 121 121 if ((width <= 0) || (height <= 0)) 122 122 return false; 123 123 124 124 QMutexLocker locker(&global_lock); 125 125 126 VideoOutput::Init(width, height, aspect, winid, 127 winx, winy, winw, winh, embedid);126 VideoOutput::Init(width, height, aspect, winid, winx, 127 winy, winw, winh, video_prate, embedid); 128 128 129 129 vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, 130 130 kPrebufferFramesNormal, kPrebufferFramesSmall, -
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 WId embed_id)70 float video_prate, WId embed_id) 71 71 { 72 72 (void) codec_priv; 73 73 … … 169 169 170 170 if (vo) 171 171 { 172 vo->video_prate = video_prate; 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_prate, embed_id)) 176 178 { 177 179 return vo; 178 180 } … … 184 186 renderer = VideoDisplayProfile::GetBestVideoRenderer(renderers); 185 187 } 186 188 189 190 187 191 VERBOSE(VB_IMPORTANT, LOC_ERR + 188 192 "Not compiled with any useable video output method."); 189 193 … … 370 374 * \return true if successful, false otherwise. 371 375 */ 372 376 bool VideoOutput::Init(int width, int height, float aspect, WId winid, 373 int winx, int winy, int winw, int winh, WId embedid) 377 int winx, int winy, int winw, int winh, 378 float video_prate, WId embedid) 374 379 { 375 380 (void)winid; 376 381 (void)embedid; … … 415 420 416 421 void VideoOutput::SetVideoFrameRate(float playback_fps) 417 422 { 423 video_prate = playback_fps; 418 424 if (db_vdisp_profile) 419 425 db_vdisp_profile->SetOutput(playback_fps); 420 426 } -
libs/libmythtv/videoout_directfb.h
14 14 ~VideoOutputDirectfb(); 15 15 16 16 bool Init(int width, int height, float aspect, WId winid, 17 int winx, int winy, int winw, int winh, WId embedid = 0); 17 int winx, int winy, int winw, int winh, 18 float video_prate, WId embedid = 0); 18 19 19 20 void ProcessFrame(VideoFrame *frame, OSD *osd, 20 21 FilterChain *filterList, -
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 video_prate, WId embedid = 0); 64 65 65 66 bool SetDeinterlacingEnabled(bool); 66 67 bool SetupDeinterlace(bool interlaced, const QString& ovrf=""); -
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)) 430 { 429 if (display_res && display_res->SwitchToVideo(width, height, 430 (short) roundf(video_prate))) 431 { 431 432 // Switching to custom display resolution succeeded 432 433 // Make a note of the new size 433 434 display_dim = QSize(display_res->GetPhysicalWidth(), … … 1598 1599 } 1599 1600 1600 1601 /** 1601 * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int, WId)1602 * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int,float,WId) 1602 1603 * Initializes class for video output. 1603 1604 * 1604 1605 * \return success or failure. 1605 1606 */ 1606 1607 bool VideoOutputXv::Init( 1607 int width, int height, float aspect, 1608 WId winid, int winx, int winy, int winw, int winh, WId embedid)1608 int width, int height, float aspect, WId winid, int winx, 1609 int winy, int winw, int winh, float video_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 video_prate, embedid); 1666 1667 1667 1668 // Set resolution/measurements (check XRandR, Xinerama, config settings) 1668 1669 InitDisplayMeasurements(width, height); -
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 WId embed_id);43 float video_prate, WId embed_id); 44 44 45 45 VideoOutput(); 46 46 virtual ~VideoOutput(); 47 47 48 48 virtual bool Init(int width, int height, float aspect, 49 49 WId winid, int winx, int winy, int winw, 50 int winh, WId embedid = 0);50 int winh, float video_prate, WId embedid = 0); 51 51 virtual void InitOSD(OSD *osd); 52 52 virtual void SetVideoFrameRate(float); 53 53 … … 282 282 QSize video_dim; ///< Pixel dimensions of video buffer 283 283 QSize video_disp_dim; ///< Pixel dimensions of video display area 284 284 float video_aspect; ///< Physical aspect ratio of video 285 float video_prate; ///< Playback frame rate of video 285 286 286 287 /// Normally this is the same as videoAspect, but may not be 287 288 /// if the user has toggled the aspect override mode. -
libs/libmythtv/videoout_ivtv.cpp
405 405 406 406 bool VideoOutputIvtv::Init(int width, int height, float aspect, 407 407 WId winid, int winx, int winy, int winw, 408 int winh, WId embedid)408 int winh, float video_prate, WId embedid) 409 409 { 410 410 VERBOSE(VB_PLAYBACK, LOC + "Init() -- begin"); 411 411 … … 416 416 videoDevice = gContext->GetSetting("PVR350VideoDev"); 417 417 418 418 VideoOutput::Init(width, height, aspect, winid, winx, winy, winw, winh, 419 embedid);419 video_prate, embedid); 420 420 421 421 osdbufsize = video_dim.width() * video_dim.height() * 4; 422 422 -
libs/libmythtv/videoout_quartz.h
13 13 ~VideoOutputQuartz(); 14 14 15 15 bool Init(int width, int height, float aspect, WId winid, 16 int winx, int winy, int winw, int winh, WId embedid = 0); 16 int winx, int winy, int winw, int winh, 17 float video_prate, WId embedid = 0); 17 18 void SetVideoFrameRate(float playback_fps); 18 19 void PrepareFrame(VideoFrame *buffer, FrameScanType t); 19 20 void Show(FrameScanType); -
libs/libmythtv/videoout_dx.cpp
158 158 } 159 159 160 160 bool VideoOutputDX::Init(int width, int height, float aspect, 161 WId winid, int winx, int winy, int winw,162 int winh, WId embedid)161 WId winid, int winx, int winy, int winw, 162 int winh, float video_prate, WId embedid) 163 163 { 164 164 db_vdisp_profile->SetVideoRenderer("directx"); 165 165 166 166 vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, 167 167 kPrebufferFramesNormal, kPrebufferFramesSmall, 168 168 kKeepPrebuffer); 169 VideoOutput::Init(width, height, aspect, winid, 170 winx, winy, winw, winh, embedid);169 VideoOutput::Init(width, height, aspect, winid, winx, 170 winy, winw, winh, video_prate, embedid); 171 171 172 172 wnd = winid; 173 173 -
libs/libmythtv/videoout_null.h
12 12 ~VideoOutputNull(); 13 13 14 14 bool Init(int width, int height, float aspect, WId winid, 15 int winx, int winy, int winw, int winh, WId embedid = 0); 15 int winx, int winy, int winw, int winh, 16 float video_prate, WId embedid = 0); 16 17 17 18 bool SetupDeinterlace(bool, const QString &ovrf = "") 18 19 { (void)ovrf; return false; } // we don't deinterlace in null output.. -
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 … … 90 90 tmode next_mode = VIDEO; // default VIDEO mode 91 91 DisplayResScreen next = mode[next_mode]; 92 92 93 // If requested refresh rate is 0, attempt to match video fps 94 if (next.RefreshRate() == 0) 95 next.AddRefreshRate(irate); 96 93 97 // try to find video override mode 94 98 uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); 95 99 DisplayResMapCIt it = in_size_to_output_mode.find(key); … … 133 137 // need to change video mode? 134 138 short target_rate = 0; 135 139 DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 136 bool chg = !(next == last) || !(last.RefreshRate() == target_rate); 140 // If GuiVidModeRefreshRate is 0, assume any refresh rate is good enough. 141 bool chg = !(next == last) || (next.RefreshRate() !=0 && !(last.RefreshRate() == target_rate)); 137 142 138 143 VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 139 144 .arg(next.Width()).arg(next.Height()).arg(target_rate)); -
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;
