Skip to content

Commit

Permalink
Add volume to LCD in TV/video playback
Browse files Browse the repository at this point in the history
Previously, this was only supported in music playback.  Patch from #9393,
applied to master, minor tweaks made to get proper compilation.

Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
  • Loading branch information
mzanetti authored and Beirdo committed Jan 30, 2011
1 parent 001b8be commit 9988844
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 39 additions & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -862,7 +862,8 @@ TV::TV(void)
disableDrawUnusedRects(false),
isEmbedded(false), ignoreKeyPresses(false),
// Timers
lcdTimerId(0), keyListTimerId(0),
lcdTimerId(0), lcdVolumeTimerId(0),
keyListTimerId(0),
networkControlTimerId(0), jumpMenuTimerId(0),
pipChangeTimerId(0),
switchToInputTimerId(0), ccInputTimerId(0),
Expand Down Expand Up @@ -2398,6 +2399,8 @@ void TV::timerEvent(QTimerEvent *te)
bool handled = true;
if (timer_id == lcdTimerId)
HandleLCDTimerEvent();
else if (timer_id == lcdVolumeTimerId)
HandleLCDVolumeTimerEvent();
else if (timer_id == sleepTimerId)
ShowOSDSleep();
else if (timer_id == sleepDialogTimerId)
Expand Down Expand Up @@ -2955,6 +2958,21 @@ bool TV::HandleLCDTimerEvent(void)
return true;
}

void TV::HandleLCDVolumeTimerEvent()
{
PlayerContext *actx = GetPlayerReadLock(-1, __FILE__, __LINE__);
LCD *lcd = LCD::Get();
if (lcd)
{
ShowLCDChannelInfo(actx);
lcd->switchToChannel(lcdCallsign, lcdTitle, lcdSubtitle);
}
ReturnPlayerLock(actx);

QMutexLocker locker(&timerIdLock);
KillTimer(lcdVolumeTimerId);
}

int TV::StartTimer(int interval, int line)
{
int x = QObject::startTimer(interval);
Expand Down Expand Up @@ -7781,6 +7799,26 @@ void TV::ChangeVolume(PlayerContext *ctx, bool up)
kOSDFunctionalType_PictureAdjust, "%", curvol * 10,
kOSDTimeout_Med);
SetUpdateOSDPosition(false);

if (LCD * lcd = LCD::Get())
{
QString appName = tr("Video");

if (StateIsLiveTV(GetState(ctx)))
appName = tr("TV");

if (ctx->buffer && ctx->buffer->IsDVD())
appName = tr("DVD");

lcd->switchToVolume(appName);
lcd->setVolumeLevel((float)curvol / 100);

QMutexLocker locker(&timerIdLock);
if (lcdVolumeTimerId)
KillTimer(lcdVolumeTimerId);

lcdVolumeTimerId = StartTimer(2000, __LINE__);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -590,6 +590,7 @@ class MPUBLIC TV : public QObject
int level = 0, const QString selected = "");
void UpdateLCD(void);
bool HandleLCDTimerEvent(void);
void HandleLCDVolumeTimerEvent(void);
void ShowLCDChannelInfo(const PlayerContext*);
void ShowLCDDVDInfo(const PlayerContext*);

Expand Down Expand Up @@ -812,6 +813,7 @@ class MPUBLIC TV : public QObject
typedef QMap<int,const PlayerContext*> TimerContextConstMap;
mutable QMutex timerIdLock;
volatile int lcdTimerId;
volatile int lcdVolumeTimerId;
volatile int keyListTimerId;
volatile int networkControlTimerId;
volatile int jumpMenuTimerId;
Expand Down

0 comments on commit 9988844

Please sign in to comment.