00001 #ifndef _Display_Res_H_
00002 #define _Display_Res_H_
00003
00004 #include <vector>
00005
00006 #include "DisplayResScreen.h"
00007 #include "mythuiexp.h"
00008
00022 typedef enum
00023 {
00024 GUI = 0,
00025 VIDEO = 1,
00026 CUSTOM_GUI = 2,
00027 CUSTOM_VIDEO = 3,
00028 DESKTOP = 4,
00029 MAX_MODES = 5,
00030 } tmode;
00031
00032 class MUI_PUBLIC DisplayRes
00033 {
00034 public:
00042 static DisplayRes *GetDisplayRes(bool lock = false);
00043
00047 static void Unlock(void);
00048
00051 static void SwitchToDesktop(void);
00052
00059 bool Initialize(void);
00060
00070 bool SwitchToVideo(int iwidth, int iheight, double frate = 0.0);
00082 bool SwitchToGUI(tmode which_gui=GUI);
00092 bool SwitchToCustomGUI(int width, int height, short rate = 0);
00101 int GetWidth(void) const { return m_last.Width(); }
00102
00104 int GetHeight(void) const { return m_last.Height(); }
00105
00107 int GetPhysicalWidth(void) const { return m_last.Width_mm(); }
00108
00110 int GetPhysicalHeight(void) const { return m_last.Height_mm(); }
00111
00113 double GetRefreshRate(void) const { return m_last.RefreshRate(); }
00119 double GetAspectRatio(void) const { return m_last.AspectRatio(); }
00127
00128 int GetMaxWidth(void) const { return m_maxWidth; }
00130 int GetMaxHeight(void) const { return m_maxHeight; }
00132 double GetPixelAspectRatio(void) const { return m_pixelAspectRatio; }
00134 virtual const DisplayResVector& GetVideoModes() const = 0;
00136 const std::vector<double> GetRefreshRates(int width, int height) const;
00139 protected:
00141 DisplayRes(void) : m_curMode(GUI), m_maxWidth(0), m_maxHeight(0) {;}
00142 virtual ~DisplayRes(void) {;}
00143
00144
00145 virtual bool GetDisplayInfo(int &w_pix, int &h_pix, int &w_mm,
00146 int &h_mm, double &rate, double &par) const = 0;
00147 virtual bool SwitchToVideoMode(int width, int height, double framerate) = 0;
00148
00149 private:
00150 DisplayRes(const DisplayRes & rhs);
00151
00152 tmode m_curMode;
00153 DisplayResScreen m_mode[MAX_MODES];
00154 DisplayResScreen m_last;
00155
00157 DisplayResMap m_inSizeToOutputMode;
00158
00159 int m_maxWidth, m_maxHeight;
00160
00161 double m_pixelAspectRatio;
00162
00163 static DisplayRes *m_instance;
00164 static bool m_locked;
00165 };
00166
00175 MUI_PUBLIC const DisplayResVector GetVideoModes(void);
00176
00177 #endif