VideoOutWindow Class Reference

#include <videooutwindow.h>

List of all members.

Public Member Functions

 VideoOutWindow ()
bool Init (const QSize &new_video_dim, float aspect, const QRect &new_display_visible_rect, AspectOverrideMode aspectoverride, AdjustFillMode adjustfill)
bool InputChanged (const QSize &input_size, float aspect, MythCodecID myth_codec_id, void *codec_private)
 Tells video output to discard decoded frames and wait for new ones.
void VideoAspectRatioChanged (float aspect)
 Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
void EmbedInWidget (const QRect &)
 Tells video output to embed video in an existing window.
void StopEmbedding (void)
 Tells video output to stop embedding video in an existing window.
void ToggleAdjustFill (AdjustFillMode adjustFillMode=kAdjustFill_Toggle)
 Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize() to apply them.
void ToggleAspectOverride (AspectOverrideMode aspectOverrideMode=kAspect_Toggle)
 Enforce different aspect ration than detected, then calls VideoAspectRatioChanged(float) to apply them.
void ResizeDisplayWindow (const QRect &, bool)
 Resize Display Window.
void MoveResize (void)
 performs all the calculations for video framing and any resizing.
void Zoom (ZoomDirection direction)
 Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().
void SetVideoScalingAllowed (bool change)
 Disable or enable underscan/overscan.
void SetAllowPreviewEPG (bool allowPreviewEPG)
void SetDisplayDim (QSize displayDim)
void SetDisplayAspect (float displayAspect)
void SetPIPState (PIPState setting)
void SetVideoDim (QSize dim)
void SetDisplayVisibleRect (QRect rect)
void SetNeedRepaint (bool needRepaint)
bool IsVideoScalingAllowed (void) const
bool IsEmbedding (void) const
 Returns if videooutput is embedding.
QSize GetVideoDim (void) const
QSize GetActualVideoDim (void) const
QSize GetVideoDispDim (void) const
QSize GetDisplayDim (void) const
float GetMzScaleV (void) const
float GetMzScaleH (void) const
QPoint GetMzMove (void) const
int GetPIPSize (void) const
PIPState GetPIPState (void) const
float GetOverridenVideoAspect (void) const
QRect GetDisplayVisibleRect (void) const
QRect GetScreenGeometry (void) const
QRect GetVideoRect (void) const
QRect GetDisplayVideoRect (void) const
QRect GetEmbeddingRect (void) const
bool UsingXinerama (void) const
bool UsingGuiSize (void) const
AspectOverrideMode GetAspectOverride (void) const
 Returns current aspect override mode.
AdjustFillMode GetAdjustFill (void) const
 Returns current adjust fill mode.
float GetVideoAspect (void) const
bool IsPreviewEPGAllowed (void) const
bool IsRepaintNeeded (void) const
float GetDisplayAspect (void) const
 Returns current display aspect ratio.
QRect GetTmpDisplayVisibleRect (void) const
QRect GetVisibleOSDBounds (float &, float &, float) const
 Returns visible portions of total OSD bounds.
QRect GetTotalOSDBounds (void) const
 Returns total OSD bounds.
QRect GetPIPRect (PIPLocation location, MythPlayer *pipplayer=NULL, bool do_pixel_adj=true) const

Protected Member Functions

void ApplyDBScaleAndMove (void)
 Apply scales and moves for "Overscan" and "Underscan" DB settings.
void ApplyManualScaleAndMove (void)
 Apply scales and moves from "Zoom Mode" settings.
void ApplyLetterboxing (void)
void ApplySnapToVideoRect (void)
 Snap displayed rectagle to video rectange if they are close.
void PrintMoveResizeDebug (void)
void SetVideoAspectRatio (float aspect)
 Sets VideoOutWindow::video_aspect to aspect, and sets VideoOutWindow::overriden_video_aspect if aspectoverride is set to either 4:3, 14:9 or 16:9.

Private Attributes

QPoint db_move
 Percentage move from database.
float db_scale_horiz
 Horizontal Overscan/Underscan percentage.
float db_scale_vert
 Vertical Overscan/Underscan percentage.
int db_pip_size
 percentage of full window to use for PiP
