Skip to content

Commit

Permalink
Rename the player eof variable.
Browse files Browse the repository at this point in the history
...and make it clear that it is the decoder that has hit the end of file
state and not the ringbuffer.
  • Loading branch information
Mark Kendall committed Jan 25, 2011
1 parent b4f1039 commit 985f38a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythcommflagplayer.cpp
Expand Up @@ -108,7 +108,7 @@ bool MythCommFlagPlayer::RebuildSeekTable(
fflush( stdout );
}

while (!eof)
while (!decoderEof)
{
if (inuse_timer.elapsed() > 2534)
{
Expand Down
42 changes: 21 additions & 21 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -130,13 +130,12 @@ MythPlayer::MythPlayer(bool muted)
parentWidget(NULL), embedid(0),
embx(-1), emby(-1), embw(-1), embh(-1),
// State
decoderEof(false),
decoderPaused(false), pauseDecoder(false), unpauseDecoder(false),
killdecoder(false), decoderSeek(-1), decodeOneFrame(false),
needNewPauseFrame(false),
bufferPaused(false), videoPaused(false),
allpaused(false), playing(false),

eof(false),
m_double_framerate(false), m_double_process(false),
m_can_double(false), m_deint_possible(true),
livetv(false),
Expand Down Expand Up @@ -976,7 +975,7 @@ int MythPlayer::OpenFile(uint retries, bool allow_libmpeg2)
//noVideoTracks = !decoder->GetTrackCount(kTrackTypeVideo);


eof = false;
decoderEof = false;

// Set 'no_video_decode' to true for audio only decodeing
bool no_video_decode = false;
Expand Down Expand Up @@ -2279,7 +2278,7 @@ void MythPlayer::SwitchToProgram(void)
{
OpenDummy();
ResetPlaying();
eof = false;
decoderEof = false;
delete pginfo;
return;
}
Expand All @@ -2293,21 +2292,21 @@ void MythPlayer::SwitchToProgram(void)
QString("(card type: %1).")
.arg(player_ctx->tvchain->GetCardType(newid)));
VERBOSE(VB_IMPORTANT, QString("\n") + player_ctx->tvchain->toString());
eof = true;
decoderEof = true;
SetErrored(QObject::tr("Error opening switch program buffer"));
delete pginfo;
return;
}

if (eof)
if (decoderEof)
{
discontinuity = true;
ResetCaptions();
}

VERBOSE(VB_PLAYBACK, LOC + QString("SwitchToProgram(void) "
"discont: %1 newtype: %2 newid: %3 eof: %4")
.arg(discontinuity).arg(newtype).arg(newid).arg(eof));
"discont: %1 newtype: %2 newid: %3 decoderEof: %4")
.arg(discontinuity).arg(newtype).arg(newid).arg(decoderEof));

if (discontinuity || newtype)
{
Expand Down Expand Up @@ -2337,7 +2336,7 @@ void MythPlayer::SwitchToProgram(void)
if (IsErrored())
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "SwitchToProgram failed.");
eof = true;
decoderEof = true;
return;
}

Expand All @@ -2352,7 +2351,7 @@ void MythPlayer::SwitchToProgram(void)
forcePositionMapSync = true;
}

eof = false;
decoderEof = false;
Play();
VERBOSE(VB_PLAYBACK, LOC + "SwitchToProgram - end");
}
Expand All @@ -2369,7 +2368,7 @@ void MythPlayer::FileChangedCallback(void)
player_ctx->buffer->Reset(false, true, true);
Play();

eof = false;
decoderEof = false;

player_ctx->SetPlayerChangingBuffers(false);

Expand Down Expand Up @@ -2407,7 +2406,7 @@ void MythPlayer::JumpToProgram(void)
{
OpenDummy();
ResetPlaying();
eof = false;
decoderEof = false;
delete pginfo;
return;
}
Expand All @@ -2424,7 +2423,7 @@ void MythPlayer::JumpToProgram(void)
.arg(player_ctx->tvchain->GetCardType(newid)));
VERBOSE(VB_IMPORTANT, QString("\n") + player_ctx->tvchain->toString());

eof = true;
decoderEof = true;
SetErrored(QObject::tr("Error opening jump program file buffer"));
delete pginfo;
return;
Expand Down Expand Up @@ -2468,7 +2467,7 @@ void MythPlayer::JumpToProgram(void)
if (nextpos > 10)
DoFastForward(nextpos, true, false);

