Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MythTV/mythtv
Browse files Browse the repository at this point in the history
  • Loading branch information
tralph committed Dec 13, 2010
2 parents 176caa5 + 143541d commit 74da78d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 53 deletions.
22 changes: 1 addition & 21 deletions mythtv/libs/libmythtv/playercontext.cpp
Expand Up @@ -38,7 +38,7 @@ PlayerContext::PlayerContext(const QString &inUseID) :
recUsage(inUseID), player(NULL), playerUnsafe(false), recorder(NULL),
tvchain(NULL), buffer(NULL), playingInfo(NULL),
playingLen(0), specialDecode(kAVSpecialDecode_None),
nohardwaredecoders(false), last_cardid(-1), last_framerate(30.0f),
nohardwaredecoders(false), last_cardid(-1),
// Fast forward state
ff_rew_state(0), ff_rew_index(0), ff_rew_speed(0),
// Other state
Expand Down Expand Up @@ -534,26 +534,6 @@ void PlayerContext::DeletePlayerThread(void)
}
}

/** \fn PlayerContext::StartOSD(TV *tv)
* \brief Initializes the on screen display.
*
* If the MythPlayer already exists we grab it's OSD via
* MythPlayer::GetOSD().
*/
bool PlayerContext::StartOSD(TV *tv)
{
QMutexLocker locker(&deletePlayerLock);
if (player)
{
last_framerate = player->GetFrameRate();

OSD *osd = player->GetOSD();
if (osd)
return true;
}
return false;
}

