27#include <QApplication>
37#define LOC QString("VideoBounds: ")
40{
return {
static_cast<int>(src.left() * scale),
41 static_cast<int>(src.top() * scale),
42 static_cast<int>(src.width() * scale),
43 static_cast<int>(src.height() * scale) }; }
46static float snap(
float value,
float snapto,
float diff);
78 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Already have a display");
111 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window using all screens %1x%2")
112 .arg(screen->virtualGeometry().width()).arg(screen->virtualGeometry().height()));
116 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window using screen '%1' %2x%3")
117 .arg(screen->name()).arg(screen->geometry().width()).arg(screen->geometry().height()));
244 float tmp = 1.0F - (2.0F * vscanf);
291 float tmp = 1.0F - (2.0F * hscanf);
322 QPoint chgloc = QPoint(tmp.width(), tmp.height());
347 bool aspects_match = abs(aspect_diff / disp_aspect) <= 0.02F;
350 bool nomatch_without_fill = (!aspects_match) && !nomatch_with_fill;
359 else if (nomatch_with_fill)
371 else if (nomatch_without_fill)
446 float Aspect, QRect WindowRect)
475 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window Rect: %1x%2+%3+%4")
478 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Display Rect: %1x%2+%3+%4 Aspect: %5")
482 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Video Rect: %1x%2+%3+%4 Aspect: %5")
510 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New video aspect ratio: '%1'")
511 .arg(
static_cast<double>(Aspect)));
523 QSize newvideodispdim =
Fix1088(VideoDispDim);
531 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
532 QString(
"New video parameters: Size %1x%2 DisplaySize: %3x%4 Aspect: %5")
542 QSize result = Dimensions;
544 if (result.width() == 1920 || result.width() == 1440)
546 if (result.height() == 1088)
547 result.setHeight(1080);
548 else if (result.height() == 544)
549 result.setHeight(540);
592 if (!(qFuzzyCompare(oldvert + 100.0F,
m_dbVertScale + 100.0F) &&
595 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Over/underscan. V: %1, H: %2")
605 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"New display aspect: %1")
606 .arg(
static_cast<double>(DisplayAspect)));
617 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New window rect: %1x%2+%3+%4")
618 .arg(rect.width()).arg(rect.height()).arg(rect.left()).arg(rect.top()));
642 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New ITV display rect: %1x%2+%3+%4 (Scale: %5)")
658 if ((Rotation < -180) || (Rotation > 180))
662 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New rotation: %1").arg(
m_rotation));
690 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New embedding rect: %1x%2+%3+%4 (Scale: %5)")
700 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Stopped embedding");
723 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New video aspect override: '%1'")
752 return visible.subtracted(video);
765 const float zf = 0.02F;
851 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New zoom: Offset %1x%2 HScale %3 VScale %4")
875 const float zf = 0.02F;
888 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New custom zoom: Offset %1x%2 HScale %3 VScale %4")
912 if (fabs(raw - 1.333333F) < 0.05F)
916 if (fabs(raw - 1.777777F) < 0.05F)
922static float snap(
float value,
float snapto,
float diff)
924 if ((value + diff > snapto) && (value - diff < snapto))
void SaveSetting(const QString &key, int newValue)
int GetNumSetting(const QString &key, int defaultval=0)
bool GetBoolSetting(const QString &key, bool defaultval=false)
double GetAspectRatio(QString &Source, bool IgnoreModeOverride=false)
Returns current screen aspect ratio.
QScreen * GetCurrentScreen()
Return a pointer to the screen to use.
static bool SpanAllScreens()
Return true if the MythTV windows should span all screens.
static int GetScreenCount()
void RefreshVideoBoundsState()
Send out latest state to listeners.
void SetITVResize(QRect Rect)
void SetRotation(int Rotation)
Set the rotation in degrees.
void Rotate(void)
Adjust various settings to facilitate portrait mode calculations.
bool IsEmbedding(void) const
QSize m_videoDispDim
Pixel dimensions of video display area.
static const float kManualZoomMaxHorizontalZoom
virtual void EmbedPlayback(bool Embed, QRect Rect)
float m_manualHorizScale
Manually applied horizontal scaling.
float m_dbVertScale
Vertical Overscan/Underscan percentage.
QSize m_videoDim
Pixel dimensions of video buffer.
float m_dbHorizScale
Horizontal Overscan/Underscan percentage.
QRect m_displayVideoRect
Pixel rectangle in display window into which video_rect maps to.
void VideoRectsChanged(const QRect &DisplayVideoRect, const QRect &VideoRect)
void SaveBottomLine(void)
static const float kManualZoomMinVerticalZoom
void MoveResize(void)
performs all the calculations for video framing and any resizing.
static QSize Fix1088(QSize Dimensions)
static const float kManualZoomMaxVerticalZoom
QRect m_windowRect
Rectangle describing QWidget bounds.
AspectOverrideMode m_dbAspectOverride
void UpdateOSDMessage(const QString &Message)
void VideoBoundsStateChanged(MythVideoBoundsState VideoState)
QRect m_videoRect
Pixel rectangle in video frame to display.
void SourceChanged(QSize VideoDim, QSize VideoDispDim, float Aspect)
Update for new source video dimensions and aspect ratio.
bool m_embedding
State variables.
void WindowRectChanged(const QRect &WindowRect)
void VisibleRectChanged(const QRect &DisplayVisibleRect)
void ToggleAdjustFill(AdjustFillMode AdjustFillMode=kAdjustFill_Toggle)
Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize()...
float m_videoAspectOverride
Normally this is the same as videoAspect, but may not be if the user has toggled the aspect override ...
void SetDisplayAspect(float DisplayAspect)
bool VideoIsFullScreen(void) const
Check whether the video display rect covers the entire window/framebuffer.
void SetVideoScalingAllowed(bool Change)
Disable or enable underscan/overscan.
QRect m_tmpDisplayVisibleRect
Used to save the display_visible_rect for restoration after video embedding ends.
void ToggleAspectOverride(AspectOverrideMode AspectMode=kAspect_Toggle)
Enforce different aspect ratio than detected, then calls VideoAspectRatioChanged(float) to apply them...
void ApplyLetterboxing(void)
AspectOverrideMode m_videoAspectOverrideMode
AspectOverrideMode to use to modify overriden_video_aspect.
void SetVideoAspectRatio(float Aspect)
Sets MythVideoBounds::video_aspect to aspect, and sets MythVideoBounds::overriden_video_aspect if asp...
float m_videoAspect
Physical aspect ratio of video.
void ApplyManualScaleAndMove(void)
Apply scales and moves from "Zoom Mode" settings.
void ToggleMoveBottomLine(void)
void PopulateGeometry(void)
QRegion GetBoundingRegion(void) const
Return the region of DisplayVisibleRect that lies outside of DisplayVideoRect.
float m_displayAspect
Physical aspect ratio of playback window.
AdjustFillMode m_adjustFill
Zoom mode.
float m_manualVertScale
Manually applied vertical scaling.
bool InitBounds(QSize VideoDim, QSize VideoDispDim, float Aspect, QRect WindowRect)
QRect m_rawWindowRect
Rectangle describing QWidget bounds - not adjusted for high DPI scaling (macos)
static const int kManualZoomMaxMove
QRect m_rawItvDisplayVideoRect
void SetDisplay(MythDisplay *mDisplay)
QPoint m_manualMove
Manually applied percentage move.
void SetWindowSize(QSize Size)
void VideoAspectRatioChanged(float Aspect)
Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
QRect m_itvDisplayVideoRect
void ResizeDisplayWindow(QRect Rect, bool SaveVisibleRect)
Resize Display Window.
void Zoom(ZoomDirection Direction)
Sets up zooming into to different parts of the video.
StereoscopicMode m_stereoOverride
void PrintMoveResizeDebug(void)
bool m_dbScalingAllowed
disable this to prevent overscan/underscan
void SetStereoOverride(StereoscopicMode Mode)
void ApplyDBScaleAndMove(void)
Apply scales and moves for "Overscan" and "Underscan" DB settings.
void VideoSizeChanged(const QSize &VideoDim, const QSize &VideoDispDim)
float GetDisplayAspect(void) const
QRect m_displayVisibleRect
Visible portion of display window in pixels.
QRect m_embeddingRect
Embedded video rectangle.
static const float kManualZoomMinHorizontalZoom
AdjustFillMode m_dbAdjustFill
QPoint m_dbMove
Percentage move from database.
static HostComboBoxSetting * AdjustFill()
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static float snap(float value, float snapto, float diff)
static QRect SCALED_RECT(QRect src, qreal scale)
static float fix_aspect(float raw)
Correct for rounding errors.
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
QString GetZoomString(float HorizScale, float VertScale, QPoint Move)
float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
@ kAdjustFill_HorizontalFill
@ kAdjustFill_VerticalFill
@ kAdjustFill_VerticalStretch
@ kAdjustFill_HorizontalStretch
QString StereoscopictoString(StereoscopicMode Mode)