Permalink
Browse files

VideoOutpuut: Add 2 new video fill modes.

These fill the screen either horizontally or vertically with cropping
top and bottom or left and right respectively.

These will be no-ops when no adjustment is required and are useful for
making full use of all the available screen space.

The existing fill stretch modes cater to incorrectly encoded video (and
I believe should be removed, as they should be handled with a
combination of aspect and fill adjustment) and the half and full fill
modes are 'hard coded', both in terms of the amount of fill applied and
when it is applied (i.e. all of the time).

Closes #9035.
  • Loading branch information...
1 parent 2b3de68 commit 53bc658e860326209310a35d7ff803b60a8eaac9 Mark Kendall committed Apr 12, 2011
Showing with 26 additions and 0 deletions.
  1. +6 −0 mythtv/libs/libmythtv/videoouttypes.h
  2. +20 −0 mythtv/libs/libmythtv/videooutwindow.cpp
@@ -57,6 +57,8 @@ typedef enum AdjustFillMode
kAdjustFill_Full,
kAdjustFill_HorizontalStretch,
kAdjustFill_VerticalStretch,
+ kAdjustFill_HorizontalFill,
+ kAdjustFill_VerticalFill,
kAdjustFill_END,
kAdjustFill_AutoDetect_DefaultOff,
kAdjustFill_AutoDetect_DefaultHalf,
@@ -253,6 +255,10 @@ inline QString toString(AdjustFillMode aspectmode)
ret = QObject::tr("H.Stretch"); break;
case kAdjustFill_VerticalStretch:
ret = QObject::tr("V.Stretch"); break;
+ case kAdjustFill_VerticalFill:
+ ret = QObject::tr("V.Fill"); break;
+ case kAdjustFill_HorizontalFill:
+ ret = QObject::tr("H.Fill"); break;
case kAdjustFill_Toggle:
case kAdjustFill_Off:
case kAdjustFill_END: break;
@@ -402,6 +402,26 @@ void VideoOutWindow::ApplyLetterboxing(void)
display_video_rect.setHeight(display_video_rect.height() * 4 / 3);
}
+ else if (adjustfill == kAdjustFill_VerticalFill &&
+ display_video_rect.height() > 0)
+ {
+ // Video fills screen vertically. May be cropped left and right
+ float factor = (float)display_visible_rect.height() /
+ (float)display_video_rect.height();
+ display_video_rect.moveTop(display_visible_rect.top());
+ display_video_rect.setHeight(display_video_rect.height() * factor);
+ display_video_rect.setWidth(display_video_rect.width() * factor);
+ }
+ else if (adjustfill == kAdjustFill_HorizontalFill &&
+ display_video_rect.width() > 0)
+ {
+ // Video fills screen horizontally. May be cropped top and bottom
+ float factor = (float)display_visible_rect.width() /
+ (float)display_video_rect.width();
+ display_video_rect.moveLeft(display_visible_rect.left());
+ display_video_rect.setHeight(display_video_rect.height() * factor);
+ display_video_rect.setWidth(display_video_rect.width() * factor);
+ }
}
/** \fn VideoOutWindow::ApplySnapToVideoRect(void)

0 comments on commit 53bc658

Please sign in to comment.