eof = false;
decoderEof = false;
player_ctx->SetPlayerChangingBuffers(false);
VERBOSE(VB_PLAYBACK, LOC + "JumpToProgram - end");
}
Expand Down Expand Up @@ -2591,7 +2590,7 @@ void MythPlayer::EventLoop(void)
player_ctx->tvchain->JumpToNext(true, 1);
JumpToProgram();
}
else if ((!allpaused || eof) && player_ctx->tvchain &&
else if ((!allpaused || decoderEof) && player_ctx->tvchain &&
(decoder && !decoder->GetWaitForChange()))
{
// Switch to the next program in livetv
Expand Down Expand Up @@ -2642,7 +2641,7 @@ void MythPlayer::EventLoop(void)
}

// Handle end of file
if (eof)
if (decoderEof)
{
if (player_ctx->tvchain)
{
Expand Down Expand Up @@ -2675,7 +2674,7 @@ void MythPlayer::EventLoop(void)
if (fftime > 0)
{
DoFastForward(fftime);
if (eof)
if (decoderEof)
return;
}
}
Expand Down Expand Up @@ -2737,7 +2736,7 @@ void MythPlayer::EventLoop(void)
&& !player_ctx->IsPIP() &&
player_ctx->GetState() == kState_WatchingPreRecorded))
{
eof = true;
decoderEof = true;
}
}
else
Expand Down Expand Up @@ -2879,7 +2878,8 @@ void MythPlayer::DecoderLoop(bool pause)
decoder_change_lock.unlock();
}

bool obey_eof = eof && !(eof && player_ctx->tvchain && !allpaused);
bool obey_eof = decoderEof &&
!(decoderEof && player_ctx->tvchain && !allpaused);
if (isDummy || ((decoderPaused || ffrew_skip == 0 || obey_eof) &&
!decodeOneFrame))
{
Expand Down Expand Up @@ -4204,7 +4204,7 @@ bool MythPlayer::TranscodeGetNextFrame(
if (!decoder->GetFrame(kDecodeAV))
return false;

if (eof)
if (decoderEof)
return false;

if (honorCutList && !deleteMap.IsEmpty())
Expand All @@ -4229,7 +4229,7 @@ bool MythPlayer::TranscodeGetNextFrame(
did_ff = 1;
}
}
if (eof)
if (decoderEof)
return false;
is_key = decoder->isLastFrameKey();
return true;
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/mythplayer.h
Expand Up @@ -124,7 +124,7 @@ class MPUBLIC MythPlayer
void SetLength(int len) { totalLength = len; }
void SetFramesPlayed(uint64_t played) { framesPlayed = played; }
void SetVideoFilters(const QString &override);
void SetEof(void) { eof = true; }
void SetEof(void) { decoderEof = true; }
void SetPIPActive(bool is_active) { pip_active = is_active; }
void SetPIPVisible(bool is_visible) { pip_visible = is_visible; }

Expand Down Expand Up @@ -175,7 +175,7 @@ class MPUBLIC MythPlayer
// Bool Gets
bool GetRawAudioState(void) const;
bool GetLimitKeyRepeat(void) const { return limitKeyRepeat; }
bool GetEof(void) const { return eof; }
bool GetEof(void) const { return decoderEof; }
bool IsErrored(void) const;
bool IsPlaying(uint wait_ms = 0, bool wait_for = true) const;
bool AtNormalSpeed(void) const { return next_normal_speed; }
Expand Down Expand Up @@ -530,6 +530,7 @@ class MPUBLIC MythPlayer
QWaitCondition decoderThreadUnpause;
mutable QMutex decoderPauseLock;
mutable QMutex decoderSeekLock;
bool decoderEof;
bool decoderPaused;
bool pauseDecoder;
bool unpauseDecoder;
Expand All @@ -548,7 +549,6 @@ class MPUBLIC MythPlayer
mutable QWaitCondition playingWaitCond;
mutable QMutex vidExitLock;
mutable QMutex playingLock;
bool eof; ///< At end of file/ringbuffer
bool m_double_framerate;///< Output fps is double Video (input) rate
bool m_double_process;///< Output filter must processed at double rate
bool m_can_double; ///< VideoOutput capable of doubling frame rate
Expand Down

0 comments on commit 985f38a

Please sign in to comment.