Skip to content

Commit

Permalink
Fix minor problems editing in-progress recordings.
Browse files Browse the repository at this point in the history
Revert 5d7c01d, and add logic that also updates the edit bar when
the total number of frames in the recording changes.

Modify 1ce3d21 to use a better test for an in-progress recording.
If the recording finishes during the editing session, the original
test would continue to indicate that the recording was in-progress.

Binary version is updated.  Refs #10329.
  • Loading branch information
stichnot committed Feb 25, 2012
1 parent 006ded1 commit f77d001
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.25.20120225-1"
#define MYTH_BINARY_VERSION "0.25.20120225-2"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
6 changes: 4 additions & 2 deletions mythtv/libs/libmythtv/deletemap.cpp
Expand Up @@ -5,6 +5,7 @@
#include "mythcontext.h"
#include "osd.h"
#include "deletemap.h"
#include "mythplayer.h"

#define LOC QString("DelMap: ")
#define EDIT_CHECK do { \
Expand Down Expand Up @@ -92,7 +93,7 @@ bool DeleteMap::HandleAction(QString &action, uint64_t frame,
Add(frame, total, MARK_CUT_START, QObject::tr("Cut to End"));
// If the recording is still in progress, add an explicit end
// mark at the end.
if (m_ctx->playingInfo->GetRecordingStatus() == rsRecording)
if (m_ctx->player && m_ctx->player->IsWatchingInprogress())
Add(total - 1, total, MARK_CUT_END, "");
}
else if (action == "NEWCUT")
Expand Down Expand Up @@ -172,9 +173,10 @@ void DeleteMap::UpdateOSD(uint64_t frame, uint64_t total, double frame_rate,
posMap.insert("position", (float)((double)frame/(double)total));
osd->SetValues("osd_program_editor", posMap, kOSDTimeout_None);
osd->SetText("osd_program_editor", infoMap, kOSDTimeout_None);
//if (m_changed)
if (m_changed || total != m_cachedTotalForOSD)
osd->SetRegions("osd_program_editor", m_deleteMap, total);
m_changed = false;
m_cachedTotalForOSD = total;
}

/// Set the edit mode and optionally hide the edit mode OSD.
Expand Down
6 changes: 5 additions & 1 deletion mythtv/libs/libmythtv/deletemap.h
Expand Up @@ -23,7 +23,10 @@ class MTV_PUBLIC DeleteMap
m_nextCutStartIsValid(false),
m_nextCutStart(0), m_changed(true),
m_seekamountpos(4), m_seekamount(30),
m_ctx(0), m_undoStackPointer(-1) { Push(""); }
m_ctx(0), m_cachedTotalForOSD(0), m_undoStackPointer(-1)
{
Push("");
}

void SetPlayerContext(PlayerContext *ctx) { m_ctx = ctx; }
bool HandleAction(QString &action, uint64_t frame, uint64_t played,
Expand Down Expand Up @@ -90,6 +93,7 @@ class MTV_PUBLIC DeleteMap
int m_seekamountpos;
int m_seekamount;
PlayerContext *m_ctx;
uint64_t m_cachedTotalForOSD;

// Invariant: m_undoStack[m_undoStackPointer].deleteMap == m_deleteMap
QVector<DeleteMapUndoEntry> m_undoStack;
Expand Down
28 changes: 13 additions & 15 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -310,6 +310,12 @@ void MythPlayer::SetWatchingRecording(bool mode)
decoder->setWatchingRecording(mode);
}

bool MythPlayer::IsWatchingInprogress(void) const
{
return watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder();
}

void MythPlayer::PauseBuffer(void)
{
bufferPauseLock.lock();
Expand Down Expand Up @@ -2692,8 +2698,7 @@ void MythPlayer::EventLoop(void)
SetScanType(resetScan);

// refresh the position map for an in-progress recording while editing
if (hasFullPositionMap && watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder() && deleteMap.IsEditing())
if (hasFullPositionMap && IsWatchingInprogress() && deleteMap.IsEditing())
{
if (editUpdateTimer.elapsed() > 2000)
{
Expand Down Expand Up @@ -3470,8 +3475,7 @@ long long MythPlayer::CalcMaxFFTime(long long ff, bool setjump) const
bool islivetvcur = (livetv && player_ctx->tvchain &&
!player_ctx->tvchain->HasNext());

if (livetv || (watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder()))
if (livetv || IsWatchingInprogress())
maxtime = (long long)(3.0 * video_frame_rate);

long long ret = ff;
Expand All @@ -3491,8 +3495,7 @@ long long MythPlayer::CalcMaxFFTime(long long ff, bool setjump) const
}
}
}
else if (islivetvcur || (watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder()))
else if (islivetvcur || IsWatchingInprogress())
{
long long behind = player_ctx->recorder->GetFramesWritten() -
framesPlayed;
Expand Down Expand Up @@ -3555,8 +3558,7 @@ bool MythPlayer::IsNearEnd(void)

long long margin = (long long)(video_frame_rate * 2);
margin = (long long) (margin * audio.GetStretchFactor());
bool watchingTV = watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder();
bool watchingTV = IsWatchingInprogress();

framesRead = decoder->GetFramesRead();

Expand Down Expand Up @@ -3634,8 +3636,7 @@ void MythPlayer::WaitForSeek(uint64_t frame, bool override_seeks,
!player_ctx->tvchain->HasNext());

uint64_t max = totalFrames;
if ((islivetvcur || (watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder())))
if (islivetvcur || IsWatchingInprogress())
{
max = (uint64_t)player_ctx->recorder->GetFramesWritten();
}
Expand Down Expand Up @@ -4487,9 +4488,7 @@ int MythPlayer::GetStatusbarPos(void) const
{
double spos = 0.0;

if ((livetv) ||
(watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder()))
if (livetv || IsWatchingInprogress())
{
spos = 1000.0 * framesPlayed / player_ctx->recorder->GetFramesWritten();
}
Expand Down Expand Up @@ -4590,8 +4589,7 @@ void MythPlayer::calcSliderPos(osdInfo &info, bool paddedFields)
playbackLen = player_ctx->tvchain->GetLengthAtCurPos();
islive = true;
}
else if (watchingrecording && player_ctx->recorder &&
player_ctx->recorder->IsValidRecorder())
else if (IsWatchingInprogress())
{
playbackLen =
(int)(((float)player_ctx->recorder->GetFramesWritten() /
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/mythplayer.h
Expand Up @@ -215,6 +215,7 @@ class MTV_PUBLIC MythPlayer
bool HasTVChainNext(void) const;
bool CanSupportDoubleRate(void);
bool GetScreenShot(int width = 0, int height = 0, QString filename = "");
bool IsWatchingInprogress(void) const;

// Non-const gets
virtual char *GetScreenGrabAtFrame(uint64_t frameNum, bool absolute,
Expand Down

0 comments on commit f77d001

Please sign in to comment.