@@ -30,12 +30,14 @@ static void HandleOverlayCallback(void *data, const bd_overlay_s *const overlay)
3030}
3131
3232BDRingBuffer::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
165167bool 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)
677682int 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 */
807812bool 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
986997bool 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);
0 commit comments