#include <DisplayRes.h>

Resolution and refresh rate can be changed using an explicit call or based on the video resolution.
The SwitchToVideoMode routine takes care of the actual work involved in changing the display mode. There are currently XRandR and OS X Carbon implementation so this works for X (Linux/BSD/UNIX) and Mac OS X.
Definition at line 27 of file DisplayRes.h.
Public Member Functions | |
| bool | Initialize (void) |
| Initialize DisplayRes, normally called automatically. | |
Resolution/Refresh Rate Changing methods. | |
These return true if mode is changed | |
| bool | SwitchToVideo (int iwidth, int iheight, short irate=0) |
| Switches to the resolution and refresh rate defined in the database for the specified video resolution and frame rate. | |
| bool | SwitchToGUI (tmode which_gui=GUI) |
| Switches to the GUI resolution specified. | |
| bool | SwitchToCustomGUI (int width, int height, short rate=0) |
| Switches to the custom GUI resolution specified. | |
Queries of current video mode | |
| int | GetWidth (void) const |
| Returns current screen width in pixels. | |
| int | GetHeight (void) const |
| Returns current screen width in pixels. | |
| int | GetPhysicalWidth (void) const |
| Returns current screen width in millimeters. | |
| int | GetPhysicalHeight (void) const |
| Returns current screen height in millimeters. | |
| int | GetRefreshRate (void) const |
| Returns current screen refresh rate. | |
| double | GetAspectRatio (void) const |
| Returns current screen aspect ratio. | |
These methods are global for all video modes | |
| int | GetMaxWidth (void) const |
| Returns maximum width in pixels supported by display. | |
| int | GetMaxHeight (void) const |
| Returns maximum height in pixels supported by display. | |
| virtual const vector < DisplayResScreen > & | GetVideoModes () const =0 |
| Returns all video modes supported by the display. | |
| const vector< short > | GetRefreshRates (int width, int height) const |
| Returns refresh rates available at a specific screen resolution. | |
Static Public Member Functions | |
| static DisplayRes * | GetDisplayRes (void) |
| Factory method that returns a DisplayRes singleton. | |
Protected Member Functions | |
| DisplayRes (void) | |
| DisplayRes is an abstract class, instanciate with GetDisplayRes(void). | |
| virtual | ~DisplayRes (void) |
| virtual bool | GetDisplaySize (int &width_mm, int &height_mm) const =0 |
| virtual bool | SwitchToVideoMode (int width, int height, short framerate)=0 |
Private Member Functions | |
| DisplayRes (const DisplayRes &rhs) | |
Private Attributes | |
| tmode | cur_mode |
| DisplayResScreen | mode [4] |
| DisplayResScreen | last |
| DisplayResMap | in_size_to_output_mode |
| maps input video parameters to output video modes | |
| int | max_width |
| int | max_height |
Static Private Attributes | |
| static DisplayRes * | instance = NULL |
| DisplayRes::DisplayRes | ( | void | ) | [inline, protected] |
DisplayRes is an abstract class, instanciate with GetDisplayRes(void).
Definition at line 118 of file DisplayRes.h.
| virtual DisplayRes::~DisplayRes | ( | void | ) | [inline, protected, virtual] |
Definition at line 119 of file DisplayRes.h.
| DisplayRes::DisplayRes | ( | const DisplayRes & | rhs | ) | [private] |
| DisplayRes * DisplayRes::GetDisplayRes | ( | void | ) | [static] |
Factory method that returns a DisplayRes singleton.
Definition at line 14 of file DisplayRes.cpp.
Referenced by VoqvFullscreen::BeginPort(), VoqvFullscreen::EndPort(), HostRefreshRateComboBox::GetRefreshRates(), GetVideoModes(), TV::Init(), MythContext::LoadQtConfig(), and VideoOutputXv::VideoOutputXv().
| bool DisplayRes::Initialize | ( | void | ) |
Initialize DisplayRes, normally called automatically.
While Initialize is called automatically by GetDisplayRes(void) it should be called again if the database settings for DisplayRes have changed.
Definition at line 27 of file DisplayRes.cpp.
Referenced by DisplayResOSX::DisplayResOSX(), DisplayResX::DisplayResX(), and MythContext::LoadQtConfig().
| DisplayRes::SwitchToVideo | ( | int | iwidth, | |
| int | iheight, | |||
| short | irate = 0 | |||
| ) |
Switches to the resolution and refresh rate defined in the database for the specified video resolution and frame rate.
Definition at line 85 of file DisplayRes.cpp.
Referenced by VoqvFullscreen::BeginPort(), and VideoOutputXv::ResizeForVideo().
Switches to the GUI resolution specified.
If which_gui is GUI then this switches to the resolution and refresh rate set in the database for the GUI. If which_gui is set to CUSTOM_GUI then we switch to the resolution and refresh rate specified in the last call to SwitchToCustomGUI(int, int, short).
| which_gui | either regular GUI or CUSTOM_GUI |
Definition at line 126 of file DisplayRes.cpp.
Referenced by VoqvFullscreen::EndPort(), MythContext::LoadQtConfig(), VideoOutputXv::ResizeForGui(), SwitchToCustomGUI(), and VideoOutputXv::~VideoOutputXv().
| bool DisplayRes::SwitchToCustomGUI | ( | int | width, | |
| int | height, | |||
| short | rate = 0 | |||
| ) |
Switches to the custom GUI resolution specified.
This switches to the specified resolution, and refresh rate if specified. It also makes saves this resolution as the CUSTOM_GUI resolution, so that it can be recalled with SwitchToGUI(CUSTOM_GUI) in later DisplayRes calls.
Definition at line 154 of file DisplayRes.cpp.
| int DisplayRes::GetWidth | ( | void | ) | const [inline] |
Returns current screen width in pixels.
Definition at line 80 of file DisplayRes.h.
Referenced by VideoOutputXv::ResizeForVideo(), SwitchToGUI(), and SwitchToVideo().
| int DisplayRes::GetHeight | ( | void | ) | const [inline] |
Returns current screen width in pixels.
Definition at line 83 of file DisplayRes.h.
Referenced by VideoOutputXv::ResizeForVideo(), SwitchToGUI(), and SwitchToVideo().
| int DisplayRes::GetPhysicalWidth | ( | void | ) | const [inline] |
Returns current screen width in millimeters.
Definition at line 86 of file DisplayRes.h.
Referenced by VideoOutputXv::ResizeForVideo(), and SwitchToVideo().
| int DisplayRes::GetPhysicalHeight | ( | void | ) | const [inline] |
Returns current screen height in millimeters.
Definition at line 89 of file DisplayRes.h.
Referenced by VideoOutputXv::ResizeForVideo(), and SwitchToVideo().
| int DisplayRes::GetRefreshRate | ( | void | ) | const [inline] |
| double DisplayRes::GetAspectRatio | ( | void | ) | const [inline] |
Returns current screen aspect ratio.
If there is an aspect overide in the database that aspect ratio is returned instead of the actual screen aspect ratio.
Definition at line 98 of file DisplayRes.h.
Referenced by VideoOutputXv::InitDisplayMeasurements(), and VideoOutputXv::ResizeForVideo().
| int DisplayRes::GetMaxWidth | ( | void | ) | const [inline] |
Returns maximum width in pixels supported by display.
Definition at line 107 of file DisplayRes.h.
Referenced by TV::Init(), and VideoOutputXv::InitDisplayMeasurements().
| int DisplayRes::GetMaxHeight | ( | void | ) | const [inline] |
Returns maximum height in pixels supported by display.
Definition at line 109 of file DisplayRes.h.
Referenced by TV::Init(), and VideoOutputXv::InitDisplayMeasurements().
| GetVideoModes | ( | void | ) | const [pure virtual] |
Returns all video modes supported by the display.
Returns all video modes available.
This is a conveniance class that instanciates a DisplayRes class if needed, and returns a copy of vector returned by DisplayRes::GetVideoModes(void).
Implemented in DisplayResOSX, and DisplayResX.
Referenced by GetRefreshRates(), GetVideoModes(), Initialize(), SwitchToGUI(), and SwitchToVideo().
| const vector< short > DisplayRes::GetRefreshRates | ( | int | width, | |
| int | height | |||
| ) | const |
Returns refresh rates available at a specific screen resolution.
Definition at line 161 of file DisplayRes.cpp.
Referenced by HostRefreshRateComboBox::GetRefreshRates().
| virtual bool DisplayRes::GetDisplaySize | ( | int & | width_mm, | |
| int & | height_mm | |||
| ) | const [protected, pure virtual] |
| virtual bool DisplayRes::SwitchToVideoMode | ( | int | width, | |
| int | height, | |||
| short | framerate | |||
| ) | [protected, pure virtual] |
tmode DisplayRes::cur_mode [private] |
Definition at line 128 of file DisplayRes.h.
Referenced by Initialize(), SwitchToGUI(), and SwitchToVideo().
DisplayResScreen DisplayRes::mode[4] [private] |
Definition at line 129 of file DisplayRes.h.
Referenced by Initialize(), SwitchToCustomGUI(), SwitchToGUI(), and SwitchToVideo().
DisplayResScreen DisplayRes::last [private] |
Definition at line 130 of file DisplayRes.h.
Referenced by Initialize(), SwitchToGUI(), and SwitchToVideo().
maps input video parameters to output video modes
Definition at line 133 of file DisplayRes.h.
Referenced by Initialize(), and SwitchToVideo().
int DisplayRes::max_width [private] |
int DisplayRes::max_height [private] |
DisplayRes * DisplayRes::instance = NULL [static, private] |
1.5.5