Ticket #5643: mythtv_refresh_rate_auto_pickv2.patch
File mythtv_refresh_rate_auto_pickv2.patch, 8.1 KB (added by , 16 years ago) |
---|
-
mythtv/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 { -
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; … … 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_playback_rate, embed_id)) 173 175 { 174 176 return vo; 175 177 } … … 363 365 * \return true if successful, false otherwise. 364 366 */ 365 367 bool VideoOutput::Init(int width, int height, float aspect, WId winid, 366 int winx, int winy, int winw, int winh, WId embedid) 368 int winx, int winy, int winw, int winh, 369 float prate, WId embedid) 367 370 { 368 371 (void)winid; 369 372 (void)embedid; … … 389 392 390 393 embedding = false; 391 394 395 SetVideoFrameRate(prate); 396 392 397 return true; 393 398 } 394 399 … … 405 410 406 411 void VideoOutput::SetVideoFrameRate(float playback_fps) 407 412 { 413 video_playback_rate = playback_fps; 408 414 db_vdisp_profile->SetOutput(playback_fps); 409 415 } 410 416 -
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
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 ))408 if (display_res && display_res->SwitchToVideo(width, height, (short) roundf(video_playback_rate))) 409 409 { 410 410 // Switching to custom display resolution succeeded 411 411 // Make a note of the new size … … 1575 1575 */ 1576 1576 bool VideoOutputXv::Init( 1577 1577 int width, int height, float aspect, 1578 WId winid, int winx, int winy, int winw, int winh, WId embedid) 1578 WId winid, int winx, int winy, int winw, int winh, 1579 float 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 1613 prate, embedid); 1613 1614 1614 1615 // Set resolution/measurements (check XRandR, Xinerama, config settings) 1615 1616 InitDisplayMeasurements(width, height); -
mythtv/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 float video_playback_rate, 39 40 WId embed_id); 40 41 41 42 VideoOutput(); … … 43 44 44 45 virtual bool Init(int width, int height, float aspect, 45 46 WId winid, int winx, int winy, int winw, 46 int winh, WId embedid = 0);47 int winh, float video_playback_rate, WId embedid = 0); 47 48 virtual void InitOSD(OSD *osd); 48 49 virtual void SetVideoFrameRate(float); 49 50 … … 276 277 QSize video_dim; ///< Pixel dimensions of video buffer 277 278 QSize video_disp_dim; ///< Pixel dimensions of video display area 278 279 float video_aspect; ///< Physical aspect ratio of video 280 float video_playback_rate; ///< Playback frame rate of video 279 281 280 282 /// Normally this is the same as videoAspect, but may not be 281 283 /// if the user has toggled the aspect override mode. -
mythtv/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 … … 86 86 { 87 87 tmode next_mode = VIDEO; // default VIDEO mode 88 88 DisplayResScreen next = mode[next_mode]; 89 next.AddRefreshRate(irate); 89 90 90 91 // try to find video override mode 91 92 uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); … … 130 131 // need to change video mode? 131 132 short target_rate = 0; 132 133 DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 133 bool chg = !(next == last) || !(last.RefreshRate() == target_rate); 134 // If GuiVidModeRefreshRate is 0, assume any refresh rate is good enough. 135 bool chg = !(next == last) || (next.RefreshRate() !=0 && !(last.RefreshRate() == target_rate)); 134 136 135 137 VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 136 138 .arg(next.Width()).arg(next.Height()).arg(target_rate)); -
mythtv/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;