MythTV  0.26-pre
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Related Functions
DisplayRes Class Reference

The DisplayRes module allows for the display resolution and refresh rateto be changed "on the fly". More...

#include <DisplayRes.h>

Inheritance diagram for DisplayRes:
DisplayResOSX DisplayResX

List of all members.

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, double frate=0.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.
double 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.
double GetPixelAspectRatio (void) const
 Returns the pixel aspect ratio of the display.
virtual const DisplayResVectorGetVideoModes () const =0
 Returns all video modes supported by the display.
const std::vector< double > GetRefreshRates (int width, int height) const
 Returns refresh rates available at a specific screen resolution.

Static Public Member Functions

static DisplayResGetDisplayRes (bool lock=false)
 Factory method that returns a DisplayRes singleton.
static void Unlock (void)
 Release any access restrictions.
static void SwitchToDesktop (void)
 Return the screen to the original desktop settings.

Protected Member Functions

 DisplayRes (void)
 DisplayRes is an abstract class, instanciate with GetDisplayRes(void)
virtual ~DisplayRes (void)
virtual bool GetDisplayInfo (int &w_pix, int &h_pix, int &w_mm, int &h_mm, double &rate, double &par) const =0
virtual bool SwitchToVideoMode (int width, int height, double framerate)=0

Private Member Functions

 DisplayRes (const DisplayRes &rhs)

Private Attributes

tmode m_curMode
DisplayResScreen m_mode [MAX_MODES]
DisplayResScreen m_last
DisplayResMap m_inSizeToOutputMode
 maps input video parameters to output video modes
int m_maxWidth
int m_maxHeight
double m_pixelAspectRatio

Static Private Attributes

static DisplayResm_instance = NULL
static bool m_locked = false

Related Functions

(Note that these are not member functions.)

 GetVideoModes (void)
 Returns all video modes available.

Detailed Description

The DisplayRes module allows for the display resolution and refresh rateto be changed "on the fly".

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 32 of file DisplayRes.h.


Constructor & Destructor Documentation

DisplayRes::DisplayRes ( void  ) [inline, protected]

DisplayRes is an abstract class, instanciate with GetDisplayRes(void)

Definition at line 141 of file DisplayRes.h.

virtual DisplayRes::~DisplayRes ( void  ) [inline, protected, virtual]

Definition at line 142 of file DisplayRes.h.

DisplayRes::DisplayRes ( const DisplayRes rhs) [private]

Member Function Documentation

Factory method that returns a DisplayRes singleton.

Parameters:
lockprevent other objects that also request a lock from altering the display resolution
See also:
Unlock(void)

Definition at line 18 of file DisplayRes.cpp.

Referenced by VoqvFullscreen::BeginPort(), VoqvFullscreen::EndPort(), MythUIHelperPrivate::GetPixelAspectRatio(), HostRefreshRateComboBox::GetRefreshRates(), GetVideoModes(), TV::Init(), MythUIHelper::LoadQtConfig(), VideoOutputOpenGL::VideoOutputOpenGL(), VideoOutputVDPAU::VideoOutputVDPAU(), and VideoOutputXv::VideoOutputXv().

void DisplayRes::Unlock ( void  ) [static]

Release any access restrictions.

See also:
GetDisplayRes(bool)

Definition at line 38 of file DisplayRes.cpp.

Referenced by VideoOutput::~VideoOutput().

Return the screen to the original desktop settings.

Definition at line 43 of file DisplayRes.cpp.

Referenced by MythUIHelperPrivate::~MythUIHelperPrivate().

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 49 of file DisplayRes.cpp.

Referenced by DisplayResOSX::DisplayResOSX(), DisplayResX::DisplayResX(), and MythUIHelper::LoadQtConfig().

DisplayRes::SwitchToVideo ( int  iwidth,
int  iheight,
double  frate = 0.0 
)

Switches to the resolution and refresh rate defined in the database for the specified video resolution and frame rate.

Definition at line 121 of file DisplayRes.cpp.

Referenced by VoqvFullscreen::BeginPort(), and VideoOutput::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).

Parameters:
which_guieither regular GUI or CUSTOM_GUI
See also:
SwitchToCustomGUI(int, int, short)

Definition at line 181 of file DisplayRes.cpp.

Referenced by VoqvFullscreen::EndPort(), MythUIHelper::LoadQtConfig(), VideoOutput::ResizeForGui(), SwitchToCustomGUI(), and SwitchToDesktop().

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.

