Skip to content

Commit

Permalink
VideoOutpuut: Add 2 new video fill modes.
Browse files Browse the repository at this point in the history
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
Mark Kendall committed Apr 12, 2011
1 parent 2b3de68 commit 53bc658
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mythtv/libs/libmythtv/videoouttypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions mythtv/libs/libmythtv/videooutwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 53bc658

Please sign in to comment.