/xbmc/guilib/Resolution.h

http://github.com/xbmc/xbmc · C Header · 109 lines · 77 code · 7 blank · 25 comment · 0 complexity · 181257d58c2cd8d97cc16c1e658a0f4b MD5 · raw file

  1. /*
  2. * Copyright (C) 2005-2015 Team XBMC
  3. * http://xbmc.org
  4. *
  5. * This Program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2, or (at your option)
  8. * any later version.
  9. *
  10. * This Program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with XBMC; see the file COPYING. If not, see
  17. * <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. #pragma once
  21. #include <stdint.h>
  22. #include <string>
  23. typedef int DisplayMode;
  24. #define DM_WINDOWED -1
  25. #define DM_FULLSCREEN1 0
  26. #define DM_FULLSCREEN2 1
  27. // DM_FULLSCREEN3 2
  28. // etc.
  29. enum RESOLUTION {
  30. RES_INVALID = -1,
  31. RES_HDTV_1080i = 0,
  32. RES_HDTV_720pSBS = 1,
  33. RES_HDTV_720pTB = 2,
  34. RES_HDTV_1080pSBS = 3,
  35. RES_HDTV_1080pTB = 4,
  36. RES_HDTV_720p = 5,
  37. RES_HDTV_480p_4x3 = 6,
  38. RES_HDTV_480p_16x9 = 7,
  39. RES_NTSC_4x3 = 8,
  40. RES_NTSC_16x9 = 9,
  41. RES_PAL_4x3 = 10,
  42. RES_PAL_16x9 = 11,
  43. RES_PAL60_4x3 = 12,
  44. RES_PAL60_16x9 = 13,
  45. RES_AUTORES = 14,
  46. RES_WINDOW = 15,
  47. RES_DESKTOP = 16, // Desktop resolution for primary screen
  48. RES_CUSTOM = 16 + 1, // Desktop resolution for screen #2
  49. // ...
  50. // 12 + N - 1 // Desktop resolution for screen N
  51. // 12 + N // First additional resolution, in a N screen configuration.
  52. // 12 + N + ... // Other resolutions, in any order
  53. };
  54. struct OVERSCAN
  55. {
  56. int left;
  57. int top;
  58. int right;
  59. int bottom;
  60. public:
  61. OVERSCAN()
  62. {
  63. left = top = right = bottom = 0;
  64. }
  65. OVERSCAN(const OVERSCAN& os)
  66. {
  67. left = os.left; top = os.top;
  68. right = os.right; bottom = os.bottom;
  69. }
  70. };
  71. struct RESOLUTION_INFO
  72. {
  73. OVERSCAN Overscan;
  74. bool bFullScreen;
  75. int iScreen;
  76. int iWidth;
  77. int iHeight;
  78. int iBlanking; /**< number of pixels of padding between stereoscopic frames */
  79. int iScreenWidth;
  80. int iScreenHeight;
  81. int iSubtitles;
  82. uint32_t dwFlags;
  83. float fPixelRatio;
  84. float fRefreshRate;
  85. std::string strMode;
  86. std::string strOutput;
  87. std::string strId;
  88. public:
  89. RESOLUTION_INFO(int width = 1280, int height = 720, float aspect = 0, const std::string &mode = "");
  90. float DisplayRatio() const;
  91. RESOLUTION_INFO(const RESOLUTION_INFO& res);
  92. };
  93. class CResolutionUtils
  94. {
  95. public:
  96. static RESOLUTION ChooseBestResolution(float fps, int width, bool is3D);
  97. protected:
  98. static bool FindResolutionFromOverride(float fps, int width, bool is3D, RESOLUTION &resolution, float& weight, bool fallback);
  99. static void FindResolutionFromFpsMatch(float fps, int width, bool is3D, RESOLUTION &resolution, float& weight);
  100. static RESOLUTION FindClosestResolution(float fps, int width, bool is3D, float multiplier, RESOLUTION current, float& weight);
  101. static float RefreshWeight(float refresh, float fps);
  102. };