See also:
SwitchToGUI(tmode)

Definition at line 216 of file DisplayRes.cpp.

int DisplayRes::GetWidth ( void  ) const [inline]

Returns current screen width in pixels.

Definition at line 101 of file DisplayRes.h.

Referenced by VideoOutput::ResizeForVideo(), SwitchToGUI(), and SwitchToVideo().

int DisplayRes::GetHeight ( void  ) const [inline]

Returns current screen width in pixels.

Definition at line 104 of file DisplayRes.h.

Referenced by VideoOutput::ResizeForVideo(), SwitchToGUI(), and SwitchToVideo().

int DisplayRes::GetPhysicalWidth ( void  ) const [inline]

Returns current screen width in millimeters.

Definition at line 107 of file DisplayRes.h.

Referenced by VideoOutput::ResizeForVideo(), and SwitchToVideo().

int DisplayRes::GetPhysicalHeight ( void  ) const [inline]

Returns current screen height in millimeters.

Definition at line 110 of file DisplayRes.h.

Referenced by VideoOutput::ResizeForVideo(), and SwitchToVideo().

double DisplayRes::GetRefreshRate ( void  ) const [inline]

Returns current screen refresh rate.

Definition at line 113 of file DisplayRes.h.

Referenced by SwitchToGUI().

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 119 of file DisplayRes.h.

Referenced by VideoOutput::InitDisplayMeasurements(), and VideoOutput::ResizeForVideo().

int DisplayRes::GetMaxWidth ( void  ) const [inline]

Returns maximum width in pixels supported by display.

Definition at line 128 of file DisplayRes.h.

Referenced by TV::Init(), and VideoOutput::InitDisplayMeasurements().

int DisplayRes::GetMaxHeight ( void  ) const [inline]

Returns maximum height in pixels supported by display.

Definition at line 130 of file DisplayRes.h.

Referenced by TV::Init(), and VideoOutput::InitDisplayMeasurements().

double DisplayRes::GetPixelAspectRatio ( void  ) const [inline]

Returns the pixel aspect ratio of the display.

Definition at line 132 of file DisplayRes.h.

Referenced by MythUIHelperPrivate::GetPixelAspectRatio().

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 std::vector< double > DisplayRes::GetRefreshRates ( int  width,
int  height 
) const

Returns refresh rates available at a specific screen resolution.

Definition at line 224 of file DisplayRes.cpp.

Referenced by HostRefreshRateComboBox::GetRefreshRates().

virtual bool DisplayRes::GetDisplayInfo ( int w_pix,
int h_pix,
int w_mm,
int h_mm,
double &  rate,
double &  par 
) const [protected, pure virtual]

Implemented in DisplayResOSX, and DisplayResX.

Referenced by Initialize().

virtual bool DisplayRes::SwitchToVideoMode ( int  width,
int  height,
double  framerate 
) [protected, pure virtual]

Implemented in DisplayResOSX, and DisplayResX.

Referenced by SwitchToGUI(), and SwitchToVideo().


Friends And Related Function Documentation

GetVideoModes ( void  ) [related]

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 GetVideoModes(void).

Definition at line 248 of file DisplayRes.cpp.

Referenced by GuiVidModeResolution(), and TVVidModeResolution().


Member Data Documentation

Definition at line 152 of file DisplayRes.h.

Referenced by Initialize(), SwitchToGUI(), and SwitchToVideo().

Definition at line 153 of file DisplayRes.h.

Referenced by Initialize(), SwitchToCustomGUI(), SwitchToGUI(), and SwitchToVideo().

Definition at line 154 of file DisplayRes.h.

Referenced by Initialize(), SwitchToGUI(), and SwitchToVideo().

maps input video parameters to output video modes

Definition at line 157 of file DisplayRes.h.

Referenced by Initialize(), and SwitchToVideo().

Definition at line 159 of file DisplayRes.h.

Referenced by Initialize().

Definition at line 159 of file DisplayRes.h.

Referenced by Initialize().

Definition at line 161 of file DisplayRes.h.

Referenced by Initialize().

DisplayRes * DisplayRes::m_instance = NULL [static, private]

Definition at line 163 of file DisplayRes.h.

Referenced by GetDisplayRes(), and SwitchToDesktop().

bool DisplayRes::m_locked = false [static, private]

Definition at line 164 of file DisplayRes.h.

Referenced by GetDisplayRes(), and Unlock().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends