PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 21#pragma once
 22
 23#include <stdint.h>
 24#include <string>
 25
 26typedef int DisplayMode;
 27#define DM_WINDOWED     -1
 28#define DM_FULLSCREEN1   0
 29#define DM_FULLSCREEN2   1
 30// DM_FULLSCREEN3        2
 31// etc.
 32
 33enum RESOLUTION {
 34  RES_INVALID        = -1,
 35  RES_HDTV_1080i     =  0,
 36  RES_HDTV_720pSBS   =  1,
 37  RES_HDTV_720pTB    =  2,
 38  RES_HDTV_1080pSBS  =  3,
 39  RES_HDTV_1080pTB   =  4,
 40  RES_HDTV_720p      =  5,
 41  RES_HDTV_480p_4x3  =  6,
 42  RES_HDTV_480p_16x9 =  7,
 43  RES_NTSC_4x3       =  8,
 44  RES_NTSC_16x9      =  9,
 45  RES_PAL_4x3        = 10,
 46  RES_PAL_16x9       = 11,
 47  RES_PAL60_4x3      = 12,
 48  RES_PAL60_16x9     = 13,
 49  RES_AUTORES        = 14,
 50  RES_WINDOW         = 15,
 51  RES_DESKTOP        = 16,          // Desktop resolution for primary screen
 52  RES_CUSTOM         = 16 + 1,      // Desktop resolution for screen #2
 53//                     ...
 54//                     12 + N - 1   // Desktop resolution for screen N
 55//                     12 + N       // First additional resolution, in a N screen configuration.
 56//                     12 + N + ... // Other resolutions, in any order
 57};
 58
 59struct OVERSCAN
 60{
 61  int left;
 62  int top;
 63  int right;
 64  int bottom;
 65public:
 66  OVERSCAN()
 67  {
 68    left = top = right = bottom = 0;
 69  }
 70  OVERSCAN(const OVERSCAN& os)
 71  {
 72    left = os.left; top = os.top;
 73    right = os.right; bottom = os.bottom;
 74  }
 75};
 76
 77struct RESOLUTION_INFO
 78{
 79  OVERSCAN Overscan;
 80  bool bFullScreen;
 81  int iScreen;
 82  int iWidth;
 83  int iHeight;
 84  int iBlanking; /**< number of pixels of padding between stereoscopic frames */
 85  int iScreenWidth;
 86  int iScreenHeight;
 87  int iSubtitles;
 88  uint32_t dwFlags;
 89  float fPixelRatio;
 90  float fRefreshRate;
 91  std::string strMode;
 92  std::string strOutput;
 93  std::string strId;
 94public:
 95  RESOLUTION_INFO(int width = 1280, int height = 720, float aspect = 0, const std::string &mode = "");
 96  float DisplayRatio() const;
 97  RESOLUTION_INFO(const RESOLUTION_INFO& res);
 98};
 99
100class CResolutionUtils
101{
102public:
103  static RESOLUTION ChooseBestResolution(float fps, int width, bool is3D);
104protected:
105  static bool FindResolutionFromOverride(float fps, int width, bool is3D, RESOLUTION &resolution, float& weight, bool fallback);
106  static void FindResolutionFromFpsMatch(float fps, int width, bool is3D, RESOLUTION &resolution, float& weight);
107  static RESOLUTION FindClosestResolution(float fps, int width, bool is3D, float multiplier, RESOLUTION current, float& weight);
108  static float RefreshWeight(float refresh, float fps);
109};