bool db_scaling_allowed
 disable this to prevent overscan/underscan
bool db_use_gui_size
 Use the gui size for video window.
bool using_xinerama
 Display is using multiple screens.
int screen_num
 Screen that contains playback window.
QRect screen_geom
 Full screen geometry.
float mz_scale_v
 Manually applied vertical scaling.
float mz_scale_h
 Manually applied horizontal scaling.
QPoint mz_move
 Manually applied percentage move.
QSize display_dim
 Screen dimensions of playback window in mm.
float display_aspect
 Physical aspect ratio of playback window.
QSize video_dim
 Pixel dimensions of video buffer.
QSize video_disp_dim
 Pixel dimensions of video display area.
QSize video_dim_act
 Pixel dimensions of the raw video stream.
float video_aspect
 Physical aspect ratio of video.
float overriden_video_aspect
 Normally this is the same as videoAspect, but may not be if the user has toggled the aspect override mode.
AspectOverrideMode aspectoverride
 AspectOverrideMode to use to modify overriden_video_aspect.
AdjustFillMode adjustfill
 Zoom mode.
QRect video_rect
 Pixel rectangle in video frame to display.
QRect display_video_rect
 Pixel rectangle in display window into which video_rect maps to.
QRect display_visible_rect
 Visible portion of display window in pixels.
QRect tmp_display_visible_rect
 Used to save the display_visible_rect for restoration after video embedding ends.
QRect embedding_rect
 Embedded video rectangle.
bool embedding
 State variables.
bool needrepaint
bool allowpreviewepg
PIPState pip_state

Static Private Attributes

static const float kManualZoomMaxHorizontalZoom = 2.0f
static const float kManualZoomMaxVerticalZoom = 2.0f
static const float kManualZoomMinHorizontalZoom = 0.5f
static const float kManualZoomMinVerticalZoom = 0.5f
static const int kManualZoomMaxMove = 50

Detailed Description

Definition at line 20 of file videooutwindow.h.


Constructor & Destructor Documentation

VideoOutWindow::VideoOutWindow (  ) 

Definition at line 55 of file videooutwindow.cpp.


Member Function Documentation

bool VideoOutWindow::Init ( const QSize &  new_video_dim,
float  aspect,
const QRect &  new_display_visible_rect,
AspectOverrideMode  aspectoverride,
AdjustFillMode  adjustfill 
)

Definition at line 481 of file videooutwindow.cpp.

Referenced by VideoOutput::Init().

bool VideoOutWindow::InputChanged ( const QSize &  input_size,
float  aspect,
MythCodecID  myth_codec_id,
void *  codec_private 
)

Tells video output to discard decoded frames and wait for new ones.

Bug:
We set the new width height and aspect ratio here, but we should do this based on the new video frames in Show().

Definition at line 598 of file videooutwindow.cpp.

Referenced by VideoOutput::InputChanged().

void VideoOutWindow::VideoAspectRatioChanged ( float  aspect  ) 

Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.

Parameters:
aspect video aspect ratio to use

Definition at line 586 of file videooutwindow.cpp.

Referenced by Init(), ToggleAspectOverride(), and VideoOutput::VideoAspectRatioChanged().

void VideoOutWindow::EmbedInWidget ( const QRect &  rect  ) 

Tells video output to embed video in an existing window.

Parameters:
rect new display_video_rect
See also:
StopEmbedding()

Definition at line 688 of file videooutwindow.cpp.

Referenced by VideoOutput::EmbedInWidget().

void VideoOutWindow::StopEmbedding ( void   ) 

Tells video output to stop embedding video in an existing window.

See also:
EmbedInWidget(WId, int, int, int, int)

Definition at line 707 of file videooutwindow.cpp.

Referenced by VideoOutput::StopEmbedding().

void VideoOutWindow::ToggleAdjustFill ( AdjustFillMode  adjustFillMode = kAdjustFill_Toggle  ) 

Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize() to apply them.

See also:
Zoom(ZoomDirection), ToggleAspectOverride(AspectOverrideMode)

Definition at line 634 of file videooutwindow.cpp.

Referenced by VideoOutput::ToggleAdjustFill().

