| 1 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayRes.cpp mythtv/libs/libmyth/DisplayRes.cpp |
| 2 | --- mythtv.opengl/libs/libmyth/DisplayRes.cpp 2009-05-02 07:32:08.000000000 +1000 |
| 3 | +++ mythtv/libs/libmyth/DisplayRes.cpp 2009-05-16 21:10:25.000000000 +1000 |
| 4 | @@ -37,16 +37,16 @@ |
| 5 | // Initialize GUI mode |
| 6 | mode[GUI].Init(); |
| 7 | tW = tH = 0; |
| 8 | - gContext->GetResolutionSetting("GuiVidMode", tW, tH); |
| 9 | + gContext->GetResolutionSetting("GuiVidMode", tW, tH, tAspect, tRate); |
| 10 | GetDisplaySize(tW_mm, tH_mm); |
| 11 | gContext->GetResolutionSetting("DisplaySize", tW_mm, tH_mm); |
| 12 | - mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, 0); |
| 13 | + mode[GUI] = DisplayResScreen(tW, tH, tW_mm, tH_mm, -1.0, (float)tRate); |
| 14 | |
| 15 | |
| 16 | // Initialize default VIDEO mode |
| 17 | tW = tH = 0; |
| 18 | gContext->GetResolutionSetting("TVVidMode", tW, tH, tAspect, tRate); |
| 19 | - mode[VIDEO] = DisplayResScreen(tW, tH, tW_mm, tH_mm, tAspect, tRate); |
| 20 | + mode[VIDEO] = DisplayResScreen(tW, tH, tW_mm, tH_mm, tAspect, (float)tRate); |
| 21 | |
| 22 | |
| 23 | // Initialize video override mode |
| 24 | @@ -64,7 +64,7 @@ |
| 25 | break; |
| 26 | |
| 27 | uint key = DisplayResScreen::CalcKey(iw, ih, irate); |
| 28 | - DisplayResScreen scr(ow, oh, tW_mm, tH_mm, oaspect, orate); |
| 29 | + DisplayResScreen scr(ow, oh, tW_mm, tH_mm, oaspect, (float)orate); |
| 30 | in_size_to_output_mode[key] = scr; |
| 31 | } |
| 32 | |
| 33 | @@ -82,11 +82,18 @@ |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | -bool DisplayRes::SwitchToVideo(int iwidth, int iheight, short irate) |
| 38 | +bool DisplayRes::SwitchToVideo(int iwidth, int iheight, short irate, float frate) |
| 39 | { |
| 40 | tmode next_mode = VIDEO; // default VIDEO mode |
| 41 | DisplayResScreen next = mode[next_mode]; |
| 42 | |
| 43 | + // If requested refresh rate is 0, attempt to match video fps |
| 44 | + if (next.RefreshRate() == 0) |
| 45 | + { |
| 46 | + VERBOSE(VB_PLAYBACK, QString("*** Trying to match best resolution %1Hz") .arg(frate)); |
| 47 | + next.AddRefreshRate(frate); |
| 48 | + } |
| 49 | + |
| 50 | // try to find video override mode |
| 51 | uint key = DisplayResScreen::CalcKey(iwidth, iheight, irate); |
| 52 | DisplayResMapCIt it = in_size_to_output_mode.find(key); |
| 53 | @@ -94,9 +101,9 @@ |
| 54 | mode[next_mode = CUSTOM_VIDEO] = next = it->second; |
| 55 | |
| 56 | // need to change video mode? |
| 57 | - short target_rate = 0; |
| 58 | + float target_rate = 0.0; |
| 59 | DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); |
| 60 | - bool chg = !(next == last) || !(last.RefreshRate() == target_rate); |
| 61 | + bool chg = !(next == last) || !(DisplayResScreen::compare_rates(last.RefreshRate(),target_rate)); |
| 62 | |
| 63 | VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") |
| 64 | .arg(next.Width()).arg(next.Height()).arg(target_rate)); |
| 65 | @@ -128,9 +135,11 @@ |
| 66 | DisplayResScreen next = mode[next_mode]; |
| 67 | |
| 68 | // need to change video mode? |
| 69 | - short target_rate = 0; |
| 70 | + float target_rate = 0.0; |
| 71 | DisplayResScreen::FindBestMatch(GetVideoModes(), next, target_rate); |
| 72 | - bool chg = !(next == last) || !(last.RefreshRate() == target_rate); |
| 73 | + // If GuiVidModeRefreshRate is 0, assume any refresh rate is good enough. |
| 74 | + bool chg = (!(next == last) || (next.RefreshRate() !=0 |
| 75 | + && !(DisplayResScreen::compare_rates(last.RefreshRate(), target_rate)))); |
| 76 | |
| 77 | VERBOSE(VB_PLAYBACK, QString("Trying %1x%2 %3 Hz") |
| 78 | .arg(next.Width()).arg(next.Height()).arg(target_rate)); |
| 79 | @@ -154,15 +163,23 @@ |
| 80 | bool DisplayRes::SwitchToCustomGUI(int width, int height, short rate) |
| 81 | { |
| 82 | mode[CUSTOM_GUI] = DisplayResScreen(width, height, mode[GUI].Width_mm(), |
| 83 | - mode[GUI].Height_mm(), -1.0, rate); |
| 84 | + mode[GUI].Height_mm(), -1.0, (float)rate); |
| 85 | return SwitchToGUI(CUSTOM_GUI); |
| 86 | } |
| 87 | |
| 88 | const vector<short> DisplayRes::GetRefreshRates(int width, int height) const { |
| 89 | - short tr; |
| 90 | - vector<short> empty; |
| 91 | + vector<short> srates; |
| 92 | + vector<float> rates = GetRefreshRatesFloat(width, height); |
| 93 | + |
| 94 | + for (int i=0; i<rates.size(); i++) |
| 95 | + srates.push_back((short) rates[i]); |
| 96 | + return srates; |
| 97 | +} |
| 98 | +const vector<float> DisplayRes::GetRefreshRatesFloat(int width, int height) const { |
| 99 | + float tr; |
| 100 | + vector<float> empty; |
| 101 | |
| 102 | - const DisplayResScreen drs(width, height, 0, 0, -1.0, 0); |
| 103 | + const DisplayResScreen drs(width, height, 0, 0, -1.0, 0.0); |
| 104 | const DisplayResVector& drv = GetVideoModes(); |
| 105 | int t = DisplayResScreen::FindBestMatch(drv, drs, tr); |
| 106 | if (t < 0) |
| 107 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayRes.h mythtv/libs/libmyth/DisplayRes.h |
| 108 | --- mythtv.opengl/libs/libmyth/DisplayRes.h 2009-05-02 07:32:09.000000000 +1000 |
| 109 | +++ mythtv/libs/libmyth/DisplayRes.h 2009-05-15 16:57:30.000000000 +1000 |
| 110 | @@ -46,7 +46,7 @@ |
| 111 | * \brief Switches to the resolution and refresh rate defined in the |
| 112 | * database for the specified video resolution and frame rate. |
| 113 | */ |
| 114 | - bool SwitchToVideo(int iwidth, int iheight, short irate = 0); |
| 115 | + bool SwitchToVideo(int iwidth, int iheight, short irate = 0, float frate = 0.0); |
| 116 | /** \brief Switches to the GUI resolution specified. |
| 117 | * |
| 118 | * If which_gui is GUI then this switches to the resolution |
| 119 | @@ -110,7 +110,8 @@ |
| 120 | /// \brief Returns all video modes supported by the display. |
| 121 | virtual const vector<DisplayResScreen>& GetVideoModes() const = 0; |
| 122 | /// \brief Returns refresh rates available at a specific screen resolution. |
| 123 | - const vector<short> GetRefreshRates(int width, int height) const; |
| 124 | + const vector<float> GetRefreshRatesFloat(int width, int height) const; |
| 125 | + const vector<short> GetRefreshRates(int width, int height) const; |
| 126 | /** @} */ |
| 127 | |
| 128 | protected: |
| 129 | @@ -120,7 +121,7 @@ |
| 130 | |
| 131 | // These methods are implemented by the subclasses |
| 132 | virtual bool GetDisplaySize(int &width_mm, int &height_mm) const = 0; |
| 133 | - virtual bool SwitchToVideoMode(int width, int height, short framerate) = 0; |
| 134 | + virtual bool SwitchToVideoMode(int width, int height, float framerate) = 0; |
| 135 | |
| 136 | private: |
| 137 | DisplayRes(const DisplayRes & rhs); // disable copy constructor; |
| 138 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayResOSX.cpp mythtv/libs/libmyth/DisplayResOSX.cpp |
| 139 | --- mythtv.opengl/libs/libmyth/DisplayResOSX.cpp 2009-05-02 07:32:08.000000000 +1000 |
| 140 | +++ mythtv/libs/libmyth/DisplayResOSX.cpp 2009-05-15 16:57:30.000000000 +1000 |
| 141 | @@ -66,7 +66,7 @@ |
| 142 | return d; |
| 143 | } |
| 144 | |
| 145 | -bool DisplayResOSX::SwitchToVideoMode(int width, int height, short refreshrate) |
| 146 | +bool DisplayResOSX::SwitchToVideoMode(int width, int height, float refreshrate) |
| 147 | { |
| 148 | CGDirectDisplayID d = mythtv_display(); |
| 149 | CFDictionaryRef dispMode = NULL; |
| 150 | @@ -75,7 +75,7 @@ |
| 151 | // find mode that matches the desired size |
| 152 | if (refreshrate) |
| 153 | dispMode = CGDisplayBestModeForParametersAndRefreshRate( |
| 154 | - d, 32, width, height, (CGRefreshRate)(refreshrate), &match); |
| 155 | + d, 32, width, height, (CGRefreshRate)((short)refreshrate), &match); |
| 156 | |
| 157 | if (!match) |
| 158 | dispMode = |
| 159 | @@ -122,7 +122,7 @@ |
| 160 | |
| 161 | if (screen_map.find(key)==screen_map.end()) |
| 162 | screen_map[key] = DisplayResScreen(width, height, |
| 163 | - 0, 0, -1.0, refresh); |
| 164 | + 0, 0, -1.0, (float) refresh); |
| 165 | else |
| 166 | screen_map[key].AddRefreshRate(refresh); |
| 167 | } |
| 168 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayResOSX.h mythtv/libs/libmyth/DisplayResOSX.h |
| 169 | --- mythtv.opengl/libs/libmyth/DisplayResOSX.h 2009-05-02 07:32:08.000000000 +1000 |
| 170 | +++ mythtv/libs/libmyth/DisplayResOSX.h 2009-05-15 16:57:30.000000000 +1000 |
| 171 | @@ -12,7 +12,7 @@ |
| 172 | |
| 173 | protected: |
| 174 | bool GetDisplaySize(int &width_mm, int &height_mm) const; |
| 175 | - bool SwitchToVideoMode(int width, int height, short framerate); |
| 176 | + bool SwitchToVideoMode(int width, int height, float framerate); |
| 177 | |
| 178 | private: |
| 179 | mutable vector<DisplayResScreen> m_video_modes; |
| 180 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayResScreen.cpp mythtv/libs/libmyth/DisplayResScreen.cpp |
| 181 | --- mythtv.opengl/libs/libmyth/DisplayResScreen.cpp 2009-05-02 07:32:08.000000000 +1000 |
| 182 | +++ mythtv/libs/libmyth/DisplayResScreen.cpp 2009-05-15 16:57:30.000000000 +1000 |
| 183 | @@ -1,9 +1,11 @@ |
| 184 | #include "DisplayResScreen.h" |
| 185 | #include "mythcontext.h" |
| 186 | |
| 187 | +#include <cmath> |
| 188 | + |
| 189 | DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, |
| 190 | - double aspectRatio, short refreshRate) |
| 191 | - : width(w), height(h), width_mm(mw), height_mm(mh) |
| 192 | + double aspectRatio, float refreshRate) |
| 193 | + : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) |
| 194 | { |
| 195 | SetAspectRatio(aspectRatio); |
| 196 | if (refreshRate > 0) |
| 197 | @@ -11,15 +13,15 @@ |
| 198 | } |
| 199 | |
| 200 | DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, |
| 201 | - const vector<short>& rr) |
| 202 | - : width(w), height(h), width_mm(mw), height_mm(mh), refreshRates(rr) |
| 203 | + const vector<float>& rr) |
| 204 | + : width(w), height(h), width_mm(mw), height_mm(mh), refreshRates(rr), custom(false) |
| 205 | { |
| 206 | SetAspectRatio(-1.0); |
| 207 | } |
| 208 | |
| 209 | DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, |
| 210 | - const short* rr, uint rr_length) |
| 211 | - : width(w), height(h), width_mm(mw), height_mm(mh) |
| 212 | + const float* rr, uint rr_length) |
| 213 | + : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) |
| 214 | { |
| 215 | SetAspectRatio(-1.0); |
| 216 | for (uint i = 0; i < rr_length; ++i) |
| 217 | @@ -28,8 +30,19 @@ |
| 218 | sort(refreshRates.begin(), refreshRates.end()); |
| 219 | } |
| 220 | |
| 221 | +DisplayResScreen::DisplayResScreen(int w, int h, int mw, int mh, |
| 222 | + const short* rr, uint rr_length) |
| 223 | + : width(w), height(h), width_mm(mw), height_mm(mh), custom(false) |
| 224 | +{ |
| 225 | + SetAspectRatio(-1.0); |
| 226 | + for (uint i = 0; i < rr_length; ++i) |
| 227 | + refreshRates.push_back((float)rr[i]); |
| 228 | + |
| 229 | + sort(refreshRates.begin(), refreshRates.end()); |
| 230 | +} |
| 231 | + |
| 232 | DisplayResScreen::DisplayResScreen(const QString &str) |
| 233 | - : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0) |
| 234 | + : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0), custom(false) |
| 235 | { |
| 236 | refreshRates.clear(); |
| 237 | QStringList slist = QStringList::split(":", str); |
| 238 | @@ -43,7 +56,7 @@ |
| 239 | height_mm = slist[3].toInt(); |
| 240 | aspect = slist[4].toDouble(); |
| 241 | for (uint i = 5; i<slist.size(); ++i) |
| 242 | - refreshRates.push_back(slist[i].toShort()); |
| 243 | + refreshRates.push_back(slist[i].toFloat()); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | @@ -80,22 +93,66 @@ |
| 248 | return dsr; |
| 249 | } |
| 250 | |
| 251 | +//compares if the float f1 is equal with f2 and returns 1 if true and 0 if false |
| 252 | +bool DisplayResScreen::compare_rates(float f1, float f2) |
| 253 | +{ |
| 254 | + float precision = 0.01; |
| 255 | + if (((f1 - precision) < f2) && |
| 256 | + ((f1 + precision) > f2)) |
| 257 | + { |
| 258 | + return true; |
| 259 | + } |
| 260 | + else |
| 261 | + { |
| 262 | + return false; |
| 263 | + } |
| 264 | +} |
| 265 | + |
| 266 | int DisplayResScreen::FindBestMatch(const vector<DisplayResScreen>& dsr, |
| 267 | const DisplayResScreen& d, |
| 268 | short& target_rate) |
| 269 | { |
| 270 | + float target; |
| 271 | + int i = FindBestMatch(dsr, d, target); |
| 272 | + target_rate = target; |
| 273 | + return i; |
| 274 | +} |
| 275 | + |
| 276 | +int DisplayResScreen::FindBestMatch(const vector<DisplayResScreen>& dsr, |
| 277 | + const DisplayResScreen& d, |
| 278 | + float& target_rate) |
| 279 | +{ |
| 280 | + // Amend vector with custom list |
| 281 | for (uint i=0; i<dsr.size(); ++i) |
| 282 | { |
| 283 | if (dsr[i].Width()==d.Width() && dsr[i].Height()==d.Height()) |
| 284 | { |
| 285 | - const vector<short>& rates = dsr[i].RefreshRates(); |
| 286 | - if (rates.size()) |
| 287 | + const vector<float>& rates = dsr[i].RefreshRates(); |
| 288 | + if (rates.size() && d.RefreshRate() != 0) |
| 289 | { |
| 290 | - vector<short>::const_iterator it = |
| 291 | - find(rates.begin(), rates.end(), d.RefreshRate()); |
| 292 | - target_rate = (it == rates.end()) ? *(--rates.end()) : *it; |
| 293 | - return i; |
| 294 | - } |
| 295 | + for (uint j=0; j < rates.size(); ++j) |
| 296 | + { |
| 297 | + // Multiple of target_rate will do |
| 298 | + if (compare_rates(d.RefreshRate(),rates[j]) || (fmod(rates[j],d.RefreshRate()) <= 0.01)) |
| 299 | + { |
| 300 | + target_rate = rates[j]; |
| 301 | + return i; |
| 302 | + } |
| 303 | + } |
| 304 | + // Can't find exact frame rate, so try rounding to the nearest integer, so 23.97Hz will work with 24Hz etc |
| 305 | + for (uint j=0; j < rates.size(); ++j) |
| 306 | + { |
| 307 | + float rounded = (float) ((int) (rates[j] + 0.5)); |
| 308 | + // Multiple of target_rate will do |
| 309 | + if (compare_rates(d.RefreshRate(),rounded) || (fmod(rounded,d.RefreshRate()) <= 0.01)) |
| 310 | + { |
| 311 | + target_rate = rounded; |
| 312 | + return i; |
| 313 | + } |
| 314 | + } |
| 315 | + target_rate = rates[rates.size() - 1]; |
| 316 | + } |
| 317 | + return i; |
| 318 | } |
| 319 | } |
| 320 | return -1; |
| 321 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayResScreen.h mythtv/libs/libmyth/DisplayResScreen.h |
| 322 | --- mythtv.opengl/libs/libmyth/DisplayResScreen.h 2009-05-02 07:32:08.000000000 +1000 |
| 323 | +++ mythtv/libs/libmyth/DisplayResScreen.h 2009-05-16 18:29:21.000000000 +1000 |
| 324 | @@ -14,11 +14,13 @@ |
| 325 | public: |
| 326 | // Constructors, initializers |
| 327 | DisplayResScreen() |
| 328 | - : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0) {;} |
| 329 | + : width(0), height(0), width_mm(0), height_mm(0), aspect(-1.0), custom(false) {;} |
| 330 | DisplayResScreen(int w, int h, int mw, int mh, |
| 331 | - double aspectRatio/* = -1.0*/, short refreshRate/* = 0*/); |
| 332 | + double aspectRatio/* = -1.0*/, float refreshRate/* = 0*/); |
| 333 | DisplayResScreen(int w, int h, int mw, int mh, |
| 334 | - const vector<short>& refreshRates); |
| 335 | + const vector<float>& refreshRates); |
| 336 | + DisplayResScreen(int w, int h, int mw, int mh, |
| 337 | + const float* refreshRates, uint rr_length); |
| 338 | DisplayResScreen(int w, int h, int mw, int mh, |
| 339 | const short* refreshRates, uint rr_length); |
| 340 | DisplayResScreen(const QString &str); |
| 341 | @@ -29,17 +31,28 @@ |
| 342 | int Height() const { return height; } |
| 343 | int Width_mm() const { return width_mm; } |
| 344 | int Height_mm() const { return height_mm; } |
| 345 | + bool Custom() const { return custom; } |
| 346 | + |
| 347 | inline double AspectRatio() const; |
| 348 | - inline short RefreshRate() const; |
| 349 | - const vector<short>& RefreshRates() const { return refreshRates; } |
| 350 | + inline float RefreshRate() const; |
| 351 | + const vector<float>& RefreshRates() const { return refreshRates; } |
| 352 | |
| 353 | // Sets, adds |
| 354 | void SetAspectRatio(double a); |
| 355 | - void AddRefreshRate(short rr) { |
| 356 | + void AddRefreshRate(float rr) { |
| 357 | refreshRates.push_back(rr); |
| 358 | sort(refreshRates.begin(), refreshRates.end()); |
| 359 | } |
| 360 | - |
| 361 | + void ClearRefreshRates(void) { |
| 362 | + refreshRates.clear(); |
| 363 | + } |
| 364 | + void SetCustom(bool b) { |
| 365 | + custom = b; |
| 366 | + } |
| 367 | + |
| 368 | + // Map for matching real rates and xrandr rate; |
| 369 | + map<float, short> realRates; |
| 370 | + |
| 371 | // Converters & comparitors |
| 372 | QString toString() const; |
| 373 | inline bool operator < (const DisplayResScreen& b) const; |
| 374 | @@ -50,16 +63,22 @@ |
| 375 | static vector<DisplayResScreen> Convert(const QStringList& slist); |
| 376 | static int FindBestMatch(const vector<DisplayResScreen>& dsr, |
| 377 | const DisplayResScreen& d, |
| 378 | + float& target_rate); |
| 379 | + static int FindBestMatch(const vector<DisplayResScreen>& dsr, |
| 380 | + const DisplayResScreen& d, |
| 381 | short& target_rate); |
| 382 | static inline int CalcKey(int w, int h, int rate); |
| 383 | + static bool compare_rates(float f1, float f2); |
| 384 | |
| 385 | private: |
| 386 | int width, height; // size in pixels |
| 387 | int width_mm, height_mm; // physical size in millimeters |
| 388 | double aspect; // aspect ratio, calculated or set |
| 389 | - vector<short> refreshRates; |
| 390 | + vector<float> refreshRates; |
| 391 | + bool custom; // Set if resolution was defined manually |
| 392 | }; |
| 393 | |
| 394 | + |
| 395 | typedef vector<DisplayResScreen> DisplayResVector; |
| 396 | typedef DisplayResVector::iterator DisplayResVectorIt; |
| 397 | typedef DisplayResVector::const_iterator DisplayResVectorCIt; |
| 398 | @@ -85,11 +104,11 @@ |
| 399 | return aspect; |
| 400 | } |
| 401 | |
| 402 | -inline short DisplayResScreen::RefreshRate() const |
| 403 | +inline float DisplayResScreen::RefreshRate() const |
| 404 | { |
| 405 | if (refreshRates.size() >= 1) |
| 406 | return refreshRates[0]; |
| 407 | - else return 0; |
| 408 | + else return 0.0; |
| 409 | } |
| 410 | |
| 411 | inline bool DisplayResScreen::operator < (const DisplayResScreen& b) const |
| 412 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayResX.cpp mythtv/libs/libmyth/DisplayResX.cpp |
| 413 | --- mythtv.opengl/libs/libmyth/DisplayResX.cpp 2009-05-02 07:32:08.000000000 +1000 |
| 414 | +++ mythtv/libs/libmyth/DisplayResX.cpp 2009-05-16 18:44:28.000000000 +1000 |
| 415 | @@ -4,6 +4,11 @@ |
| 416 | #include <cstring> |
| 417 | #include <cstdlib> |
| 418 | |
| 419 | +#include "mythcontext.h" |
| 420 | +#include <qregexp.h> |
| 421 | +#include <qfile.h> |
| 422 | +#include <qfileinfo.h> |
| 423 | + |
| 424 | #include "util-x11.h" |
| 425 | |
| 426 | #include <X11/extensions/Xrandr.h> // this has to be after util-x11.h (Qt bug) |
| 427 | @@ -32,9 +37,11 @@ |
| 428 | return false; |
| 429 | } |
| 430 | |
| 431 | -bool DisplayResX::SwitchToVideoMode(int width, int height, short desired_rate) |
| 432 | +bool DisplayResX::SwitchToVideoMode(int width, int height, float desired_rate) |
| 433 | { |
| 434 | - short rate; |
| 435 | + float rate; |
| 436 | + short finalrate; |
| 437 | + |
| 438 | DisplayResScreen desired_screen(width, height, 0, 0, -1.0, desired_rate); |
| 439 | int idx = DisplayResScreen::FindBestMatch(m_video_modes_unsorted, |
| 440 | desired_screen, rate); |
| 441 | @@ -49,9 +56,23 @@ |
| 442 | Rotation rot; |
| 443 | XRRConfigCurrentConfiguration(cfg, &rot); |
| 444 | |
| 445 | + // Search real xrandr rate for desired_rate |
| 446 | + finalrate = (short) rate; |
| 447 | + for (int i=0; i < m_video_modes.size(); i++) { |
| 448 | + if ((m_video_modes[i].Width() == width) && (m_video_modes[i].Height() == height)) |
| 449 | + { |
| 450 | + if (m_video_modes[i].Custom()) |
| 451 | + { |
| 452 | + finalrate = m_video_modes[i].realRates[rate]; |
| 453 | + VERBOSE(VB_PLAYBACK, QString("CustomRate Found, set %1Hz as %2") .arg(rate) .arg(finalrate)); |
| 454 | + } |
| 455 | + break; |
| 456 | + } |
| 457 | + } |
| 458 | + |
| 459 | Window root = DefaultRootWindow(display); |
| 460 | Status status = XRRSetScreenConfigAndRate(display, cfg, root, idx, |
| 461 | - rot, rate, CurrentTime); |
| 462 | + rot, finalrate, CurrentTime); |
| 463 | |
| 464 | XRRFreeScreenConfigInfo(cfg); |
| 465 | XCloseDisplay(display); |
| 466 | @@ -87,6 +108,60 @@ |
| 467 | rates, num_rates); |
| 468 | m_video_modes.push_back(scr); |
| 469 | } |
| 470 | + |
| 471 | + QString customscreen = gContext->GetSetting("CustomScreenRate"); |
| 472 | + if (gContext->GetNumSetting("UseVideoModes", 0) && !customscreen.size()); |
| 473 | + { |
| 474 | + QFileInfo fi(customscreen); |
| 475 | + QFile file(customscreen); |
| 476 | + |
| 477 | + if (!fi.exists() || !fi.isFile()) |
| 478 | + { |
| 479 | + VERBOSE(VB_PLAYBACK, QString("CustomScreenRate: \"%1\" failed: does not exist or isn't a file") |
| 480 | + .arg(customscreen)); |
| 481 | + } |
| 482 | + else if ( file.open( IO_ReadOnly ) ) { |
| 483 | + QRegExp regexp = QRegExp("^\\s*(\\d+),(\\d+),(\\d+\\.?\\d*),(\\d+)\\s*$"); |
| 484 | + QTextStream stream( &file ); |
| 485 | + QString line; |
| 486 | + int pos; |
| 487 | + while ( !stream.atEnd() ) { |
| 488 | + pos = regexp.search(stream.readLine()); |
| 489 | + if (pos > -1) { |
| 490 | + int w = regexp.cap(1).toInt(); |
| 491 | + int h = regexp.cap(2).toInt(); |
| 492 | + float hz = regexp.cap(3).toFloat(); |
| 493 | + int xrandrhz = regexp.cap(4).toShort(); |
| 494 | + int found = -1; |
| 495 | + VERBOSE(VB_PLAYBACK, QString("Found definition for %1x%2 @ %3Hz (xrandr: %4)") |
| 496 | + .arg(w) .arg(h) .arg(hz) .arg(xrandrhz)); |
| 497 | + // find if video mode already exist, and remove refresh rates for custom one |
| 498 | + for (int i=0; i < m_video_modes.size(); i++) { |
| 499 | + if ((m_video_modes[i].Width() == w) && (m_video_modes[i].Height() == h)) |
| 500 | + { |
| 501 | + found = i; |
| 502 | + if (!m_video_modes[i].Custom()) |
| 503 | + { |
| 504 | + m_video_modes[i].ClearRefreshRates(); |
| 505 | + m_video_modes[i].SetCustom(true); |
| 506 | + } |
| 507 | + m_video_modes[i].AddRefreshRate(hz); |
| 508 | + m_video_modes[i].realRates[hz] = xrandrhz; |
| 509 | + break; |
| 510 | + } |
| 511 | + } |
| 512 | + if (found < 0) |
| 513 | + { |
| 514 | + DisplayResScreen scr(w, h, 0, 0, -1.0, hz); |
| 515 | + scr.SetCustom(true); |
| 516 | + m_video_modes.push_back(scr); |
| 517 | + } |
| 518 | + } |
| 519 | + } |
| 520 | + file.close(); |
| 521 | + } |
| 522 | + } |
| 523 | + |
| 524 | m_video_modes_unsorted = m_video_modes; |
| 525 | sort(m_video_modes.begin(), m_video_modes.end()); |
| 526 | |
| 527 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmyth/DisplayResX.h mythtv/libs/libmyth/DisplayResX.h |
| 528 | --- mythtv.opengl/libs/libmyth/DisplayResX.h 2009-05-02 07:32:08.000000000 +1000 |
| 529 | +++ mythtv/libs/libmyth/DisplayResX.h 2009-05-15 16:57:30.000000000 +1000 |
| 530 | @@ -12,7 +12,7 @@ |
| 531 | |
| 532 | protected: |
| 533 | bool GetDisplaySize(int &width_mm, int &height_mm) const; |
| 534 | - bool SwitchToVideoMode(int width, int height, short framerate); |
| 535 | + bool SwitchToVideoMode(int width, int height, float framerate); |
| 536 | |
| 537 | private: |
| 538 | mutable vector<DisplayResScreen> m_video_modes; |
| 539 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/NuppelVideoPlayer.cpp mythtv/libs/libmythtv/NuppelVideoPlayer.cpp |
| 540 | --- mythtv.opengl/libs/libmythtv/NuppelVideoPlayer.cpp 2009-05-15 16:58:34.000000000 +1000 |
| 541 | +++ mythtv/libs/libmythtv/NuppelVideoPlayer.cpp 2009-05-16 19:13:30.000000000 +1000 |
| 542 | @@ -635,7 +635,8 @@ |
| 543 | GetDecoder()->GetVideoCodecID(), |
| 544 | GetDecoder()->GetVideoCodecPrivate(), |
| 545 | video_disp_dim, video_aspect, |
| 546 | - widget->winId(), display_rect, 0 /*embedid*/); |
| 547 | + widget->winId(), display_rect, (video_frame_rate * play_speed), |
| 548 | + 0 /*embedid*/); |
| 549 | |
| 550 | if (!videoOutput) |
| 551 | { |
| 552 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_d3d.cpp mythtv/libs/libmythtv/videoout_d3d.cpp |
| 553 | --- mythtv.opengl/libs/libmythtv/videoout_d3d.cpp 2009-05-02 07:30:34.000000000 +1000 |
| 554 | +++ mythtv/libs/libmythtv/videoout_d3d.cpp 2009-05-16 19:16:43.000000000 +1000 |
| 555 | @@ -451,7 +451,7 @@ |
| 556 | |
| 557 | bool VideoOutputD3D::Init(int width, int height, float aspect, |
| 558 | WId winid, int winx, int winy, int winw, |
| 559 | - int winh, WId embedid) |
| 560 | + int winh, float video_prate, WId embedid) |
| 561 | { |
| 562 | VERBOSE(VB_PLAYBACK, LOC + |
| 563 | "Init w=" << width << " h=" << height); |
| 564 | @@ -462,8 +462,8 @@ |
| 565 | kPrebufferFramesNormal, kPrebufferFramesSmall, |
| 566 | kKeepPrebuffer); |
| 567 | |
| 568 | - VideoOutput::Init(width, height, aspect, winid, |
| 569 | - winx, winy, winw, winh, embedid); |
| 570 | + VideoOutput::Init(width, height, aspect, winid, winx, |
| 571 | + winy, winw, winh, video_prate, embedid); |
| 572 | |
| 573 | m_hWnd = winid; |
| 574 | |
| 575 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_d3d.h mythtv/libs/libmythtv/videoout_d3d.h |
| 576 | --- mythtv.opengl/libs/libmythtv/videoout_d3d.h 2009-05-02 07:30:34.000000000 +1000 |
| 577 | +++ mythtv/libs/libmythtv/videoout_d3d.h 2009-05-16 19:17:02.000000000 +1000 |
| 578 | @@ -20,7 +20,8 @@ |
| 579 | ~VideoOutputD3D(); |
| 580 | |
| 581 | bool Init(int width, int height, float aspect, WId winid, |
| 582 | - int winx, int winy, int winw, int winh, WId embedid = 0); |
| 583 | + int winx, int winy, int winw, int winh, |
| 584 | + float video_prate, WId embedid = 0); |
| 585 | |
| 586 | bool InitD3D(); |
| 587 | void UnInitD3D(); |
| 588 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_directfb.cpp mythtv/libs/libmythtv/videoout_directfb.cpp |
| 589 | --- mythtv.opengl/libs/libmythtv/videoout_directfb.cpp 2009-05-02 07:30:34.000000000 +1000 |
| 590 | +++ mythtv/libs/libmythtv/videoout_directfb.cpp 2009-05-15 16:57:30.000000000 +1000 |
| 591 | @@ -353,7 +353,7 @@ |
| 592 | |
| 593 | bool VideoOutputDirectfb::Init(int width, int height, float aspect, WId winid, |
| 594 | int winx, int winy, int winw, int winh, |
| 595 | - WId embedid) |
| 596 | + float video_prate, WId embedid) |
| 597 | { |
| 598 | // Hack to avoid embedded video output... |
| 599 | if ((winw < 320) || (winh < 240)) |
| 600 | @@ -646,7 +646,7 @@ |
| 601 | display_visible_rect.y(), |
| 602 | display_visible_rect.width(), |
| 603 | display_visible_rect.height(), |
| 604 | - embedid)) |
| 605 | + video_prate, embedid)) |
| 606 | { |
| 607 | return false; |
| 608 | } |
| 609 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_directfb.h mythtv/libs/libmythtv/videoout_directfb.h |
| 610 | --- mythtv.opengl/libs/libmythtv/videoout_directfb.h 2009-05-02 07:30:35.000000000 +1000 |
| 611 | +++ mythtv/libs/libmythtv/videoout_directfb.h 2009-05-16 20:21:24.000000000 +1000 |
| 612 | @@ -14,7 +14,8 @@ |
| 613 | ~VideoOutputDirectfb(); |
| 614 | |
| 615 | bool Init(int width, int height, float aspect, WId winid, |
| 616 | - int winx, int winy, int winw, int winh, WId embedid = 0); |
| 617 | + int winx, int winy, int winw, int winh, |
| 618 | + float video_prate, WId embedid = 0); |
| 619 | |
| 620 | void ProcessFrame(VideoFrame *frame, OSD *osd, |
| 621 | FilterChain *filterList, |
| 622 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_dx.cpp mythtv/libs/libmythtv/videoout_dx.cpp |
| 623 | --- mythtv.opengl/libs/libmythtv/videoout_dx.cpp 2009-05-02 07:30:36.000000000 +1000 |
| 624 | +++ mythtv/libs/libmythtv/videoout_dx.cpp 2009-05-16 20:56:37.000000000 +1000 |
| 625 | @@ -158,16 +158,16 @@ |
| 626 | } |
| 627 | |
| 628 | bool VideoOutputDX::Init(int width, int height, float aspect, |
| 629 | - WId winid, int winx, int winy, int winw, |
| 630 | - int winh, WId embedid) |
| 631 | + WId winid, int winx, int winy, int winw, |
| 632 | + int winh, float video_prate, WId embedid) |
| 633 | { |
| 634 | db_vdisp_profile->SetVideoRenderer("directx"); |
| 635 | |
| 636 | vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, |
| 637 | kPrebufferFramesNormal, kPrebufferFramesSmall, |
| 638 | kKeepPrebuffer); |
| 639 | - VideoOutput::Init(width, height, aspect, winid, |
| 640 | - winx, winy, winw, winh, embedid); |
| 641 | + VideoOutput::Init(width, height, aspect, winid, winx, |
| 642 | + winy, winw, winh, video_prate, embedid); |
| 643 | |
| 644 | wnd = winid; |
| 645 | |
| 646 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_dx.h mythtv/libs/libmythtv/videoout_dx.h |
| 647 | --- mythtv.opengl/libs/libmythtv/videoout_dx.h 2009-05-02 07:30:34.000000000 +1000 |
| 648 | +++ mythtv/libs/libmythtv/videoout_dx.h 2009-05-16 20:38:14.000000000 +1000 |
| 649 | @@ -21,7 +21,8 @@ |
| 650 | ~VideoOutputDX(); |
| 651 | |
| 652 | bool Init(int width, int height, float aspect, WId winid, |
| 653 | - int winx, int winy, int winw, int winh, WId embedid = 0); |
| 654 | + int winx, int winy, int winw, int winh, |
| 655 | + float video_prate, WId embedid = 0); |
| 656 | void PrepareFrame(VideoFrame *buffer, FrameScanType); |
| 657 | void Show(FrameScanType ); |
| 658 | |
| 659 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_ivtv.cpp mythtv/libs/libmythtv/videoout_ivtv.cpp |
| 660 | --- mythtv.opengl/libs/libmythtv/videoout_ivtv.cpp 2009-05-02 07:30:35.000000000 +1000 |
| 661 | +++ mythtv/libs/libmythtv/videoout_ivtv.cpp 2009-05-15 16:57:30.000000000 +1000 |
| 662 | @@ -405,7 +405,7 @@ |
| 663 | |
| 664 | bool VideoOutputIvtv::Init(int width, int height, float aspect, |
| 665 | WId winid, int winx, int winy, int winw, |
| 666 | - int winh, WId embedid) |
| 667 | + int winh, float video_prate, WId embedid) |
| 668 | { |
| 669 | VERBOSE(VB_PLAYBACK, LOC + "Init() -- begin"); |
| 670 | |
| 671 | @@ -416,7 +416,7 @@ |
| 672 | videoDevice = gContext->GetSetting("PVR350VideoDev"); |
| 673 | |
| 674 | VideoOutput::Init(width, height, aspect, winid, winx, winy, winw, winh, |
| 675 | - embedid); |
| 676 | + video_prate, embedid); |
| 677 | |
| 678 | osdbufsize = video_dim.width() * video_dim.height() * 4; |
| 679 | |
| 680 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_ivtv.h mythtv/libs/libmythtv/videoout_ivtv.h |
| 681 | --- mythtv.opengl/libs/libmythtv/videoout_ivtv.h 2009-05-02 07:30:34.000000000 +1000 |
| 682 | +++ mythtv/libs/libmythtv/videoout_ivtv.h 2009-05-16 20:24:09.000000000 +1000 |
| 683 | @@ -16,7 +16,8 @@ |
| 684 | ~VideoOutputIvtv(); |
| 685 | |
| 686 | bool Init(int width, int height, float aspect, WId winid, |
| 687 | - int winx, int winy, int winw, int winh, WId embedid = 0); |
| 688 | + int winx, int winy, int winw, int winh, |
| 689 | + float video_prate, WId embedid = 0); |
| 690 | void PrepareFrame(VideoFrame *buffer, FrameScanType); |
| 691 | void Show(FrameScanType ); |
| 692 | |
| 693 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_null.cpp mythtv/libs/libmythtv/videoout_null.cpp |
| 694 | --- mythtv.opengl/libs/libmythtv/videoout_null.cpp 2009-05-02 07:30:35.000000000 +1000 |
| 695 | +++ mythtv/libs/libmythtv/videoout_null.cpp 2009-05-16 20:25:07.000000000 +1000 |
| 696 | @@ -115,15 +115,15 @@ |
| 697 | |
| 698 | bool VideoOutputNull::Init(int width, int height, float aspect, |
| 699 | WId winid, int winx, int winy, int winw, |
| 700 | - int winh, WId embedid) |
| 701 | + int winh, float video_prate, WId embedid) |
| 702 | { |
| 703 | if ((width <= 0) || (height <= 0)) |
| 704 | return false; |
| 705 | |
| 706 | QMutexLocker locker(&global_lock); |
| 707 | |
| 708 | - VideoOutput::Init(width, height, aspect, winid, |
| 709 | - winx, winy, winw, winh, embedid); |
| 710 | + VideoOutput::Init(width, height, aspect, winid, winx, |
| 711 | + winy, winw, winh, video_prate, embedid); |
| 712 | |
| 713 | vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, |
| 714 | kPrebufferFramesNormal, kPrebufferFramesSmall, |
| 715 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_null.h mythtv/libs/libmythtv/videoout_null.h |
| 716 | --- mythtv.opengl/libs/libmythtv/videoout_null.h 2009-05-02 07:30:36.000000000 +1000 |
| 717 | +++ mythtv/libs/libmythtv/videoout_null.h 2009-05-16 20:25:34.000000000 +1000 |
| 718 | @@ -12,7 +12,8 @@ |
| 719 | ~VideoOutputNull(); |
| 720 | |
| 721 | bool Init(int width, int height, float aspect, WId winid, |
| 722 | - int winx, int winy, int winw, int winh, WId embedid = 0); |
| 723 | + int winx, int winy, int winw, int winh, |
| 724 | + float video_prate, WId embedid = 0); |
| 725 | |
| 726 | bool SetupDeinterlace(bool, const QString &ovrf = "") |
| 727 | { (void)ovrf; return false; } // we don't deinterlace in null output.. |
| 728 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_quartz.cpp mythtv/libs/libmythtv/videoout_quartz.cpp |
| 729 | --- mythtv.opengl/libs/libmythtv/videoout_quartz.cpp 2009-05-02 07:30:34.000000000 +1000 |
| 730 | +++ mythtv/libs/libmythtv/videoout_quartz.cpp 2009-05-16 20:27:22.000000000 +1000 |
| 731 | @@ -1192,8 +1192,8 @@ |
| 732 | } |
| 733 | |
| 734 | bool VideoOutputQuartz::Init(int width, int height, float aspect, |
| 735 | - WId winid, int winx, int winy, |
| 736 | - int winw, int winh, WId embedid) |
| 737 | + WId winid, int winx, int winy, int winw, |
| 738 | + int winh, float video_prate, WId embedid) |
| 739 | { |
| 740 | VERBOSE(VB_PLAYBACK, LOC + |
| 741 | QString("Init(WxH %1x%2, aspect=%3, winid=%4\n\t\t\t" |
| 742 | @@ -1215,8 +1215,8 @@ |
| 743 | vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, |
| 744 | kPrebufferFramesNormal, kPrebufferFramesSmall, |
| 745 | kKeepPrebuffer); |
| 746 | - VideoOutput::Init(width, height, aspect, winid, |
| 747 | - winx, winy, winw, winh, embedid); |
| 748 | + VideoOutput::Init(width, height, aspect, winid, winx, |
| 749 | + winy, winw, winh, video_prate, embedid); |
| 750 | |
| 751 | data->srcWidth = video_dim.width(); |
| 752 | data->srcHeight = video_dim.height(); |
| 753 | @@ -1381,6 +1381,7 @@ |
| 754 | |
| 755 | void VideoOutputQuartz::SetVideoFrameRate(float playback_fps) |
| 756 | { |
| 757 | + video_prate = playback_fps; |
| 758 | VERBOSE(VB_PLAYBACK, "SetVideoFrameRate("<<playback_fps<<")"); |
| 759 | } |
| 760 | |
| 761 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_quartz.h mythtv/libs/libmythtv/videoout_quartz.h |
| 762 | --- mythtv.opengl/libs/libmythtv/videoout_quartz.h 2009-05-02 07:30:36.000000000 +1000 |
| 763 | +++ mythtv/libs/libmythtv/videoout_quartz.h 2009-05-16 20:27:58.000000000 +1000 |
| 764 | @@ -13,7 +13,8 @@ |
| 765 | ~VideoOutputQuartz(); |
| 766 | |
| 767 | bool Init(int width, int height, float aspect, WId winid, |
| 768 | - int winx, int winy, int winw, int winh, WId embedid = 0); |
| 769 | + int winx, int winy, int winw, int winh, |
| 770 | + float video_prate, WId embedid = 0); |
| 771 | void SetVideoFrameRate(float playback_fps); |
| 772 | void PrepareFrame(VideoFrame *buffer, FrameScanType t); |
| 773 | void Show(FrameScanType); |
| 774 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_xv.cpp mythtv/libs/libmythtv/videoout_xv.cpp |
| 775 | --- mythtv.opengl/libs/libmythtv/videoout_xv.cpp 2009-05-15 16:58:35.000000000 +1000 |
| 776 | +++ mythtv/libs/libmythtv/videoout_xv.cpp 2009-05-16 20:48:13.000000000 +1000 |
| 777 | @@ -450,7 +450,9 @@ |
| 778 | if ((width == 1920 || width == 1440) && height == 1088) |
| 779 | height = 1080; // ATSC 1920x1080 |
| 780 | |
| 781 | - if (display_res && display_res->SwitchToVideo(width, height)) |
| 782 | + if (display_res && display_res->SwitchToVideo(width, height, |
| 783 | + (short) roundf(video_prate), |
| 784 | + video_prate)) |
| 785 | { |
| 786 | // Switching to custom display resolution succeeded |
| 787 | // Make a note of the new size |
| 788 | @@ -1698,14 +1700,14 @@ |
| 789 | } |
| 790 | |
| 791 | /** |
| 792 | - * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int,WId) |
| 793 | + * \fn VideoOutputXv::Init(int,int,float,WId,int,int,int,int,float,WId) |
| 794 | * Initializes class for video output. |
| 795 | * |
| 796 | * \return success or failure. |
| 797 | */ |
| 798 | bool VideoOutputXv::Init( |
| 799 | - int width, int height, float aspect, |
| 800 | - WId winid, int winx, int winy, int winw, int winh, WId embedid) |
| 801 | + int width, int height, float aspect, WId winid, int winx, |
| 802 | + int winy, int winw, int winh, float video_prate, WId embedid) |
| 803 | { |
| 804 | needrepaint = true; |
| 805 | |
| 806 | @@ -1739,7 +1741,7 @@ |
| 807 | // Basic setup |
| 808 | VideoOutput::Init(width, height, aspect, |
| 809 | winid, winx, winy, winw, winh, |
| 810 | - embedid); |
| 811 | + video_prate, embedid); |
| 812 | |
| 813 | // Set resolution/measurements (check XRandR, Xinerama, config settings) |
| 814 | InitDisplayMeasurements(width, height); |
| 815 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videoout_xv.h mythtv/libs/libmythtv/videoout_xv.h |
| 816 | --- mythtv.opengl/libs/libmythtv/videoout_xv.h 2009-05-15 16:58:35.000000000 +1000 |
| 817 | +++ mythtv/libs/libmythtv/videoout_xv.h 2009-05-16 20:29:46.000000000 +1000 |
| 818 | @@ -62,7 +62,8 @@ |
| 819 | ~VideoOutputXv(); |
| 820 | |
| 821 | bool Init(int width, int height, float aspect, WId winid, |
| 822 | - int winx, int winy, int winw, int winh, WId embedid = 0); |
| 823 | + int winx, int winy, int winw, int winh, |
| 824 | + float video_prate, WId embedid = 0); |
| 825 | |
| 826 | bool SetDeinterlacingEnabled(bool); |
| 827 | bool SetupDeinterlace(bool interlaced, const QString& ovrf=""); |
| 828 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videooutbase.cpp mythtv/libs/libmythtv/videooutbase.cpp |
| 829 | --- mythtv.opengl/libs/libmythtv/videooutbase.cpp 2009-05-15 16:58:35.000000000 +1000 |
| 830 | +++ mythtv/libs/libmythtv/videooutbase.cpp 2009-05-16 20:53:44.000000000 +1000 |
| 831 | @@ -71,7 +71,7 @@ |
| 832 | void *codec_priv, |
| 833 | const QSize &video_dim, float video_aspect, |
| 834 | WId win_id, const QRect &display_rect, |
| 835 | - WId embed_id) |
| 836 | + float video_prate, WId embed_id) |
| 837 | { |
| 838 | (void) codec_priv; |
| 839 | |
| 840 | @@ -170,10 +170,12 @@ |
| 841 | |
| 842 | if (vo) |
| 843 | { |
| 844 | + vo->video_prate = video_prate; |
| 845 | if (vo->Init( |
| 846 | video_dim.width(), video_dim.height(), video_aspect, |
| 847 | win_id, display_rect.x(), display_rect.y(), |
| 848 | - display_rect.width(), display_rect.height(), embed_id)) |
| 849 | + display_rect.width(), display_rect.height(), |
| 850 | + video_prate, embed_id)) |
| 851 | { |
| 852 | return vo; |
| 853 | } |
| 854 | @@ -367,7 +369,8 @@ |
| 855 | * \return true if successful, false otherwise. |
| 856 | */ |
| 857 | bool VideoOutput::Init(int width, int height, float aspect, WId winid, |
| 858 | - int winx, int winy, int winw, int winh, WId embedid) |
| 859 | + int winx, int winy, int winw, int winh, |
| 860 | + float video_prate, WId embedid) |
| 861 | { |
| 862 | (void)winid; |
| 863 | (void)embedid; |
| 864 | @@ -409,6 +412,7 @@ |
| 865 | |
| 866 | void VideoOutput::SetVideoFrameRate(float playback_fps) |
| 867 | { |
| 868 | + video_prate = playback_fps; |
| 869 | db_vdisp_profile->SetOutput(playback_fps); |
| 870 | } |
| 871 | |
| 872 | diff -Naur --exclude=.svn mythtv.opengl/libs/libmythtv/videooutbase.h mythtv/libs/libmythtv/videooutbase.h |
| 873 | --- mythtv.opengl/libs/libmythtv/videooutbase.h 2009-05-15 16:58:35.000000000 +1000 |
| 874 | +++ mythtv/libs/libmythtv/videooutbase.h 2009-05-16 20:49:57.000000000 +1000 |
| 875 | @@ -36,14 +36,14 @@ |
| 876 | void *codec_priv, |
| 877 | const QSize &video_dim, float video_aspect, |
| 878 | WId win_id, const QRect &display_rect, |
| 879 | - WId embed_id); |
| 880 | + float video_prate, WId embed_id); |
| 881 | |
| 882 | VideoOutput(); |
| 883 | virtual ~VideoOutput(); |
| 884 | |
| 885 | virtual bool Init(int width, int height, float aspect, |
| 886 | WId winid, int winx, int winy, int winw, |
| 887 | - int winh, WId embedid = 0); |
| 888 | + int winh, float video_prate, WId embedid = 0); |
| 889 | virtual void InitOSD(OSD *osd); |
| 890 | virtual void SetVideoFrameRate(float); |
| 891 | |
| 892 | @@ -279,6 +279,7 @@ |
| 893 | QSize video_dim; ///< Pixel dimensions of video buffer |
| 894 | QSize video_disp_dim; ///< Pixel dimensions of video display area |
| 895 | float video_aspect; ///< Physical aspect ratio of video |
| 896 | + float video_prate; ///< Playback frame rate of video |
| 897 | |
| 898 | /// Normally this is the same as videoAspect, but may not be |
| 899 | /// if the user has toggled the aspect override mode. |
| 900 | diff -Naur --exclude=.svn mythtv.opengl/programs/mythfrontend/globalsettings.cpp mythtv/programs/mythfrontend/globalsettings.cpp |
| 901 | --- mythtv.opengl/programs/mythfrontend/globalsettings.cpp 2009-05-02 07:32:18.000000000 +1000 |
| 902 | +++ mythtv/programs/mythfrontend/globalsettings.cpp 2009-05-15 16:57:30.000000000 +1000 |
| 903 | @@ -2414,6 +2414,15 @@ |
| 904 | return gc; |
| 905 | } |
| 906 | |
| 907 | +static HostLineEdit *CustomScreenConfig() |
| 908 | +{ |
| 909 | + HostLineEdit *gedit = new HostLineEdit("CustomScreenRate"); |
| 910 | + gedit->setLabel(QObject::tr("Custom screen rate definition file")); |
| 911 | + gedit->setHelpText(QObject::tr("Custom screen resolution configuration " |
| 912 | + "for matching xrandr value.")); |
| 913 | + return gedit; |
| 914 | +} |
| 915 | + |
| 916 | static HostSpinBox *VidModeWidth(int idx) |
| 917 | { |
| 918 | HostSpinBox *gs = new HostSpinBox(QString("VidModeWidth%1").arg(idx), |
| 919 | @@ -2582,9 +2591,16 @@ |
| 920 | rate, SLOT(ChangeResolution(const QString&))); |
| 921 | } |
| 922 | |
| 923 | + ConfigurationGroup* customscreensettings = |
| 924 | + new HorizontalConfigurationGroup(false, false); |
| 925 | + |
| 926 | + customscreensettings->addChild(CustomScreenConfig()); |
| 927 | + |
| 928 | ConfigurationGroup* settings = new VerticalConfigurationGroup(false); |
| 929 | + |
| 930 | settings->addChild(defaultsettings); |
| 931 | settings->addChild(overrides); |
| 932 | + settings->addChild(customscreensettings); |
| 933 | |
| 934 | addTarget("1", settings); |
| 935 | addTarget("0", new VerticalConfigurationGroup(true)); |