Go to the documentation of this file.
24 #include <QApplication>
27 #include "mythconfig.h"
37 #define LOC QString("VideoBounds: ")
39 #define SCALED_RECT(SRC, SCALE) QRect{ static_cast<int>((SRC).left() * (SCALE)), \
40 static_cast<int>((SRC).top() * (SCALE)), \
41 static_cast<int>((SRC).width() * (SCALE)), \
42 static_cast<int>((SRC).height() * (SCALE)) }
45 static float snap(
float value,
float snapto,
float diff);
77 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Already have a display");
117 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window using all screens %1x%2")
118 .
arg(screen->virtualGeometry().width()).arg(screen->virtualGeometry().height()));
122 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window using screen '%1' %2x%3")
123 .
arg(screen->name()).arg(screen->geometry().width()).arg(screen->geometry().height()));
250 float tmp = 1.0F - 2.0F * vscanf;
297 float tmp = 1.0F - 2.0F * hscanf;
328 QPoint chgloc = QPoint(
tmp.width(),
tmp.height());
353 bool aspects_match = abs(aspect_diff / disp_aspect) <= 0.02F;
356 bool nomatch_without_fill = (!aspects_match) && !nomatch_with_fill;
365 else if (nomatch_with_fill)
377 else if (nomatch_without_fill)
452 float Aspect, QRect WindowRect)
481 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window Rect: %1x%2+%3+%4")
484 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Display Rect: %1x%2+%3+%4 Aspect: %5")
488 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Video Rect: %1x%2+%3+%4 Aspect: %5")
516 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New video aspect ratio: '%1'")
517 .
arg(
static_cast<double>(Aspect)));
529 QSize newvideodispdim =
Fix1088(VideoDispDim);
537 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
538 QString(
"New video parameters: Size %1x%2 DisplaySize: %3x%4 Aspect: %5")
548 QSize result = Dimensions;
550 if (result.width() == 1920 || result.width() == 1440)
552 if (result.height() == 1088)
553 result.setHeight(1080);
554 else if (result.height() == 544)
555 result.setHeight(540);
598 if (!(qFuzzyCompare(oldvert + 100.0F,
m_dbVertScale + 100.0F) &&
601 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Over/underscan. V: %1, H: %2")
611 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"New display aspect: %1")
612 .
arg(
static_cast<double>(DisplayAspect)));
623 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New window rect: %1x%2+%3+%4")
624 .
arg(rect.width()).arg(rect.height()).arg(rect.left()).arg(rect.top()));
648 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New ITV display rect: %1x%2+%3+%4 (Scale: %5)")
664 if ((Rotation < -180) || (Rotation > 180))
696 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New embedding rect: %1x%2+%3+%4 (Scale: %5)")
706 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Stopped embedding");
729 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New video aspect override: '%1'")
758 return visible.subtracted(
video);
771 const float zf = 0.02F;
849 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New zoom: Offset %1x%2 HScale %3 VScale %4")
873 const float zf = 0.02F;
886 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New custom zoom: Offset %1x%2 HScale %3 VScale %4")
910 if (fabs(raw - 1.333333F) < 0.05F)
914 if (fabs(raw - 1.777777F) < 0.05F)
920 static float snap(
float value,
float snapto,
float diff)
922 if ((value + diff > snapto) && (value - diff < snapto))
QString StereoscopictoString(StereoscopicMode Mode)
static const float kManualZoomMaxVerticalZoom
bool IsEmbedding(void) const
void VideoAspectRatioChanged(float Aspect)
Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
void PhysicalDPIChanged(qreal)
QRect m_rawWindowRect
Rectangle describing QWidget bounds - not adjusted for high DPI scaling (macos)
QRect m_displayVideoRect
Pixel rectangle in display window into which video_rect maps to.
QRect m_tmpDisplayVisibleRect
Used to save the display_visible_rect for restoration after video embedding ends.
@ kAdjustFill_HorizontalStretch
float m_dbVertScale
Vertical Overscan/Underscan percentage.
virtual void EmbedPlayback(bool Embed, QRect Rect)
QString GetZoomString(float HorizScale, float VertScale, QPoint Move)
static HostComboBoxSetting * AdjustFill()
void ApplyDBScaleAndMove(void)
Apply scales and moves for "Overscan" and "Underscan" DB settings.
float GetDisplayAspect(void) const
void RefreshVideoBoundsState()
Send out latest state to listeners.
float m_videoAspect
Physical aspect ratio of video.
arg(title).arg(filename).arg(doDelete))
QRect m_rawItvDisplayVideoRect
@ kAdjustFill_VerticalStretch
double GetAspectRatio(QString &Source, bool IgnoreModeOverride=false)
Returns current screen aspect ratio.
static bool SpanAllScreens()
Return true if the MythTV windows should span all screens.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void VideoRectsChanged(const QRect &DisplayVideoRect, const QRect &VideoRect)
QScreen * GetCurrentScreen()
Return a pointer to the screen to use.
bool m_dbScalingAllowed
disable this to prevent overscan/underscan
void PrintMoveResizeDebug(void)
void PhysicalDPIChanged(qreal DPI)
void UpdateOSDMessage(const QString &Message)
float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
void CurrentScreenChanged(QScreen *qScreen)
void SaveBottomLine(void)
bool m_embedding
State variables.
AspectOverrideMode m_dbAspectOverride
static const int kManualZoomMaxMove
void SetDisplayAspect(float DisplayAspect)
QString toString(MarkTypes type)
AdjustFillMode m_adjustFill
Zoom mode.
void SetDisplay(MythDisplay *mDisplay)
void ResizeDisplayWindow(QRect Rect, bool SaveVisibleRect)
Resize Display Window.
void VisibleRectChanged(const QRect &DisplayVisibleRect)
float m_dbHorizScale
Horizontal Overscan/Underscan percentage.
static const float kManualZoomMaxHorizontalZoom
void SourceChanged(QSize VideoDim, QSize VideoDispDim, float Aspect)
Update for new source video dimensions and aspect ratio.
static float fix_aspect(float raw)
Correct for rounding errors.
void SetStereoOverride(StereoscopicMode Mode)
static QSize Fix1088(QSize Dimensions)
static int GetScreenCount()
void ToggleAspectOverride(AspectOverrideMode AspectMode=kAspect_Toggle)
Enforce different aspect ratio than detected, then calls VideoAspectRatioChanged(float) to apply them...
void PopulateGeometry(void)
QRect m_windowRect
Rectangle describing QWidget bounds.
AspectOverrideMode m_videoAspectOverrideMode
AspectOverrideMode to use to modify overriden_video_aspect.
AdjustFillMode m_dbAdjustFill
float m_videoAspectOverride
Normally this is the same as videoAspect, but may not be if the user has toggled the aspect override ...
float m_manualHorizScale
Manually applied horizontal scaling.
QRect m_displayVisibleRect
Visible portion of display window in pixels.
void ApplyLetterboxing(void)
void ToggleAdjustFill(AdjustFillMode AdjustFillMode=kAdjustFill_Toggle)
Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize()...
void SetRotation(int Rotation)
Set the rotation in degrees.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void VideoSizeChanged(const QSize &VideoDim, const QSize &VideoDispDim)
static const float kManualZoomMinVerticalZoom
int GetNumSetting(const QString &key, int defaultval=0)
@ kAdjustFill_VerticalFill
void ToggleMoveBottomLine(void)
@ kAdjustFill_HorizontalFill
bool GetBoolSetting(const QString &key, bool defaultval=false)
void SetITVResize(QRect Rect)
void MoveResize(void)
performs all the calculations for video framing and any resizing.
QRegion GetBoundingRegion(void) const
Return the region of DisplayVisibleRect that lies outside of DisplayVideoRect.
void Zoom(ZoomDirection Direction)
Sets up zooming into to different parts of the video.
QRect m_itvDisplayVideoRect
void SetVideoAspectRatio(float Aspect)
Sets MythVideoBounds::video_aspect to aspect, and sets MythVideoBounds::overriden_video_aspect if asp...
void ScreenChanged(QScreen *screen)
static const float kManualZoomMinHorizontalZoom
bool InitBounds(QSize VideoDim, QSize VideoDispDim, float Aspect, QRect WindowRect)
void SetVideoScalingAllowed(bool Change)
Disable or enable underscan/overscan.
QPoint m_manualMove
Manually applied percentage move.
QSize m_videoDim
Pixel dimensions of video buffer.
void Rotate(void)
Adjust various settings to facilitate portrait mode calculations.
void ApplyManualScaleAndMove(void)
Apply scales and moves from "Zoom Mode" settings.
static float snap(float value, float snapto, float diff)
void WindowRectChanged(const QRect &WindowRect)
QRect m_embeddingRect
Embedded video rectangle.
void SaveSetting(const QString &key, int newValue)
QRect m_videoRect
Pixel rectangle in video frame to display.
bool VideoIsFullScreen(void) const
Check whether the video display rect covers the entire window/framebuffer.
void VideoBoundsStateChanged(MythVideoBoundsState VideoState)
StereoscopicMode m_stereoOverride
QPoint m_dbMove
Percentage move from database.
float m_manualVertScale
Manually applied vertical scaling.
QSize m_videoDispDim
Pixel dimensions of video display area.
float m_displayAspect
Physical aspect ratio of playback window.
void SetWindowSize(QSize Size)
#define SCALED_RECT(SRC, SCALE)