void VideoOutWindow::ToggleAspectOverride ( AspectOverrideMode  aspectOverrideMode = kAspect_Toggle  ) 

Enforce different aspect ration than detected, then calls VideoAspectRatioChanged(float) to apply them.

See also:
Zoom(ZoomDirection), ToggleAdjustFill(AdjustFillMode)

Definition at line 809 of file videooutwindow.cpp.

Referenced by VideoOutput::ToggleAspectOverride().

void VideoOutWindow::ResizeDisplayWindow ( const QRect &  rect,
bool  save_visible_rect 
)

Resize Display Window.

Definition at line 673 of file videooutwindow.cpp.

Referenced by EmbedInWidget(), and VideoOutput::ResizeDisplayWindow().

void VideoOutWindow::MoveResize ( void   ) 

performs all the calculations for video framing and any resizing.

First we apply playback over/underscanning and offsetting, then we letterbox settings, and finally we apply manual scale & move properties for "Zoom Mode".

See also:
Zoom(ZoomDirection), ToggleAdjustFill(int)

Definition at line 127 of file videooutwindow.cpp.

Referenced by VideoOutput::MoveResize(), ResizeDisplayWindow(), SetVideoScalingAllowed(), StopEmbedding(), ToggleAdjustFill(), and VideoAspectRatioChanged().

void VideoOutWindow::Zoom ( ZoomDirection  direction  ) 

Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().

See also:
ToggleAdjustFill(AdjustFillMode)

Definition at line 876 of file videooutwindow.cpp.

Referenced by VideoOutput::Zoom().

void VideoOutWindow::SetVideoScalingAllowed ( bool  change  ) 

Disable or enable underscan/overscan.

Definition at line 647 of file videooutwindow.cpp.

Referenced by VideoOutput::SetVideoScalingAllowed().

void VideoOutWindow::SetAllowPreviewEPG ( bool  allowPreviewEPG  )  [inline]
void VideoOutWindow::SetDisplayDim ( QSize  displayDim  )  [inline]
void VideoOutWindow::SetDisplayAspect ( float  displayAspect  )  [inline]
void VideoOutWindow::SetPIPState ( PIPState  setting  ) 

Definition at line 959 of file videooutwindow.cpp.

Referenced by VideoOutput::SetPIPState().

void VideoOutWindow::SetVideoDim ( QSize  dim  )  [inline]

Definition at line 57 of file videooutwindow.h.

Referenced by VideoOutput::SetupDeinterlace().

void VideoOutWindow::SetDisplayVisibleRect ( QRect  rect  )  [inline]
void VideoOutWindow::SetNeedRepaint ( bool  needRepaint  )  [inline]
bool VideoOutWindow::IsVideoScalingAllowed ( void   )  const [inline]

Definition at line 65 of file videooutwindow.h.

Referenced by VideoOutput::IsVideoScalingAllowed().

bool VideoOutWindow::IsEmbedding ( void   )  const [inline]
QSize VideoOutWindow::GetVideoDim ( void   )  const [inline]
QSize VideoOutWindow::GetActualVideoDim ( void   )  const [inline]
QSize VideoOutWindow::GetVideoDispDim ( void   )  const [inline]
QSize VideoOutWindow::GetDisplayDim ( void   )  const [inline]

Definition at line 71 of file videooutwindow.h.

Referenced by VideoOutput::InitDisplayMeasurements().

float VideoOutWindow::GetMzScaleV ( void   )  const [inline]

Definition at line 72 of file videooutwindow.h.

float VideoOutWindow::GetMzScaleH ( void   )  const [inline]

Definition at line 73 of file videooutwindow.h.

QPoint VideoOutWindow::GetMzMove ( void   )  const [inline]

Definition at line 74 of file videooutwindow.h.

int VideoOutWindow::GetPIPSize ( void   )  const [inline]

Definition at line 75 of file videooutwindow.h.

Referenced by VideoOutputXv::GetPIPRect().

PIPState VideoOutWindow::GetPIPState ( void   )  const [inline]
float VideoOutWindow::GetOverridenVideoAspect ( void   )  const [inline]

