Go to the documentation of this file.
27 #include <QApplication>
30 #include "libmythbase/mythconfig.h"
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) }; }
46 static float snap(
float value,
float snapto,
float diff);
78 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Already have a display");
118 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window using all screens %1x%2")
119 .arg(screen->virtualGeometry().width()).arg(screen->virtualGeometry().height()));
123 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window using screen '%1' %2x%3")
124 .arg(screen->name()).arg(screen->geometry().width()).arg(screen->geometry().height()));
251 float tmp = 1.0F - 2.0F * vscanf;
298 float tmp = 1.0F - 2.0F * hscanf;
329 QPoint chgloc = QPoint(
tmp.width(),
tmp.height());
354 bool aspects_match = abs(aspect_diff / disp_aspect) <= 0.02F;
357 bool nomatch_without_fill = (!aspects_match) && !nomatch_with_fill;
366 else if (nomatch_with_fill)
378 else if (nomatch_without_fill)
453 float Aspect, QRect WindowRect)
482 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Window Rect: %1x%2+%3+%4")
485 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Display Rect: %1x%2+%3+%4 Aspect: %5")
489 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Video Rect: %1x%2+%3+%4 Aspect: %5")
517 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New video aspect ratio: '%1'")
518 .arg(
static_cast<double>(Aspect)));
530 QSize newvideodispdim =
Fix1088(VideoDispDim);
538 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
539 QString(
"New video parameters: Size %1x%2 DisplaySize: %3x%4 Aspect: %5")
549 QSize result = Dimensions;
551 if (result.width() == 1920 || result.width() == 1440)
553 if (result.height() == 1088)
554 result.setHeight(1080);
555 else if (result.height() == 544)
556 result.setHeight(540);
599 if (!(qFuzzyCompare(oldvert + 100.0F,
m_dbVertScale + 100.0F) &&
602 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Over/underscan. V: %1, H: %2")
612 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"New display aspect: %1")
613 .arg(
static_cast<double>(DisplayAspect)));
624 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New window rect: %1x%2+%3+%4")
625 .arg(rect.width()).arg(rect.height()).arg(rect.left()).arg(rect.top()));
649 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New ITV display rect: %1x%2+%3+%4 (Scale: %5)")
665 if ((Rotation < -180) || (Rotation > 180))
669 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New rotation: %1").arg(
m_rotation));
697 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New embedding rect: %1x%2+%3+%4 (Scale: %5)")
707 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Stopped embedding");
730 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New video aspect override: '%1'")
759 return visible.subtracted(video);
772 const float zf = 0.02F;
850 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New zoom: Offset %1x%2 HScale %3 VScale %4")
874 const float zf = 0.02F;
887 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"New custom zoom: Offset %1x%2 HScale %3 VScale %4")
911 if (fabs(raw - 1.333333F) < 0.05F)
915 if (fabs(raw - 1.777777F) < 0.05F)
921 static float snap(
float value,
float snapto,
float diff)
923 if ((value + diff > snapto) && (value - diff < snapto))
QString StereoscopictoString(StereoscopicMode Mode)
static const float kManualZoomMaxVerticalZoom
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
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.
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)
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.
static QRect SCALED_RECT(QRect src, qreal scale)
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)