void PlayerContext::UpdateTVChain(void)
{
QMutexLocker locker(&deletePlayerLock);
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythtv/playercontext.h
Expand Up @@ -74,7 +74,6 @@ class MPUBLIC PlayerContext
bool StartPlaying(int maxWait = -1);
void StopPlaying(void);
void DeletePlayerThread(void);
bool StartOSD(TV *tv);
void UpdateTVChain(void);
bool ReloadTVChain(void);
void CreatePIPWindow(const QRect&, int pos = -1,
Expand Down Expand Up @@ -176,7 +175,6 @@ class MPUBLIC PlayerContext
AVSpecialDecode specialDecode;
bool nohardwaredecoders; // < Disable use of VDPAU decoding
int last_cardid; ///< CardID of current/last recorder
float last_framerate; ///< Estimated framerate from recorder
/// 0 == normal, +1 == fast forward, -1 == rewind
int ff_rew_state;
/// Index into ff_rew_speeds for FF and Rewind speeds
Expand Down
53 changes: 23 additions & 30 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -2044,8 +2044,6 @@ void TV::HandleStateChange(PlayerContext *mctx, PlayerContext *ctx)

if (ctx->playingInfo && StartRecorder(ctx,-1))
{
// Cache starting frame rate for this recorder
ctx->last_framerate = ctx->recorder->GetFrameRate();
ok = StartPlayer(mctx, ctx, desiredNextState);
}
if (!ok)
Expand Down Expand Up @@ -4161,26 +4159,19 @@ bool TV::ActiveHandleAction(PlayerContext *ctx,
ctx->LockDeletePlayer(__FILE__, __LINE__);
long long bookmark = ctx->player->GetBookmark();
long long curloc = ctx->player->GetFramesPlayed();
float mult = 1.0f;
if (ctx->last_framerate)
mult = 1.0f / ctx->last_framerate;
long long seekloc = (long long) ((bookmark - curloc) * mult);
float rate = ctx->player->GetFrameRate();
long long seekloc = (long long) ((bookmark - curloc) / rate);
ctx->UnlockDeletePlayer(__FILE__, __LINE__);

if (bookmark > ctx->last_framerate)
{
if (bookmark > rate)
DoSeek(ctx, seekloc, tr("Jump to Bookmark"));
}
}
else if (has_action("JUMPSTART",actions))
{
long long seekloc = +1;
ctx->LockDeletePlayer(__FILE__, __LINE__);
if (ctx->player && ctx->last_framerate >= 0.0001f)
{
seekloc = (int64_t) (-1.0 * ctx->player->GetFramesPlayed() /
ctx->last_framerate);
}
seekloc = (int64_t) (-1.0 * ctx->player->GetFramesPlayed() /
ctx->player->GetFrameRate());
ctx->UnlockDeletePlayer(__FILE__, __LINE__);

if (seekloc <= 0)
Expand Down Expand Up @@ -4781,11 +4772,11 @@ void TV::ProcessNetworkControlCommand(PlayerContext *ctx,
else if (tokens[2] == "BACKWARD")
DoSeek(ctx, -ctx->rewtime, tr("Skip Back"));
else if ((tokens[2] == "POSITION") && (tokens.size() == 4) &&
(tokens[3].contains(QRegExp("^\\d+$"))) &&
ctx->last_framerate)
(tokens[3].contains(QRegExp("^\\d+$"))))
{
long long rel_frame = tokens[3].toInt();
rel_frame -= (long long) (fplay * (1.0 / ctx->last_framerate)),
rel_frame -= (long long) (fplay * (1.0 /
ctx->player->GetFrameRate()));
DoSeek(ctx, rel_frame, tr("Jump To"));
}
}
Expand Down Expand Up @@ -4865,8 +4856,12 @@ void TV::ProcessNetworkControlCommand(PlayerContext *ctx,

ctx->LockDeletePlayer(__FILE__, __LINE__);
long long fplay = 0;
float rate = 30.0f;
if (ctx->player)
{
fplay = ctx->player->GetFramesPlayed();
rate = ctx->player->GetFrameRate();
}
ctx->UnlockDeletePlayer(__FILE__, __LINE__);

ctx->LockPlayingInfo(__FILE__, __LINE__);
Expand Down Expand Up @@ -4899,7 +4894,7 @@ void TV::ProcessNetworkControlCommand(PlayerContext *ctx,
.arg(respDate.toString(Qt::ISODate))
.arg(fplay)
.arg(ctx->buffer->GetFilename())
.arg(ctx->last_framerate);
.arg(rate);
}
else
{
Expand All @@ -4909,7 +4904,7 @@ void TV::ProcessNetworkControlCommand(PlayerContext *ctx,
.arg(speedStr)
.arg(ctx->buffer->GetFilename())
.arg(fplay)
.arg(ctx->last_framerate);
.arg(rate);
}

ctx->UnlockPlayingInfo(__FILE__, __LINE__);
Expand Down Expand Up @@ -4998,7 +4993,6 @@ bool TV::CreatePBP(PlayerContext *ctx, const ProgramInfo *info)
if (ok)
{
ScheduleStateChange(mctx);
mctx->StartOSD(this);
mctx->LockDeletePlayer(__FILE__, __LINE__);
if (mctx->player)
mctx->player->JumpToFrame(mctx_frame);
Expand Down Expand Up @@ -5125,10 +5119,7 @@ bool TV::StartPlayer(PlayerContext *mctx, PlayerContext *ctx,
}

if (ok)
{
ctx->StartOSD(this);
SetSpeedChangeTimer(25, __LINE__);
}

VERBOSE(VB_PLAYBACK, LOC + QString("StartPlayer(%1, %2, %3) -- end %4")
.arg(find_player_index(ctx)).arg(StateToString(desiredState))
Expand Down Expand Up @@ -5499,7 +5490,6 @@ void TV::PBPRestartMainPlayer(PlayerContext *mctx)
mctx->embedWinID, &mctx->embedBounds))
{
ScheduleStateChange(mctx);
mctx->StartOSD(this);
mctx->LockDeletePlayer(__FILE__, __LINE__);
if (mctx->player)
mctx->player->JumpToFrame(mctx_frame);
Expand Down Expand Up @@ -5832,8 +5822,14 @@ bool TV::SeekHandleAction(PlayerContext *actx, const QStringList &actions,
{
if (!isDVD)
{
float rate = 30.0f;
actx->LockDeletePlayer(__FILE__, __LINE__);
if (actx->player)
rate = actx->player->GetFrameRate();
actx->UnlockDeletePlayer(__FILE__, __LINE__);

float time = (flags & kAbsolute) ? direction :
direction * (1.001 / actx->last_framerate);
direction * (1.001 / rate);
QString message = (flags & kRewind) ? QString(tr("Rewind")) :
QString(tr("Forward"));
DoSeek(actx, time, message);
Expand Down Expand Up @@ -5902,10 +5898,10 @@ void TV::DoArbSeek(PlayerContext *ctx, ArbSeekWhence whence)
}
if (whence == ARBSEEK_END)
time = (ctx->player->CalcMaxFFTime(LONG_MAX, false) /
ctx->last_framerate) - time;
ctx->player->GetFrameRate()) - time;
else
time = time - (ctx->player->GetFramesPlayed() - 1) /
ctx->last_framerate;
ctx->player->GetFrameRate();
ctx->UnlockDeletePlayer(__FILE__, __LINE__);
DoSeek(ctx, time, tr("Jump To"));
}
Expand Down Expand Up @@ -6533,8 +6529,6 @@ void TV::SwitchCards(PlayerContext *ctx,
bool ok = false;
if (ctx->playingInfo && StartRecorder(ctx,-1))
{
// Cache starting frame rate for this recorder
ctx->last_framerate = ctx->recorder->GetFrameRate();
PlayerContext *mctx = GetPlayer(ctx, 0);

if (ctx->CreatePlayer(
Expand All @@ -6543,7 +6537,6 @@ void TV::SwitchCards(PlayerContext *ctx,
{
ScheduleStateChange(ctx);
ok = true;
ctx->StartOSD(this);
ctx->PushPreviousChannel();
for (uint i = 1; i < player.size(); i++)
PIPAddPlayer(mctx, GetPlayer(ctx, i));
Expand Down

0 comments on commit 74da78d

Please sign in to comment.