Definition at line 77 of file videooutwindow.h.

Referenced by VideoOutputXv::GetPIPRect().

QRect VideoOutWindow::GetDisplayVisibleRect ( void   )  const [inline]
QRect VideoOutWindow::GetScreenGeometry ( void   )  const [inline]

Definition at line 79 of file videooutwindow.h.

Referenced by VideoOutput::InitDisplayMeasurements().

QRect VideoOutWindow::GetVideoRect ( void   )  const [inline]
QRect VideoOutWindow::GetDisplayVideoRect ( void   )  const [inline]
QRect VideoOutWindow::GetEmbeddingRect ( void   )  const [inline]
bool VideoOutWindow::UsingXinerama ( void   )  const [inline]

Definition at line 83 of file videooutwindow.h.

Referenced by VideoOutput::InitDisplayMeasurements().

bool VideoOutWindow::UsingGuiSize ( void   )  const [inline]
AspectOverrideMode VideoOutWindow::GetAspectOverride ( void   )  const [inline]

Returns current aspect override mode.

See also:
ToggleAspectOverride(AspectOverrideMode)

Definition at line 88 of file videooutwindow.h.

Referenced by VideoOutput::GetAspectOverride(), and VideoOutputXv::GetPIPRect().

AdjustFillMode VideoOutWindow::GetAdjustFill ( void   )  const [inline]

Returns current adjust fill mode.

See also:
ToggleAdjustFill(AdjustFillMode)

Definition at line 92 of file videooutwindow.h.

Referenced by VideoOutput::GetAdjustFill().

float VideoOutWindow::GetVideoAspect ( void   )  const [inline]
bool VideoOutWindow::IsPreviewEPGAllowed ( void   )  const [inline]

Definition at line 95 of file videooutwindow.h.

Referenced by VideoOutput::AllowPreviewEPG().

bool VideoOutWindow::IsRepaintNeeded ( void   )  const [inline]
float VideoOutWindow::GetDisplayAspect ( void   )  const [inline]
QRect VideoOutWindow::GetTmpDisplayVisibleRect ( void   )  const [inline]
QRect VideoOutWindow::GetVisibleOSDBounds ( float &  visible_aspect,
float &  font_scaling,
float  themeaspect 
) const

Returns visible portions of total OSD bounds.

Parameters:
visible_aspect physical aspect ratio of bounds returned
font_scaling scaling to apply to fonts

Definition at line 723 of file videooutwindow.cpp.

Referenced by VideoOutput::GetVisibleOSDBounds().

QRect VideoOutWindow::GetTotalOSDBounds ( void   )  const

Returns total OSD bounds.

Definition at line 622 of file videooutwindow.cpp.

Referenced by VideoOutput::GetMHEGBounds(), and VideoOutput::GetTotalOSDBounds().

QRect VideoOutWindow::GetPIPRect ( PIPLocation  location,
MythPlayer pipplayer = NULL,
bool  do_pixel_adj = true 
) const

Definition at line 831 of file videooutwindow.cpp.

Referenced by VideoOutput::GetPIPRect().

void VideoOutWindow::ApplyDBScaleAndMove ( void   )  [protected]

Apply scales and moves for "Overscan" and "Underscan" DB settings.

It doesn't make any sense to me to offset an image such that it is clipped. Therefore, we only apply offsets if there is an underscan or overscan which creates "room" to move the image around. That is, if we overscan, we can move the "viewport". If we underscan, we change where we place the image into the display window. If no over/underscanning is performed, you just get the full original image scaled into the full display area.

Definition at line 164 of file videooutwindow.cpp.

Referenced by MoveResize().

void VideoOutWindow::ApplyManualScaleAndMove ( void   )  [protected]

Apply scales and moves from "Zoom Mode" settings.

Definition at line 276 of file videooutwindow.cpp.

Referenced by MoveResize().

void VideoOutWindow::ApplyLetterboxing ( void   )  [protected]

Definition at line 304 of file videooutwindow.cpp.

Referenced by MoveResize().

void VideoOutWindow::ApplySnapToVideoRect ( void   )  [protected]

Snap displayed rectagle to video rectange if they are close.

