Skip to content

Commit 9988844

Browse files
mzanettiBeirdo
authored andcommitted
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>
1 parent 001b8be commit 9988844

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

mythtv/libs/libmythtv/tv_play.cpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,8 @@ TV::TV(void)
862862
disableDrawUnusedRects(false),
863863
isEmbedded(false), ignoreKeyPresses(false),
864864
// Timers
865-
lcdTimerId(0), keyListTimerId(0),
865+
lcdTimerId(0), lcdVolumeTimerId(0),
866+
keyListTimerId(0),
866867
networkControlTimerId(0), jumpMenuTimerId(0),
867868
pipChangeTimerId(0),
868869
switchToInputTimerId(0), ccInputTimerId(0),
@@ -2398,6 +2399,8 @@ void TV::timerEvent(QTimerEvent *te)
23982399
bool handled = true;
23992400
if (timer_id == lcdTimerId)
24002401
HandleLCDTimerEvent();
2402+
else if (timer_id == lcdVolumeTimerId)
2403+
HandleLCDVolumeTimerEvent();
24012404
else if (timer_id == sleepTimerId)
24022405
ShowOSDSleep();
24032406
else if (timer_id == sleepDialogTimerId)
@@ -2955,6 +2958,21 @@ bool TV::HandleLCDTimerEvent(void)
29552958
return true;
29562959
}
29572960

2961+
void TV::HandleLCDVolumeTimerEvent()
2962+
{
2963+
PlayerContext *actx = GetPlayerReadLock(-1, __FILE__, __LINE__);
2964+
LCD *lcd = LCD::Get();
2965+
if (lcd)
2966+
{
2967+
ShowLCDChannelInfo(actx);
2968+
lcd->switchToChannel(lcdCallsign, lcdTitle, lcdSubtitle);
2969+
}
2970+
ReturnPlayerLock(actx);
2971+
2972+
QMutexLocker locker(&timerIdLock);
2973+
KillTimer(lcdVolumeTimerId);
2974+
}
2975+
29582976
int TV::StartTimer(int interval, int line)
29592977
{
29602978
int x = QObject::startTimer(interval);
@@ -7781,6 +7799,26 @@ void TV::ChangeVolume(PlayerContext *ctx, bool up)
77817799
kOSDFunctionalType_PictureAdjust, "%", curvol * 10,
77827800
kOSDTimeout_Med);
77837801
SetUpdateOSDPosition(false);
7802+
7803+
if (LCD * lcd = LCD::Get())
7804+
{
7805+
QString appName = tr("Video");
7806+
7807+
if (StateIsLiveTV(GetState(ctx)))
7808+
appName = tr("TV");
7809+
7810+
if (ctx->buffer && ctx->buffer->IsDVD())
7811+
appName = tr("DVD");
7812+
7813+
lcd->switchToVolume(appName);
7814+
lcd->setVolumeLevel((float)curvol / 100);
7815+
7816+
QMutexLocker locker(&timerIdLock);
7817+
if (lcdVolumeTimerId)
7818+
KillTimer(lcdVolumeTimerId);
7819+
7820+
lcdVolumeTimerId = StartTimer(2000, __LINE__);
7821+
}
77847822
}
77857823
}
77867824

mythtv/libs/libmythtv/tv_play.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ class MPUBLIC TV : public QObject
590590
int level = 0, const QString selected = "");
591591
void UpdateLCD(void);
592592
bool HandleLCDTimerEvent(void);
593+
void HandleLCDVolumeTimerEvent(void);
593594
void ShowLCDChannelInfo(const PlayerContext*);
594595
void ShowLCDDVDInfo(const PlayerContext*);
595596

@@ -812,6 +813,7 @@ class MPUBLIC TV : public QObject
812813
typedef QMap<int,const PlayerContext*> TimerContextConstMap;
813814
mutable QMutex timerIdLock;
814815
volatile int lcdTimerId;
816+
volatile int lcdVolumeTimerId;
815817
volatile int keyListTimerId;
816818
volatile int networkControlTimerId;
817819
volatile int jumpMenuTimerId;

0 commit comments

Comments
 (0)