Permalink
Browse files

Display error as to why playback failed to start.

Playback would otherwise fail silently, with the user wondering why.

Fixes #11656
  • Loading branch information...
jyavenard committed Jul 10, 2013
1 parent 93a83da commit 0e6c4e539a427e100564f018939be5c70bdb800c
Showing with 26 additions and 5 deletions.
  1. +13 −2 mythtv/libs/libmythtv/mythplayer.cpp
  2. +4 −3 mythtv/libs/libmythtv/mythplayer.h
  3. +9 −0 mythtv/libs/libmythtv/tv_play.cpp
@@ -575,7 +575,7 @@ void MythPlayer::ReinitVideo(void)
if (!videoOutput->IsPreferredRenderer(video_disp_dim))
{
LOG(VB_PLAYBACK, LOG_INFO, LOC + "Need to switch video renderer.");
SetErrored(tr("Need to switch video renderer."));
SetErrored(tr("Need to switch video renderer"));
errorType |= kError_Switch_Renderer;
return;
}
@@ -934,6 +934,7 @@ int MythPlayer::OpenFile(uint retries)
.arg(testreadsize)
.arg(player_ctx->buffer->GetFilename()));
delete[] testbuf;
SetErrored(tr("Could not read first %1 bytes").arg(testreadsize));
return -1;
}
LOG(VB_GENERAL, LOG_WARNING, LOC + "OpenFile() waiting on data");
@@ -953,6 +954,7 @@ int MythPlayer::OpenFile(uint retries)
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Couldn't find an A/V decoder for: '%1'")
.arg(player_ctx->buffer->GetFilename()));
SetErrored(tr("Could not find an A/V decoder"));
delete[] testbuf;
return -1;
@@ -961,6 +963,7 @@ int MythPlayer::OpenFile(uint retries)
{
LOG(VB_GENERAL, LOG_ERR, LOC + "Could not initialize A/V decoder.");
SetDecoder(NULL);
SetErrored(tr("Could not initialize A/V decoder"));
delete[] testbuf;
return -1;
@@ -985,6 +988,7 @@ int MythPlayer::OpenFile(uint retries)
{
LOG(VB_GENERAL, LOG_ERR, QString("Couldn't open decoder for: %1")
.arg(player_ctx->buffer->GetFilename()));
SetErrored(tr("Could not open decoder"));
return -1;
}
@@ -5226,7 +5230,7 @@ bool MythPlayer::PosMapFromEnc(uint64_t start,
return true;
}
void MythPlayer::SetErrored(const QString &reason) const
void MythPlayer::SetErrored(const QString &reason)
{
QMutexLocker locker(&errorLock);
@@ -5244,6 +5248,13 @@ void MythPlayer::SetErrored(const QString &reason) const
}
}
void MythPlayer::ResetErrored(void)
{
QMutexLocker locker(&errorLock);
errorMsg = QString();
}
bool MythPlayer::IsErrored(void) const
{
QMutexLocker locker(&errorLock);
@@ -551,7 +551,8 @@ class MTV_PUBLIC MythPlayer
// Private Sets
void SetPlayingInfo(const ProgramInfo &pginfo);
void SetPlaying(bool is_playing);
void SetErrored(const QString &reason) const;
void SetErrored(const QString &reason);
void ResetErrored(void);
// Private Gets
int GetStatusbarPos(void) const;
@@ -659,8 +660,8 @@ class MTV_PUBLIC MythPlayer
bool hasFullPositionMap;
mutable bool limitKeyRepeat;
mutable QMutex errorLock;
mutable QString errorMsg; ///< Reason why NVP exited with a error
mutable int errorType;
QString errorMsg; ///< Reason why NVP exited with a error
int errorType;
// Chapter stuff
int jumpchapter;
@@ -2408,6 +2408,15 @@ void TV::HandleStateChange(PlayerContext *mctx, PlayerContext *ctx)
{
SET_LAST();
SetErrored(ctx);
if (ctx && ctx->IsPlayerErrored())
{
ShowNotificationError(ctx->player->GetError(),
_Location,
buffer->GetFilename());
// We're going to display this error as notification
// no need to display it later as popup
ctx->player->ResetErrored();
}
}
else if (mctx != ctx)
{

0 comments on commit 0e6c4e5

Please sign in to comment.