Skip to content

Commit 1a65391

Browse files
author
Mark Kendall
committed
Bluray: Check for top menu and first play support in HDMV mode.
Don't try to use HDMV navigation mode if first play is not supported (and just fall back to title navigation mode) and don't try to bring up the top menu if there isn't one.
1 parent 255a074 commit 1a65391

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

mythtv/libs/libmythtv/bdringbuffer.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ static void HandleOverlayCallback(void *data, const bd_overlay_s *const overlay)
3030
}
3131

3232
BDRingBuffer::BDRingBuffer(const QString &lfilename)
33-
: bdnav(NULL), m_is_hdmv_navigation(false),
33+
: bdnav(NULL), m_isHDMVNavigation(false), m_tryHDMVNavigation(false),
34+
m_topMenuSupported(false), m_firstPlaySupported(false),
3435
m_numTitles(0), m_titleChanged(false), m_playerWait(false),
3536
m_ignorePlayerWait(true),
3637
m_stillTime(0), m_stillMode(BLURAY_STILL_NONE),
3738
m_infoLock(QMutex::Recursive)
3839
{
40+
m_tryHDMVNavigation = NULL != getenv("MYTHTV_HDMV");
3941
OpenFile(lfilename);
4042
}
4143

@@ -164,7 +166,7 @@ void BDRingBuffer::GetDescForPos(QString &desc)
164166

165167
bool BDRingBuffer::HandleAction(const QStringList &actions, int64_t pts)
166168
{
167-
if (!m_is_hdmv_navigation)
169+
if (!m_isHDMVNavigation)
168170
return false;
169171

170172
if (actions.contains(ACTION_MENUTEXT))
@@ -287,9 +289,14 @@ bool BDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
287289
}
288290

289291
// Check disc to see encryption status, menu and navigation types.
292+
m_topMenuSupported = false;
293+
m_firstPlaySupported = false;
290294
const BLURAY_DISC_INFO *discinfo = bd_get_disc_info(bdnav);
291295
if (discinfo)
292296
{
297+
m_topMenuSupported = discinfo->top_menu_supported;
298+
m_firstPlaySupported = discinfo->first_play_supported;
299+
293300
VERBOSE(VB_PLAYBACK, LOC + QString("*** Blu-ray Disc Information ***"));
294301
VERBOSE(VB_PLAYBACK, LOC + QString("First Play Supported: %1")
295302
.arg(discinfo->first_play_supported ? "yes" : "no"));
@@ -378,15 +385,13 @@ bool BDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
378385
m_stillTime = 0;
379386
m_inMenu = false;
380387

381-
bool try_hdmv = NULL != getenv("MYTHTV_HDMV");
382-
383388
// First, attempt to initialize the disc in HDMV navigation mode.
384389
// If this fails, fall back to the traditional built-in title switching
385390
// mode.
386-
if (try_hdmv && bd_play(bdnav))
391+
if (m_tryHDMVNavigation && m_firstPlaySupported && bd_play(bdnav))
387392
{
388393
VERBOSE(VB_IMPORTANT, LOC + QString("Using HDMV navigation mode."));
389-
m_is_hdmv_navigation = true;
394+
m_isHDMVNavigation = true;
390395

391396
// Initialize the HDMV event queue
392397
HandleBDEvents();
@@ -677,7 +682,7 @@ uint64_t BDRingBuffer::GetTotalReadPosition(void)
677682
int BDRingBuffer::safe_read(void *data, uint sz)
678683
{
679684
int result = 0;
680-
if (m_is_hdmv_navigation)
685+
if (m_isHDMVNavigation)
681686
{
682687
HandleBDEvents();
683688
while (result == 0)
@@ -806,8 +811,14 @@ void BDRingBuffer::ClickButton(int64_t pts, uint16_t x, uint16_t y)
806811
*/
807812
bool BDRingBuffer::GoToMenu(const QString str, int64_t pts)
808813
{
809-
if (!m_is_hdmv_navigation || pts <= 0)
814+
if (!m_isHDMVNavigation || pts < 0)
815+
return false;
816+
817+
if (!m_topMenuSupported)
818+
{
819+
VERBOSE(VB_PLAYBACK, LOC + "Top Menu not supported");
810820
return false;
821+
}
811822

812823
VERBOSE(VB_PLAYBACK, LOC + QString("GoToMenu %1").arg(str));
813824

@@ -985,7 +996,7 @@ void BDRingBuffer::WaitForPlayer(void)
985996

986997
bool BDRingBuffer::StartFromBeginning(void)
987998
{
988-
if (bdnav && m_is_hdmv_navigation)
999+
if (bdnav && m_isHDMVNavigation)
9891000
{
9901001
VERBOSE(VB_PLAYBACK, LOC + "Starting from beginning...");
9911002
return true; //bd_play(bdnav);

mythtv/libs/libmythtv/bdringbuffer.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class MPUBLIC BDRingBuffer : public RingBuffer
7979
uint64_t GetChapterStartTime(uint32_t chapter);
8080
uint64_t GetChapterStartFrame(uint32_t chapter);
8181
bool IsOpen(void) const { return bdnav; }
82-
bool IsHDMVNavigation(void) const { return m_is_hdmv_navigation; }
82+
bool IsHDMVNavigation(void) const { return m_isHDMVNavigation; }
8383
bool IsInMenu(void) const { return m_inMenu; }
8484
bool IsInStillFrame(void) const;
8585
virtual bool IsInDiscMenuOrStillFrame(void) const
@@ -127,7 +127,11 @@ class MPUBLIC BDRingBuffer : public RingBuffer
127127

128128
BLURAY *bdnav;
129129
meta_dl *m_metaDiscLibrary;
130-
bool m_is_hdmv_navigation;
130+
bool m_isHDMVNavigation;
131+
bool m_tryHDMVNavigation;
132+
bool m_topMenuSupported;
133+
bool m_firstPlaySupported;
134+
131135
uint32_t m_numTitles;
132136
uint32_t m_mainTitle; // Index number of main title
133137
uint64_t m_currentTitleLength; // Selected title's duration, in ticks (90Khz)

0 commit comments

Comments
 (0)