Skip to content

Commit 269b5eb

Browse files
author
Mark Kendall
committed
Move bluray keypress/action handling into BDRingBuffer
1 parent a2c3d16 commit 269b5eb

File tree

3 files changed

+85
-76
lines changed

3 files changed

+85
-76
lines changed

mythtv/libs/libmythtv/bdringbuffer.cpp

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "mythlocale.h"
1717
#include "mythdirs.h"
1818
#include "bluray.h"
19+
#include "tv.h" // for actions
1920

2021
#define LOC QString("BDRingBuf(%1): ").arg(filename)
2122
#define LOC_WARN QString("BDRingBuf(%1) Warning: ").arg(filename)
@@ -148,6 +149,88 @@ void BDRingBuffer::GetDescForPos(QString &desc) const
148149
.arg(m_currentTitleInfo->chapters->idx);
149150
}
150151

152+
bool BDRingBuffer::HandleAction(const QStringList &actions, int64_t pts)
153+
{
154+
if (actions.contains(ACTION_MENUTEXT))
155+
{
156+
PressButton(BD_VK_POPUP, pts);
157+
return true;
158+
}
159+
160+
if (!IsInMenu())
161+
return false;
162+
163+
bool handled = true;
164+
if (actions.contains(ACTION_UP) ||
165+
actions.contains(ACTION_CHANNELUP))
166+
{
167+
PressButton(BD_VK_UP, pts);
168+
}
169+
else if (actions.contains(ACTION_DOWN) ||
170+
actions.contains(ACTION_CHANNELDOWN))
171+
{
172+
PressButton(BD_VK_DOWN, pts);
173+
}
174+
else if (actions.contains(ACTION_LEFT) ||
175+
actions.contains(ACTION_SEEKRWND))
176+
{
177+
PressButton(BD_VK_LEFT, pts);
178+
}
179+
else if (actions.contains(ACTION_RIGHT) ||
180+
actions.contains(ACTION_SEEKFFWD))
181+
{
182+
PressButton(BD_VK_RIGHT, pts);
183+
}
184+
else if (actions.contains(ACTION_0))
185+
{
186+
PressButton(BD_VK_0, pts);
187+
}
188+
else if (actions.contains(ACTION_1))
189+
{
190+
PressButton(BD_VK_1, pts);
191+
}
192+
else if (actions.contains(ACTION_2))
193+
{
194+
PressButton(BD_VK_2, pts);
195+
}
196+
else if (actions.contains(ACTION_3))
197+
{
198+
PressButton(BD_VK_3, pts);
199+
}
200+
else if (actions.contains(ACTION_4))
201+
{
202+
PressButton(BD_VK_4, pts);
203+
}
204+
else if (actions.contains(ACTION_5))
205+
{
206+
PressButton(BD_VK_5, pts);
207+
}
208+
else if (actions.contains(ACTION_6))
209+
{
210+
PressButton(BD_VK_6, pts);
211+
}
212+
else if (actions.contains(ACTION_7))
213+
{
214+
PressButton(BD_VK_7, pts);
215+
}
216+
else if (actions.contains(ACTION_8))
217+
{
218+
PressButton(BD_VK_8, pts);
219+
}
220+
else if (actions.contains(ACTION_9))
221+
{
222+
PressButton(BD_VK_9, pts);
223+
}
224+
else if (actions.contains(ACTION_SELECT))
225+
{
226+
PressButton(BD_VK_ENTER, pts);
227+
}
228+
else
229+
handled = false;
230+
231+
return handled;
232+
}
233+
151234
bool BDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
152235
{
153236
VERBOSE(VB_IMPORTANT, LOC + QString("Opened BDRingBuffer device at %1")

mythtv/libs/libmythtv/bdringbuffer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class MPUBLIC BDRingBuffer : public RingBuffer
9292
int GetSubtitleLanguage(uint streamID);
9393

9494
// commands
95+
bool HandleAction(const QStringList &actions, int64_t pts);
9596
virtual bool OpenFile(const QString &filename,
9697
uint retry_ms = kDefaultOpenTimeout);
9798
void close(void);

mythtv/libs/libmythtv/tv_play.cpp

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3902,82 +3902,7 @@ bool TV::DiscMenuHandleAction(PlayerContext *ctx, const QStringList &actions)
39023902
}
39033903
}
39043904

3905-
if (has_action(ACTION_MENUTEXT, actions))
3906-
{
3907-
bdrb->PressButton(BD_VK_POPUP, pts);
3908-
return true;
3909-
}
3910-
3911-
if (!bdrb->IsInMenu())
3912-
return false;
3913-
3914-
handled = true;
3915-
if (has_action(ACTION_UP, actions) ||
3916-
has_action(ACTION_CHANNELUP, actions))
3917-
{
3918-
bdrb->PressButton(BD_VK_UP, pts);
3919-
}
3920-
else if (has_action(ACTION_DOWN, actions) ||
3921-
has_action(ACTION_CHANNELDOWN, actions))
3922-
{
3923-
bdrb->PressButton(BD_VK_DOWN, pts);
3924-
}
3925-
else if (has_action(ACTION_LEFT, actions) ||
3926-
has_action(ACTION_SEEKRWND, actions))
3927-
{
3928-
bdrb->PressButton(BD_VK_LEFT, pts);
3929-
}
3930-
else if (has_action(ACTION_RIGHT, actions) ||
3931-
has_action(ACTION_SEEKFFWD, actions))
3932-
{
3933-
bdrb->PressButton(BD_VK_RIGHT, pts);
3934-
}
3935-
else if (has_action(ACTION_0, actions))
3936-
{
3937-
bdrb->PressButton(BD_VK_0, pts);
3938-
}
3939-
else if (has_action(ACTION_1, actions))
3940-
{
3941-
bdrb->PressButton(BD_VK_1, pts);
3942-
}
3943-
else if (has_action(ACTION_2, actions))
3944-
{
3945-
bdrb->PressButton(BD_VK_2, pts);
3946-
}
3947-
else if (has_action(ACTION_3, actions))
3948-
{
3949-
bdrb->PressButton(BD_VK_3, pts);
3950-
}
3951-
else if (has_action(ACTION_4, actions))
3952-
{
3953-
bdrb->PressButton(BD_VK_4, pts);
3954-
}
3955-
else if (has_action(ACTION_5, actions))
3956-
{
3957-
bdrb->PressButton(BD_VK_5, pts);
3958-
}
3959-
else if (has_action(ACTION_6, actions))
3960-
{
3961-
bdrb->PressButton(BD_VK_6, pts);
3962-
}
3963-
else if (has_action(ACTION_7, actions))
3964-
{
3965-
bdrb->PressButton(BD_VK_7, pts);
3966-
}
3967-
else if (has_action(ACTION_8, actions))
3968-
{
3969-
bdrb->PressButton(BD_VK_8, pts);
3970-
}
3971-
else if (has_action(ACTION_9, actions))
3972-
{
3973-
bdrb->PressButton(BD_VK_9, pts);
3974-
}
3975-
else if (has_action(ACTION_SELECT, actions))
3976-
{
3977-
bdrb->PressButton(BD_VK_ENTER, pts);
3978-
}
3979-
else
3980-
handled = false;
3905+
handled = bdrb->HandleAction(actions, pts);
39813906
}
39823907

39833908
return handled;

0 commit comments

Comments
 (0)