Permalink
Browse files

Allow SetVideoParams to update either the dimensions or the framerate…

… (or both) instead of requiring all parameters to be valid. This allows (for example) the frame rate to be updated when there is no video

(Specifically, audio-only recordings without a seektable played on a PAL setup would show the wrong duration as the default 29.97 fps was not being set to 25fps)

Refs #11357
  • Loading branch information...
peper03 committed Jul 18, 2013
1 parent 1f086d7 commit 555d030ebb83ead5d753d74b31dfce426058c827
Showing with 17 additions and 7 deletions.
  1. +17 −7 mythtv/libs/libmythtv/mythplayer.cpp
@@ -810,16 +810,19 @@ void MythPlayer::SetScanType(FrameScanType scan)
void MythPlayer::SetVideoParams(int width, int height, double fps,
FrameScanType scan)
{
if (width < 1 || height < 1 || qIsNaN(fps))
return;
bool paramsChanged = false;
video_dim = QSize((width + 15) & ~0xf, (height + 15) & ~0xf);
video_disp_dim = QSize(width, height);
if (height)
video_aspect = (float)width / height;
if (width >= 1 && height >= 1)
{
paramsChanged = true;
video_dim = QSize((width + 15) & ~0xf, (height + 15) & ~0xf);
video_disp_dim = QSize(width, height);
video_aspect = (float)width / height;
}
if (fps > 0.0f && fps < 121.0f)
if (!qIsNaN(fps) && fps > 0.0f && fps < 121.0f)
{
paramsChanged = true;
video_frame_rate = fps;
if (ffrew_skip != 0 && ffrew_skip != 1)
{
@@ -835,6 +838,9 @@ void MythPlayer::SetVideoParams(int width, int height, double fps,
}
}
if (!paramsChanged)
return;
if (videoOutput)
ReinitVideo();
@@ -4710,6 +4716,10 @@ int MythPlayer::GetSecondsBehind(void) const
int64_t MythPlayer::GetSecondsPlayed(bool honorCutList, int divisor) const
{
int64_t pos = TranslatePositionFrameToMs(framesPlayed, honorCutList);
LOG(VB_PLAYBACK, LOG_DEBUG, LOC +
QString("GetSecondsPlayed: framesPlayed %1, honorCutList %2, divisor %3, pos %4")
.arg(framesPlayed).arg(honorCutList).arg(divisor).arg(pos));
return TranslatePositionFrameToMs(framesPlayed, honorCutList) / divisor;
}

0 comments on commit 555d030

Please sign in to comment.