If our display rectangle is within 5% of the video rectangle in either dimension then snap the display rectangle in that dimension to the video rectangle. The idea is to avoid scaling if it will result in only moderate distortion.

Definition at line 442 of file videooutwindow.cpp.

Referenced by MoveResize().

void VideoOutWindow::PrintMoveResizeDebug ( void   )  [protected]

Definition at line 520 of file videooutwindow.cpp.

Referenced by MoveResize().

void VideoOutWindow::SetVideoAspectRatio ( float  aspect  )  [protected]

Sets VideoOutWindow::video_aspect to aspect, and sets VideoOutWindow::overriden_video_aspect if aspectoverride is set to either 4:3, 14:9 or 16:9.

Parameters:
aspect video aspect ratio to use

Definition at line 574 of file videooutwindow.cpp.

Referenced by InputChanged(), and VideoAspectRatioChanged().


Member Data Documentation

QPoint VideoOutWindow::db_move [private]

Percentage move from database.

Definition at line 117 of file videooutwindow.h.

Referenced by ApplyDBScaleAndMove(), and VideoOutWindow().

Horizontal Overscan/Underscan percentage.

Definition at line 118 of file videooutwindow.h.

Referenced by ApplyDBScaleAndMove(), GetVisibleOSDBounds(), MoveResize(), and SetVideoScalingAllowed().

Vertical Overscan/Underscan percentage.

Definition at line 119 of file videooutwindow.h.

Referenced by ApplyDBScaleAndMove(), GetVisibleOSDBounds(), MoveResize(), PrintMoveResizeDebug(), and SetVideoScalingAllowed().

percentage of full window to use for PiP

Definition at line 120 of file videooutwindow.h.

Referenced by GetPIPRect(), GetPIPSize(), and VideoOutWindow().

disable this to prevent overscan/underscan

Definition at line 121 of file videooutwindow.h.

Referenced by IsVideoScalingAllowed(), and SetVideoScalingAllowed().

Use the gui size for video window.

Definition at line 122 of file videooutwindow.h.

Referenced by Init(), UsingGuiSize(), and VideoOutWindow().

Display is using multiple screens.

Definition at line 124 of file videooutwindow.h.

Referenced by UsingXinerama(), and VideoOutWindow().

Screen that contains playback window.

Definition at line 125 of file videooutwindow.h.

Referenced by VideoOutWindow().

QRect VideoOutWindow::screen_geom [private]

Full screen geometry.

Definition at line 126 of file videooutwindow.h.

Referenced by GetScreenGeometry(), Init(), and VideoOutWindow().

float VideoOutWindow::mz_scale_v [private]

Manually applied vertical scaling.

Definition at line 129 of file videooutwindow.h.

Referenced by ApplyManualScaleAndMove(), GetMzScaleV(), MoveResize(), and Zoom().

float VideoOutWindow::mz_scale_h [private]

Manually applied horizontal scaling.

Definition at line 130 of file videooutwindow.h.

Referenced by ApplyManualScaleAndMove(), GetMzScaleH(), MoveResize(), and Zoom().

QPoint VideoOutWindow::mz_move [private]

Manually applied percentage move.

Definition at line 131 of file videooutwindow.h.

Referenced by ApplyManualScaleAndMove(), GetMzMove(), and Zoom().

QSize VideoOutWindow::display_dim [private]

Screen dimensions of playback window in mm.

Definition at line 134 of file videooutwindow.h.

Referenced by GetDisplayDim(), and SetDisplayDim().

Physical aspect ratio of playback window.

Definition at line 135 of file videooutwindow.h.

Referenced by GetDisplayAspect(), GetPIPRect(), and SetDisplayAspect().

QSize VideoOutWindow::video_dim [private]

Pixel dimensions of video buffer.

Definition at line 138 of file videooutwindow.h.

Referenced by GetVideoDim(), Init(), InputChanged(), MoveResize(), and SetVideoDim().

Pixel dimensions of video display area.

Definition at line 139 of file videooutwindow.h.

Referenced by ApplyDBScaleAndMove(), GetTotalOSDBounds(), GetVideoDispDim(), GetVisibleOSDBounds(), Init(), InputChanged(), and MoveResize().

