Ticket #5643: adjust_rate_2.patch
File adjust_rate_2.patch, 39.6 KB (added by , 15 years ago) |
---|
-
libs/libmyth/DisplayRes.cpp
#! /bin/sh /usr/share/dpatch/dpatch-run ## 42_adjust_rate.dpatch by <avenardj@htpc.avenard.org> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad mythtv-release~/libs/libmyth/DisplayRes.cpp mythtv-release/libs/libmyth/DisplayRes.cpp
old new 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, (float)tRate); 44 44 45 45 46 46 // Initialize default VIDEO mode 47 47 tW = tH = 0; 48 48 gContext->GetResolutionSetting("TVVidMode", tW, tH, tAspect, tRate); 49 mode[VIDEO] = DisplayResScreen(tW, tH, tW_mm, tH_mm, tAspect, tRate);49 mode[VIDEO] = DisplayResScreen(tW, tH, tW_mm, tH_mm, tAspect, (float)tRate); 50 50 51 51 52 52 // Initialize video override mode … … 64 64 break; 65 65 66 66 uint key = DisplayResScreen::CalcKey(iw, ih, irate); 67 DisplayResScreen scr(ow, oh, tW_mm, tH_mm, oaspect, orate);67 DisplayResScreen scr(ow, oh, tW_mm, tH_mm, oaspect, (float) orate); 68 68 in_size_to_output_mode[key] = scr; 69 69 } 70 70 … … 82 82 return true; 83 83 } 84 84 85 bool DisplayRes::SwitchToVideo(int iwidth, int iheight, short irate )85 bool DisplayRes::SwitchToVideo(int iwidth, int iheight, short irate, float frate) 86 86 { 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 { 93 VERBOSE(VB_PLAYBACK, QString("*** Trying to match best resolution %1Hz") .arg(frate)); 94 next.AddRefreshRate(frate); 95 } 96 90 97 // try to find video override mode 91 98 uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); 92 99 DisplayResMapCIt it = in_size_to_output_mode.find(key); … … 94 101 mode[next_mode = CUSTOM_VIDEO] = next = it->second; 95 102 96 103 // need to change video mode? 97 short target_rate =0;104 float target_rate = 0.0; 98 105 DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 99 bool chg = !(next == last) || !( last.RefreshRate() == target_rate);106 bool chg = !(next == last) || !(DisplayResScreen::compare_rates(last.RefreshRate(),target_rate)); 100 107 101 108 VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 102 109 .arg(next.Width()).arg(next.Height()).arg(target_rate)); … … 128 135 DisplayResScreen next = mode[next_mode]; 129 136 130 137 // need to change video mode? 131 short target_rate =0;138 float target_rate = 0.0; 132 139 DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); 133 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 142 && !(DisplayResScreen::compare_rates(last.RefreshRate(),target_rate)))); 134 143 135 144 VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") 136 145 .arg(next.Width()).arg(next.Height()).arg(target_rate)); … … 154 163 bool DisplayRes::SwitchToCustomGUI(int width, int height, short rate) 155 164 { 156 165 mode[CUSTOM_GUI] = DisplayResScreen(width, height, mode[GUI].Width_mm(), 157 mode[GUI].Height_mm(), -1.0, rate);166 mode[GUI].Height_mm(), -1.0, (float) rate); 158 167 return SwitchToGUI(CUSTOM_GUI); 159 168 } 160 169 161 170 const vector<short> DisplayRes::GetRefreshRates(int width, int height) const { 162 short tr;163 vector< short> empty;171 vector<short> srates; 172 vector<float> rates = GetRefreshRatesFloat(width, height); 164 173 165 const DisplayResScreen drs(width, height, 0, 0, -1.0, 0); 174 for (int i=0; i<rates.size(); i++) 175 srates.push_back((short) rates[i]); 176 return srates; 177 } 178 const vector<float> DisplayRes::GetRefreshRatesFloat(int width, int height) const { 179 float tr; 180 vector<float> empty; 181 182 const DisplayResScreen drs(width, height, 0, 0, -1.0, 0.0); 166 183 const DisplayResVector& drv = GetVideoModes(); 167 184 int t = DisplayResScreen::FindBestMatch(drv, drs, tr); 168 185 if (t < 0) -
libs/libmyth/DisplayRes.h
diff -urNad mythtv-release~/libs/libmyth/DisplayRes.h mythtv-release/libs/libmyth/DisplayRes.h
old new 46 46 * \brief Switches to the resolution and refresh rate defined in the 47 47 * database for the specified video resolution and frame rate. 48 48 */ 49 bool SwitchToVideo(int iwidth, int iheight, short irate = 0 );49 bool SwitchToVideo(int iwidth, int iheight, short irate = 0, float frate = 0.0); 50 50 /** \brief Switches to the GUI resolution specified. 51 51 * 52 52 * If which_gui is GUI then this switches to the resolution … … 110 110 /// \brief Returns all video modes supported by the display. 111 111 virtual const vector<DisplayResScreen>& GetVideoModes() const = 0; 112 112 /// \brief Returns refresh rates available at a specific screen resolution. 113 const vector<short> GetRefreshRates(int width, int height) const; 113 const vector<float> GetRefreshRatesFloat(int width, int height) const; 114 const vector<short> GetRefreshRates(int width, int height) const; 114 115 /** @} */ 115 116 116 117 protected: … … 120 121 121 122 // These methods are implemented by the subclasses 122 123 virtual bool GetDisplaySize(int &width_mm, int &height_mm) const = 0; 123 virtual bool SwitchToVideoMode(int width, int height, short framerate) = 0;124 virtual bool SwitchToVideoMode(int width, int height, float framerate) = 0; 124 125 125 126 private: 126 127 DisplayRes(const DisplayRes & rhs); // disable copy constructor; -
libs/libmyth/DisplayResOSX.cpp
diff -urNad mythtv-release~/libs/libmyth/DisplayResOSX.cpp mythtv-release/libs/libmyth/DisplayResOSX.cpp
old new 66 66 return d; 67 67 } 68 68 69 bool DisplayResOSX::SwitchToVideoMode(int width, int height, short refreshrate)69 bool DisplayResOSX::SwitchToVideoMode(int width, int height, float refreshrate) 70 70 { 71 71 CGDirectDisplayID d = mythtv_display(); 72 72 CFDictionaryRef dispMode = NULL; … … 75 75 // find mode that matches the desired size 76 76 if (refreshrate) 77 77 dispMode = CGDisplayBestModeForParametersAndRefreshRate( 78 d, 32, width, height, (CGRefreshRate)( refreshrate), &match);78 d, 32, width, height, (CGRefreshRate)((short)refreshrate), &match); 79 79 80 80 if (!match) 81 81 dispMode = … … 122 122 123 123 if (screen_map.find(key)==screen_map.end()) 124 124 screen_map[key] = DisplayResScreen(width, height, 125 0, 0, -1.0, refresh);125 0, 0, -1.0, (float) refresh); 126 126 else 127 127 screen_map[key].AddRefreshRate(refresh); 128 128 } -
libs/libmyth/DisplayResOSX.h
diff -urNad mythtv-release~/libs/libmyth/DisplayResOSX.h mythtv-release/libs/libmyth/DisplayResOSX.h
old new 12 12 13 13 protected: 14 14 bool GetDisplaySize(int &width_mm, int &height_mm) const; 15 bool SwitchToVideoMode(int width, int height, short framerate);15 bool SwitchToVideoMode(int width, int height, float framerate); 16 16 17 17 private: 18 18 mutable vector<DisplayResScreen> m_video_modes; -
libs/libmyth/DisplayResScreen.cpp
diff -urNad mythtv-release~/libs/libmyth/DisplayResScreen.cpp mythtv-release/libs/libmyth/DisplayResScreen.cpp
old new 1 1 #include "DisplayResScreen.h" 2 2 #include "mythcontext.h" 3 3 4 #include <cmath> 5 4 6 DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 5 double aspectRatio, short refreshRate)6 : width(w), height(h), width_mm(mw), height_mm(mh) 7 double aspectRatio, float refreshRate) 8 : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) 7 9 { 8 10 SetAspectRatio(aspectRatio); 9 11 if (refreshRate > 0) … … 11 13 } 12 14 13 15 DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 14 const vector< short>& rr)15 : width(w), height(h), width_mm(mw), height_mm(mh), refreshRates(rr) 16 const vector<float>& rr) 17 : width(w), height(h), width_mm(mw), height_mm(mh), refreshRates(rr), custom(false) 16 18 { 17 19 SetAspectRatio(-1.0); 18 20 } 19 21 20 22 DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 21 const short* rr, uint rr_length)22 : width(w), height(h), width_mm(mw), height_mm(mh) 23 const float* rr, uint rr_length) 24 : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) 23 25 { 24 26 SetAspectRatio(-1.0); 25 27 for (uint i = 0; i < rr_length; ++i) … … 28 30 sort(refreshRates.begin(), refreshRates.end()); 29 31 } 30 32 33 DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, 34 const short* rr, uint rr_length) 35 : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) 36 { 37 SetAspectRatio(-1.0); 38 for (uint i = 0; i < rr_length; ++i) 39 refreshRates.push_back((float)rr[i]); 40 41 sort(refreshRates.begin(), refreshRates.end()); 42 } 43 31 44 DisplayResScreen::DisplayResScreen(const QString &str) 32 : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0) 45 : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0), custom(false) 33 46 { 34 47 refreshRates.clear(); 35 48 QStringList slist = QStringList::split(":", str); … … 43 56 height_mm = slist[3].toInt(); 44 57 aspect = slist[4].toDouble(); 45 58 for (uint i = 5; i<slist.size(); ++i) 46 refreshRates.push_back(slist[i].to Short());59 refreshRates.push_back(slist[i].toFloat()); 47 60 } 48 61 } 49 62 … … 80 93 return dsr; 81 94 } 82 95 96 //compares if the float f1 is equal with f2 and returns 1 if true and 0 if false 97 bool DisplayResScreen::compare_rates(float f1, float f2) 98 { 99 float precision = 0.01; 100 if (((f1 - precision) < f2) && 101 ((f1 + precision) > f2)) 102 { 103 return true; 104 } 105 else 106 { 107 return false; 108 } 109 } 110 83 111 int DisplayResScreen::FindBestMatch(const vector<DisplayResScreen>& dsr, 84 112 const DisplayResScreen& d, 85 113 short& target_rate) 86 114 { 115 float target; 116 int i = FindBestMatch(dsr, d, target); 117 target_rate = target; 118 return i; 119 } 120 121 int DisplayResScreen::FindBestMatch(const vector<DisplayResScreen>& dsr, 122 const DisplayResScreen& d, 123 float& target_rate) 124 { 125 // Amend vector with custom list 87 126 for (uint i=0; i<dsr.size(); ++i) 88 127 { 89 128 if (dsr[i].Width()==d.Width() && dsr[i].Height()==d.Height()) 90 129 { 91 const vector< short>& rates = dsr[i].RefreshRates();92 if (rates.size() )130 const vector<float>& rates = dsr[i].RefreshRates(); 131 if (rates.size() && d.RefreshRate() != 0) 93 132 { 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; 98 } 133 for (uint j=0; j < rates.size(); ++j) 134 { 135 // Multiple of target_rate will do 136 if (compare_rates(d.RefreshRate(),rates[j]) || (fmod(rates[j],d.RefreshRate()) <= 0.01)) 137 { 138 target_rate = rates[j]; 139 return i; 140 } 141 } 142 // Can't find exact frame rate, so try rounding to the nearest integer, so 23.97Hz will work with 24Hz etc 143 for (uint j=0; j < rates.size(); ++j) 144 { 145 float rounded = (float) ((int) (rates[j] + 0.5)); 146 // Multiple of target_rate will do 147 if (compare_rates(d.RefreshRate(),rounded) || (fmod(rounded,d.RefreshRate()) <= 0.01)) 148 { 149 target_rate = rounded; 150 return i; 151 } 152 } 153 target_rate = rates[rates.size() - 1]; 154 } 155 return i; 99 156 } 100 157 } 101 158 return -1; -
libs/libmyth/DisplayResScreen.h
diff -urNad mythtv-release~/libs/libmyth/DisplayResScreen.h mythtv-release/libs/libmyth/DisplayResScreen.h
old new 14 14 public: 15 15 // Constructors, initializers 16 16 DisplayResScreen() 17 : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0) {;}17 : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0), custom(false) {;} 18 18 DisplayResScreen(int w, int h, int mw, int mh, 19 double aspectRatio/* = -1.0*/, short refreshRate/* = 0*/);19 double aspectRatio/* = -1.0*/, float refreshRate/* = 0*/); 20 20 DisplayResScreen(int w, int h, int mw, int mh, 21 const vector<short>& refreshRates); 21 const vector<float>& refreshRates); 22 DisplayResScreen(int w, int h, int mw, int mh, 23 const float* refreshRates, uint rr_length); 22 24 DisplayResScreen(int w, int h, int mw, int mh, 23 25 const short* refreshRates, uint rr_length); 24 26 DisplayResScreen(const QString &str); … … 29 31 int Height() const { return height; } 30 32 int Width_mm() const { return width_mm; } 31 33 int Height_mm() const { return height_mm; } 34 bool Custom() const { return custom; } 35 32 36 inline double AspectRatio() const; 33 inline short RefreshRate() const;34 const vector< short>& RefreshRates() const { return refreshRates; }37 inline float RefreshRate() const; 38 const vector<float>& RefreshRates() const { return refreshRates; } 35 39 36 40 // Sets, adds 37 41 void SetAspectRatio(double a); 38 void AddRefreshRate( short rr) {42 void AddRefreshRate(float rr) { 39 43 refreshRates.push_back(rr); 40 44 sort(refreshRates.begin(), refreshRates.end()); 41 45 } 42 46 void ClearRefreshRates(void) { 47 refreshRates.clear(); 48 } 49 void SetCustom(bool b) { 50 custom = b; 51 } 52 53 // Map for matching real rates and xrandr rate; 54 map<float, short> realRates; 55 43 56 // Converters & comparitors 44 57 QString toString() const; 45 58 inline bool operator < (const DisplayResScreen& b) const; … … 50 63 static vector<DisplayResScreen> Convert(const QStringList& slist); 51 64 static int FindBestMatch(const vector<DisplayResScreen>& dsr, 52 65 const DisplayResScreen& d, 66 float& target_rate); 67 static int FindBestMatch(const vector<DisplayResScreen>& dsr, 68 const DisplayResScreen& d, 53 69 short& target_rate); 54 70 static inline int CalcKey(int w, int h, int rate); 71 static bool compare_rates(float f1, float f2); 55 72 56 73 private: 57 74 int width, height; // size in pixels 58 75 int width_mm, height_mm; // physical size in millimeters 59 76 double aspect; // aspect ratio, calculated or set 60 vector<short> refreshRates; 77 vector<float> refreshRates; 78 bool custom; // Set if resolution was defined manually 61 79 }; 62 80 81 63 82 typedef vector<DisplayResScreen> DisplayResVector; 64 83 typedef DisplayResVector::iterator DisplayResVectorIt; 65 84 typedef DisplayResVector::const_iterator DisplayResVectorCIt; … … 85 104 return aspect; 86 105 } 87 106 88 inline short DisplayResScreen::RefreshRate() const107 inline float DisplayResScreen::RefreshRate() const 89 108 { 90 109 if (refreshRates.size() >= 1) 91 110 return refreshRates[0]; 92 else return 0 ;111 else return 0.0; 93 112 } 94 113 95 114 inline bool DisplayResScreen::operator < (const DisplayResScreen& b) const -
libs/libmyth/DisplayResX.cpp
diff -urNad mythtv-release~/libs/libmyth/DisplayResX.cpp mythtv-release/libs/libmyth/DisplayResX.cpp
old new 4 4 #include <cstring> 5 5 #include <cstdlib> 6 6 7 #include "mythcontext.h" 8 #include <qregexp.h> 9 #include <qfile.h> 10 #include <qfileinfo.h> 11 7 12 #include "util-x11.h" 8 13 9 14 #include <X11/extensions/Xrandr.h> // this has to be after util-x11.h (Qt bug) … … 32 37 return false; 33 38 } 34 39 35 bool DisplayResX::SwitchToVideoMode(int width, int height, short desired_rate)40 bool DisplayResX::SwitchToVideoMode(int width, int height, float desired_rate) 36 41 { 37 short rate; 42 float rate; 43 short finalrate; 44 38 45 DisplayResScreen desired_screen(width, height, 0, 0, -1.0, desired_rate); 39 46 int idx = DisplayResScreen::FindBestMatch(m_video_modes_unsorted, 40 47 desired_screen, rate); … … 49 56 Rotation rot; 50 57 XRRConfigCurrentConfiguration(cfg, &rot); 51 58 59 // Search real xrandr rate for desired_rate 60 finalrate = (short) rate; 61 for (int i=0; i < m_video_modes.size(); i++) { 62 if ((m_video_modes[i].Width() == width) && (m_video_modes[i].Height() == height)) 63 { 64 if (m_video_modes[i].Custom()) 65 { 66 finalrate = m_video_modes[i].realRates[rate]; 67 VERBOSE(VB_PLAYBACK, QString("CustomRate Found, set %1Hz as %2") .arg(rate) .arg(finalrate)); 68 } 69 break; 70 } 71 } 72 52 73 Window root = DefaultRootWindow(display); 53 74 Status status = XRRSetScreenConfigAndRate(display, cfg, root, idx, 54 rot, rate, CurrentTime);75 rot, finalrate, CurrentTime); 55 76 56 77 XRRFreeScreenConfigInfo(cfg); 57 78 XCloseDisplay(display); … … 67 88 68 89 const DisplayResVector& DisplayResX::GetVideoModes(void) const 69 90 { 70 71 91 if (m_video_modes.size()) 92 return m_video_modes; 72 93 73 94 Display *display = NULL; 74 95 XRRScreenConfiguration *cfg = GetScreenConfig(display); … … 78 99 int num_sizes, num_rates; 79 100 XRRScreenSize *sizes = NULL; 80 101 X11S(sizes = XRRConfigSizes(cfg, &num_sizes)); 102 81 103 for (int i = 0; i < num_sizes; ++i) 82 104 { 83 105 short *rates = NULL; 84 106 X11S(rates = XRRRates(display, DefaultScreen(display), i, &num_rates)); 85 107 DisplayResScreen scr(sizes[i].width, sizes[i].height, 86 sizes[i].mwidth, sizes[i].mheight, 87 rates, num_rates); 88 m_video_modes.push_back(scr); 108 sizes[i].mwidth, sizes[i].mheight, 109 rates, num_rates); 110 m_video_modes.push_back(scr); 111 } 112 113 QString customscreen = gContext->GetSetting("CustomScreenRate"); 114 if (gContext->GetNumSetting("UseVideoModes", 0) && (customscreen != "")); 115 { 116 QFileInfo fi(customscreen); 117 QFile file(customscreen); 118 119 if (!fi.exists() || !fi.isFile()) 120 { 121 VERBOSE(VB_PLAYBACK, QString("CustomScreenRate: \"%1\" failed: does not exist or isn't a file") 122 .arg(customscreen)); 123 } 124 else if ( file.open( IO_ReadOnly ) ) { 125 QRegExp regexp = QRegExp("^\\s*(\\d+),(\\d+),(\\d+\\.?\\d*),(\\d+)\\s*$"); 126 QTextStream stream( &file ); 127 QString line; 128 int pos; 129 while ( !stream.atEnd() ) { 130 pos = regexp.search(stream.readLine()); 131 if (pos > -1) { 132 int w = regexp.cap(1).toInt(); 133 int h = regexp.cap(2).toInt(); 134 float hz = regexp.cap(3).toFloat(); 135 int xrandrhz = regexp.cap(4).toShort(); 136 int found = -1; 137 VERBOSE(VB_PLAYBACK, QString("Found definition for %1x%2 @ %3Hz (xrandr: %4)") 138 .arg(w) .arg(h) .arg(hz) .arg(xrandrhz)); 139 // find if video mode already exist, and remove refresh rates for custom one 140 for (int i=0; i < m_video_modes.size(); i++) { 141 if ((m_video_modes[i].Width() == w) && (m_video_modes[i].Height() == h)) 142 { 143 found = i; 144 if (!m_video_modes[i].Custom()) 145 { 146 m_video_modes[i].ClearRefreshRates(); 147 m_video_modes[i].SetCustom(true); 148 } 149 m_video_modes[i].AddRefreshRate(hz); 150 m_video_modes[i].realRates[hz] = xrandrhz; 151 break; 152 } 153 } 154 if (found < 0) 155 { 156 DisplayResScreen scr(w, h, 0, 0, -1.0, hz); 157 scr.SetCustom(true); 158 m_video_modes.push_back(scr); 159 } 160 } 161 } 162 file.close(); 163 } 89 164 } 165 90 166 m_video_modes_unsorted = m_video_modes; 91 167 sort(m_video_modes.begin(), m_video_modes.end()); 92 168 -
libs/libmyth/DisplayResX.h
diff -urNad mythtv-release~/libs/libmyth/DisplayResX.h mythtv-release/libs/libmyth/DisplayResX.h
old new 12 12 13 13 protected: 14 14 bool GetDisplaySize(int &width_mm, int &height_mm) const; 15 bool SwitchToVideoMode(int width, int height, short framerate);15 bool SwitchToVideoMode(int width, int height, float framerate); 16 16 17 17 private: 18 18 mutable vector<DisplayResScreen> m_video_modes; -
libs/libmythtv/NuppelVideoPlayer.cpp
diff -urNad mythtv-release~/libs/libmythtv/NuppelVideoPlayer.cpp mythtv-release/libs/libmythtv/NuppelVideoPlayer.cpp
old new 635 635 GetDecoder()->GetVideoCodecID(), 636 636 GetDecoder()->GetVideoCodecPrivate(), 637 637 video_disp_dim, video_aspect, 638 widget->winId(), display_rect, 0 /*embedid*/); 638 widget->winId(), display_rect, (video_frame_rate * play_speed), 639 0 /*embedid*/); 639 640 640 641 if (!videoOutput) 641 642 { … … 650 651 videoOutput->SetVideoScalingAllowed(db_scale); 651 652 652 653 // We need to tell it this for automatic deinterlacer settings 653 654 videoOutput->SetVideoFrameRate(video_frame_rate * play_speed); 654 655 655 656 if (videoOutput->hasMCAcceleration() && !decode_extra_audio) 656 657 { -
libs/libmythtv/videoout_d3d.cpp
diff -urNad mythtv-release~/libs/libmythtv/videoout_d3d.cpp mythtv-release/libs/libmythtv/videoout_d3d.cpp
old new 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_d3d.h
diff -urNad mythtv-release~/libs/libmythtv/videoout_d3d.h mythtv-release/libs/libmythtv/videoout_d3d.h
old new 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_directfb.cpp
diff -urNad mythtv-release~/libs/libmythtv/videoout_directfb.cpp mythtv-release/libs/libmythtv/videoout_directfb.cpp
old new 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_directfb.h
diff -urNad mythtv-release~/libs/libmythtv/videoout_directfb.h mythtv-release/libs/libmythtv/videoout_directfb.h
old new 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_dx.cpp
diff -urNad mythtv-release~/libs/libmythtv/videoout_dx.cpp mythtv-release/libs/libmythtv/videoout_dx.cpp
old new 158 158 } 159 159 160 160 bool VideoOutputDX::Init(int width, int height, float aspect, 161 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_dx.h
diff -urNad mythtv-release~/libs/libmythtv/videoout_dx.h mythtv-release/libs/libmythtv/videoout_dx.h
old new 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_ivtv.cpp
diff -urNad mythtv-release~/libs/libmythtv/videoout_ivtv.cpp mythtv-release/libs/libmythtv/videoout_ivtv.cpp
old new 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_ivtv.h
diff -urNad mythtv-release~/libs/libmythtv/videoout_ivtv.h mythtv-release/libs/libmythtv/videoout_ivtv.h
old new 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
diff -urNad mythtv-release~/libs/libmythtv/videoout_null.cpp mythtv-release/libs/libmythtv/videoout_null.cpp
old new 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/videoout_null.h
diff -urNad mythtv-release~/libs/libmythtv/videoout_null.h mythtv-release/libs/libmythtv/videoout_null.h
old new 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/libmythtv/videoout_quartz.cpp
diff -urNad mythtv-release~/libs/libmythtv/videoout_quartz.cpp mythtv-release/libs/libmythtv/videoout_quartz.cpp
old new 1192 1192 } 1193 1193 1194 1194 bool VideoOutputQuartz::Init(int width, int height, float aspect, 1195 WId winid, int winx, int winy, 1196 int winw, int winh, WId embedid)1195 WId winid, int winx, int winy, int winw, 1196 int winh, float video_prate, WId embedid) 1197 1197 { 1198 1198 VERBOSE(VB_PLAYBACK, LOC + 1199 1199 QString("Init(WxH %1x%2, aspect=%3, winid=%4\n\t\t\t" … … 1215 1215 vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, 1216 1216 kPrebufferFramesNormal, kPrebufferFramesSmall, 1217 1217 kKeepPrebuffer); 1218 VideoOutput::Init(width, height, aspect, winid, 1219 winx, winy, winw, winh, embedid);1218 VideoOutput::Init(width, height, aspect, winid, winx, 1219 winy, winw, winh, video_prate, embedid); 1220 1220 1221 1221 data->srcWidth = video_dim.width(); 1222 1222 data->srcHeight = video_dim.height(); … … 1381 1381 1382 1382 void VideoOutputQuartz::SetVideoFrameRate(float playback_fps) 1383 1383 { 1384 video_prate = playback_fps; 1384 1385 VERBOSE(VB_PLAYBACK, "SetVideoFrameRate("<<playback_fps<<")"); 1385 1386 } 1386 1387 -
libs/libmythtv/videoout_quartz.h
diff -urNad mythtv-release~/libs/libmythtv/videoout_quartz.h mythtv-release/libs/libmythtv/videoout_quartz.h
old new 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_xv.cpp
diff -urNad mythtv-release~/libs/libmythtv/videoout_xv.cpp mythtv-release/libs/libmythtv/videoout_xv.cpp
old new 451 451 if ((width == 1920 || width == 1440) && height == 1088) 452 452 height = 1080; // ATSC 1920x1080 453 453 454 if (display_res && display_res->SwitchToVideo(width, height)) 455 { 454 if (display_res && display_res->SwitchToVideo(width, height, 455 (short) roundf(video_prate), video_prate)) 456 { 456 457 // Switching to custom display resolution succeeded 457 458 // Make a note of the new size 458 459 display_dim = QSize(display_res->GetPhysicalWidth(), … … 1699 1700 } 1700 1701 1701 1702 /** 1702 * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int, WId)1703 * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int,float,WId) 1703 1704 * Initializes class for video output. 1704 1705 * 1705 1706 * \return success or failure. 1706 1707 */ 1707 1708 bool VideoOutputXv::Init( 1708 int width, int height, float aspect, 1709 WId winid, int winx, int winy, int winw, int winh, WId embedid)1709 int width, int height, float aspect, WId winid, int winx, 1710 int winy, int winw, int winh, float video_prate, WId embedid) 1710 1711 { 1711 1712 needrepaint = true; 1712 1713 … … 1740 1741 // Basic setup 1741 1742 VideoOutput::Init(width, height, aspect, 1742 1743 winid, winx, winy, winw, winh, 1743 embedid);1744 video_prate, embedid); 1744 1745 1745 1746 // Set resolution/measurements (check XRandR, Xinerama, config settings) 1746 1747 InitDisplayMeasurements(width, height); -
libs/libmythtv/videoout_xv.h
diff -urNad mythtv-release~/libs/libmythtv/videoout_xv.h mythtv-release/libs/libmythtv/videoout_xv.h
old new 62 62 ~VideoOutputXv(); 63 63 64 64 bool Init(int width, int height, float aspect, WId winid, 65 int winx, int winy, int winw, int winh, WId embedid = 0); 65 int winx, int winy, int winw, int winh, 66 float video_prate, WId embedid = 0); 66 67 67 68 bool SetDeinterlacingEnabled(bool); 68 69 bool SetupDeinterlace(bool interlaced, const QString& ovrf=""); -
libs/libmythtv/videooutbase.cpp
diff -urNad mythtv-release~/libs/libmythtv/videooutbase.cpp mythtv-release/libs/libmythtv/videooutbase.cpp
old new 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/videooutbase.h
diff -urNad mythtv-release~/libs/libmythtv/videooutbase.h mythtv-release/libs/libmythtv/videooutbase.h
old new 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. -
programs/mythfrontend/globalsettings.cpp
diff -urNad mythtv-release~/programs/mythfrontend/globalsettings.cpp mythtv-release/programs/mythfrontend/globalsettings.cpp
old new 2414 2414 return gc; 2415 2415 } 2416 2416 2417 static HostLineEdit *CustomScreenConfig() 2418 { 2419 HostLineEdit *gedit = new HostLineEdit("CustomScreenRate"); 2420 gedit->setLabel(QObject::tr("Custom screen rate definition file")); 2421 gedit->setHelpText(QObject::tr("Custom screen resolution configuration " 2422 "for matching xrandr value.")); 2423 return gedit; 2424 } 2425 2417 2426 static HostSpinBox *VidModeWidth(int idx) 2418 2427 { 2419 2428 HostSpinBox *gs = new HostSpinBox(QString("VidModeWidth%1").arg(idx), … … 2582 2591 rate, SLOT(ChangeResolution(const QString&))); 2583 2592 } 2584 2593 2594 ConfigurationGroup* customscreensettings = 2595 new HorizontalConfigurationGroup(false, false); 2596 2597 customscreensettings->addChild(CustomScreenConfig()); 2598 2585 2599 ConfigurationGroup* settings = new VerticalConfigurationGroup(false); 2600 2586 2601 settings->addChild(defaultsettings); 2587 2602 settings->addChild(overrides); 2603 settings->addChild(customscreensettings); 2588 2604 2589 2605 addTarget("1", settings); 2590 2606 addTarget("0", new VerticalConfigurationGroup(true));