Ticket #5643: mythtv_refresh_rate_auto_pickv3.patch
| File mythtv_refresh_rate_auto_pickv3.patch, 18.0 KB (added by henrik.sorensen@…, 4 years ago) |
|---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
633 633 GetDecoder()->GetVideoCodecID(), 634 634 GetDecoder()->GetVideoCodecPrivate(), 635 635 video_disp_dim, video_aspect, 636 widget->winId(), display_rect, 0 /*embedid*/); 636 widget->winId(), display_rect, (video_frame_rate * play_speed), 637 0 /*embedid*/); 637 638 638 639 if (!videoOutput) 639 640 { … … 648 649 videoOutput->SetVideoScalingAllowed(db_scale); 649 650 650 651 // We need to tell it this for automatic deinterlacer settings 651 videoOutput->SetVideoFrameRate(video_frame_rate * play_speed);652 videoOutput->SetVideoFrameRate(video_frame_rate * play_speed); 652 653 653 654 if (videoOutput->hasMCAcceleration() && !decode_extra_audio) 654 655 { -
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
1333 1333 } 1334 1334 1335 1335 bool VideoOutputQuartz::Init(int width, int height, float aspect, 1336 WId winid, int winx, int winy, 1337 int winw, int winh, WId embedid)1336 WId winid, int winx, int winy, int winw, 1337 int winh, float video_prate, WId embedid) 1338 1338 { 1339 1339 VERBOSE(VB_PLAYBACK, LOC + 1340 1340 QString("Init(WxH %1x%2, aspect=%3, winid=%4\n\t\t\t" … … 1356 1356 vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, 1357 1357 kPrebufferFramesNormal, kPrebufferFramesSmall, 1358 1358 kKeepPrebuffer); 1359 VideoOutput::Init(width, height, aspect, winid, 1360 winx, winy, winw, winh, embedid);1359 VideoOutput::Init(width, height, aspect, winid, winx, 1360 winy, winw, winh, video_prate, embedid); 1361 1361 1362 1362 data->srcWidth = video_dim.width(); 1363 1363 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
353 353 354 354 bool VideoOutputDirectfb::Init(int width, int height, float aspect, WId winid, 355 355 int winx, int winy, int winw, int winh, 356 WId embedid)356 float video_prate, WId embedid) 357 357 { 358 358 // Hack to avoid embedded video output... 359 359 if ((winw < 320) || (winh < 240)) … … 646 646 display_visible_rect.y(), 647 647 display_visible_rect.width(), 648 648 display_visible_rect.height(), 649 embedid))649 video_prate, embedid)) 650 650 { 651 651 return false; 652 652 } -
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
115 115 116 116 bool VideoOutputNull::Init(int width, int height, float aspect, 117 117 WId winid, int winx, int winy, int winw, 118 int winh, WId embedid)118 int winh, float video_prate, WId embedid) 119 119 { 120 120 if ((width <= 0) || (height <= 0)) 121 121 return false; 122 122 123 123 QMutexLocker locker(&global_lock); 124 124 125 VideoOutput::Init(width, height, aspect, winid, 126 winx, winy, winw, winh, embedid);125 VideoOutput::Init(width, height, aspect, winid, winx, 126 winy, winw, winh, video_prate, embedid); 127 127 128 128 vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, 129 129 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 … … 166 166 167 167 if (vo) 168 168 { 169 vo->video_prate = video_prate; 169 170 if (vo->Init( 170 171 video_dim.width(), video_dim.height(), video_aspect, 171 172 win_id, display_rect.x(), display_rect.y(), 172 display_rect.width(), display_rect.height(), embed_id)) 173 display_rect.width(), display_rect.height(), 174 video_prate, embed_id)) 173 175 { 174 176 return vo; 175 177 } … … 181 183 renderer = VideoDisplayProfile::GetBestVideoRenderer(renderers); 182 184 } 183 185 186 187 184 188 VERBOSE(VB_IMPORTANT, LOC_ERR + 185 189 "Not compiled with any useable video output method."); 186 190 … … 363 367 * \return true if successful, false otherwise. 364 368 */ 365 369 bool VideoOutput::Init(int width, int height, float aspect, WId winid, 366 int winx, int winy, int winw, int winh, WId embedid) 370 int winx, int winy, int winw, int winh, 371 float video_prate, WId embedid) 367 372 { 368 373 (void)winid; 369 374 (void)embedid; … … 405 410 406 411 void VideoOutput::SetVideoFrameRate(float playback_fps) 407 412 { 413 video_prate = playback_fps; 408 414 db_vdisp_profile->SetOutput(playback_fps); 409 415 } 410 416 -
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
405 405 if ((width == 1920 || width == 1440) && height == 1088) 406 406 height = 1080; // ATSC 1920x1080 407 407 408 if (display_res && display_res->SwitchToVideo(width, height)) 409 { 408 if (display_res && display_res->SwitchToVideo(width, height, 409 (short) roundf(video_prate))) 410 { 410 411 // Switching to custom display resolution succeeded 411 412 // Make a note of the new size 412 413 display_dim = QSize(display_res->GetPhysicalWidth(), … … 1568 1569 } 1569 1570 1570 1571 /** 1571 * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int, WId)1572 * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int,float,WId) 1572 1573 * Initializes class for video output. 1573 1574 * 1574 1575 * \return success or failure. 1575 1576 */ 1576 1577 bool VideoOutputXv::Init( 1577 int width, int height, float aspect, 1578 WId winid, int winx, int winy, int winw, int winh, WId embedid)1578 int width, int height, float aspect, WId winid, int winx, 1579 int winy, int winw, int winh, float video_prate, WId embedid) 1579 1580 { 1580 1581 needrepaint = true; 1581 1582 … … 1609 1610 // Basic setup 1610 1611 VideoOutput::Init(width, height, aspect, 1611 1612 winid, winx, winy, winw, winh, 1612 embedid);1613 video_prate, embedid); 1613 1614 1614 1615 // Set resolution/measurements (check XRandR, Xinerama, config settings) 1615 1616 InitDisplayMeasurements(width, height); -
libs/libmythtv/videooutbase.h
36 36 void *codec_priv, 37 37 const QSize &video_dim, float video_aspect, 38 38 WId win_id, const QRect &display_rect, 39 WId embed_id);39 float video_prate, WId embed_id); 40 40 41 41 VideoOutput(); 42 42 virtual ~VideoOutput(); 43 43 44 44 virtual bool Init(int width, int height, float aspect, 45 45 WId winid, int winx, int winy, int winw, 46 int winh, WId embedid = 0);46 int winh, float video_prate, WId embedid = 0); 47 47 virtual void InitOSD(OSD *osd); 48 48 virtual void SetVideoFrameRate(float); 49 49 … … 276 276 QSize video_dim; ///< Pixel dimensions of video buffer 277 277 QSize video_disp_dim; ///< Pixel dimensions of video display area 278 278 float video_aspect; ///< Physical aspect ratio of video 279 float video_prate; ///< Playback frame rate of video 279 280 280 281 /// Normally this is the same as videoAspect, but may not be 281 282 /// 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/libmyth/DisplayRes.cpp
37 37 // Initialize GUI mode 38 38 mode[GUI].Init(); 39 39 tW = tH = 0; 40 gContext->GetResolutionSetting("GuiVidMode", tW, tH );40 gContext->GetResolutionSetting("GuiVidMode", tW, tH, tAspect, tRate); 41 41 GetDisplaySize(tW_mm, tH_mm); 42 42 gContext->GetResolutionSetting("DisplaySize", tW_mm, tH_mm); 43 mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, 0);43 mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, tRate); 44 44 45 45 46 46 // Initialize default VIDEO mode … … 87 87 tmode next_mode = VIDEO; // default VIDEO mode 88 88 DisplayResScreen next = mode[next_mode]; 89 89 90 // If requested refresh rate is 0, attempt to match video fps 91 if (next.RefreshRate() == 0) 92 next.AddRefreshRate(irate); 93 90 94 // try to find video override mode 91 95 uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); 92 96 DisplayResMapCIt it = in_size_to_output_mode.find(key); … … 130 134 // need to change video mode? 131 135 short target_rate = 0; 132 136 DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 133 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)); 134 139 135 140 VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 136 141 .arg(next.Width()).arg(next.Height()).arg(target_rate)); -
libs/libmyth/DisplayResScreen.cpp
89 89 if (dsr[i].Width()==d.Width() && dsr[i].Height()==d.Height()) 90 90 { 91 91 const vector<short>& rates = dsr[i].RefreshRates(); 92 if (rates.size() )92 if (rates.size() && d.RefreshRate() != 0) 93 93 { 94 vector<short>::const_iterator it = 95 find(rates.begin(), rates.end(), d.RefreshRate()); 96 target_rate = (it == rates.end()) ? *(--rates.end()) : *it; 97 return i; 94 for (uint j=0; j < rates.size(); ++j) 95 { 96 // Multiple of target_rate will do 97 if (rates[j] % d.RefreshRate() == 0) 98 { 99 target_rate = rates[j]; 100 return i; 101 } 102 } 103 target_rate = rates[rates.size() - 1]; 98 104 } 105 return i; 99 106 } 100 107 } 101 108 return -1;