Pixel dimensions of the raw video stream.

Definition at line 140 of file videooutwindow.h.

Referenced by GetActualVideoDim(), Init(), InputChanged(), and MoveResize().

Physical aspect ratio of video.

Definition at line 141 of file videooutwindow.h.

Referenced by GetVideoAspect(), PrintMoveResizeDebug(), SetVideoAspectRatio(), and ToggleAspectOverride().

Normally this is the same as videoAspect, but may not be if the user has toggled the aspect override mode.

Definition at line 145 of file videooutwindow.h.

Referenced by ApplyLetterboxing(), GetOverridenVideoAspect(), GetVisibleOSDBounds(), PrintMoveResizeDebug(), and SetVideoAspectRatio().

AspectOverrideMode to use to modify overriden_video_aspect.

Definition at line 147 of file videooutwindow.h.

Referenced by Init(), PrintMoveResizeDebug(), SetVideoAspectRatio(), and ToggleAspectOverride().

Zoom mode.

Definition at line 149 of file videooutwindow.h.

Referenced by ApplyLetterboxing(), Init(), PrintMoveResizeDebug(), and ToggleAdjustFill().

QRect VideoOutWindow::video_rect [private]

Pixel rectangle in video frame to display.

Definition at line 152 of file videooutwindow.h.

Referenced by ApplyDBScaleAndMove(), ApplySnapToVideoRect(), GetVideoRect(), Init(), MoveResize(), and PrintMoveResizeDebug().

Pixel rectangle in display window into which video_rect maps to.

Definition at line 154 of file videooutwindow.h.

Referenced by ApplyDBScaleAndMove(), ApplyLetterboxing(), ApplyManualScaleAndMove(), ApplySnapToVideoRect(), EmbedInWidget(), GetDisplayVideoRect(), GetVisibleOSDBounds(), MoveResize(), and PrintMoveResizeDebug().

Visible portion of display window in pixels.

This may be bigger or smaller than display_video_rect.

Definition at line 157 of file videooutwindow.h.

Referenced by ApplyDBScaleAndMove(), ApplyLetterboxing(), GetDisplayVisibleRect(), GetPIPRect(), GetVisibleOSDBounds(), Init(), MoveResize(), ResizeDisplayWindow(), SetDisplayVisibleRect(), and StopEmbedding().

Used to save the display_visible_rect for restoration after video embedding ends.

Definition at line 160 of file videooutwindow.h.

Referenced by GetTmpDisplayVisibleRect(), ResizeDisplayWindow(), and StopEmbedding().

Embedded video rectangle.

Definition at line 162 of file videooutwindow.h.

Referenced by EmbedInWidget(), GetEmbeddingRect(), and StopEmbedding().

State variables.

Definition at line 165 of file videooutwindow.h.

Referenced by EmbedInWidget(), Init(), IsEmbedding(), and StopEmbedding().

Definition at line 166 of file videooutwindow.h.

Referenced by IsRepaintNeeded(), MoveResize(), and SetNeedRepaint().

Definition at line 167 of file videooutwindow.h.

Referenced by EmbedInWidget(), IsPreviewEPGAllowed(), and SetAllowPreviewEPG().

const float VideoOutWindow::kManualZoomMaxHorizontalZoom = 2.0f [static, private]

Definition at line 171 of file videooutwindow.h.

Referenced by Zoom().

const float VideoOutWindow::kManualZoomMaxVerticalZoom = 2.0f [static, private]

Definition at line 172 of file videooutwindow.h.

Referenced by Zoom().

const float VideoOutWindow::kManualZoomMinHorizontalZoom = 0.5f [static, private]

Definition at line 173 of file videooutwindow.h.

Referenced by Zoom().

const float VideoOutWindow::kManualZoomMinVerticalZoom = 0.5f [static, private]

Definition at line 174 of file videooutwindow.h.

Referenced by Zoom().

const int VideoOutWindow::kManualZoomMaxMove = 50 [static, private]

Definition at line 175 of file videooutwindow.h.

Referenced by Zoom().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Fri May 25 06:42:31 2012 for MythTV by  doxygen 1.6.3