Merge pull request #3146 from FernetMenta/aefixes
[vuplus_xbmc] / xbmc / guilib / Resolution.h
1 /*
2 *      Copyright (C) 2005-2013 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 "utils/StdString.h"
25
26 typedef int DisplayMode;
27 #define DM_WINDOWED     -1
28 #define DM_FULLSCREEN1   0
29 #define DM_FULLSCREEN2   1
30 // DM_FULLSCREEN3        2
31 // etc.
32
33 enum 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
59 enum VSYNC {
60   VSYNC_DISABLED     =  0,
61   VSYNC_VIDEO        =  1,
62   VSYNC_ALWAYS       =  2,
63   VSYNC_DRIVER       =  3
64 };
65
66 struct OVERSCAN
67 {
68   int left;
69   int top;
70   int right;
71   int bottom;
72 public:
73   OVERSCAN()
74   {
75     left = top = right = bottom = 0;
76   }
77   OVERSCAN(const OVERSCAN& os)
78   {
79     left = os.left; top = os.top;
80     right = os.right; bottom = os.bottom;
81   }
82 };
83
84 struct RESOLUTION_INFO
85 {
86   OVERSCAN Overscan;
87   bool bFullScreen;
88   int iScreen;
89   int iWidth;
90   int iHeight;
91   int iBlanking; /**< number of pixels of padding between stereoscopic frames */
92   int iScreenWidth;
93   int iScreenHeight;
94   int iSubtitles;
95   uint32_t dwFlags;
96   float fPixelRatio;
97   float fRefreshRate;
98   CStdString strMode;
99   CStdString strOutput;
100   CStdString strId;
101 public:
102   RESOLUTION_INFO(int width = 1280, int height = 720, float aspect = 0, const CStdString &mode = "")
103   {
104     iWidth = width;
105     iHeight = height;
106     iBlanking = 0;
107     iScreenWidth = width;
108     iScreenHeight = height;
109     fPixelRatio = aspect ? ((float)width)/height / aspect : 1.0f;
110     strMode = mode;
111     bFullScreen = true;
112     fRefreshRate = 0;
113     dwFlags = iSubtitles = iScreen = 0;
114   }
115   float DisplayRatio() const
116   {
117     return iWidth * fPixelRatio / iHeight;
118   }
119   RESOLUTION_INFO(const RESOLUTION_INFO& res)
120   {
121     Overscan = res.Overscan; bFullScreen = res.bFullScreen;
122     iScreen = res.iScreen; iWidth = res.iWidth; iHeight = res.iHeight;
123     iScreenWidth = res.iScreenWidth; iScreenHeight = res.iScreenHeight;
124     iSubtitles = res.iSubtitles; dwFlags = res.dwFlags;
125     fPixelRatio = res.fPixelRatio; fRefreshRate = res.fRefreshRate;
126     strMode = res.strMode; strOutput = res.strOutput; strId = res.strId;
127     iBlanking = res.iBlanking;
128   }
129 };