Skip to content
Browse files

Add volume to LCD in TV/video playback

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...
1 parent 001b8be commit 9988844875950db6374e8e75dfcf2d84b6c2fe2c @mzanetti mzanetti committed with Beirdo Jan 30, 2011
Showing with 41 additions and 1 deletion.
  1. +39 −1 mythtv/libs/libmythtv/tv_play.cpp
  2. +2 −0 mythtv/libs/libmythtv/tv_play.h
View
40 mythtv/libs/libmythtv/tv_play.cpp
@@ -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),
@@ -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)
@@ -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);
@@ -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__);
+ }
}
}
View
2 mythtv/libs/libmythtv/tv_play.h
@@ -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*);
@@ -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;

0 comments on commit 9988844

Please sign in to comment.
Something went wrong with that request. Please try again.