Ticket #11445: 0001-Fix-displaying-of-menu-highlights-when-a-menu-appear.patch

File 0001-Fix-displaying-of-menu-highlights-when-a-menu-appear.patch, 6.0 KB (added by peper03@…, 13 years ago)
  • mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp

    From fa083c7a3ce910f487ff3c40a6b0faf47832048e Mon Sep 17 00:00:00 2001
    From: Richard <peper03@yahoo.com>
    Date: Thu, 7 Mar 2013 12:06:28 +0100
    Subject: [PATCH] Fix displaying of menu highlights when a menu appears in a
     VTS title and clean up menu looping detection.
    
    Querying the number of buttons as soon as a subpicture stream change notification appears is generally not possible as the button information is carried in NAV packets, which probably haven't been read yet.
    ---
     mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp |   62 ++++++++++++++++-----------
     mythtv/libs/libmythtv/DVD/dvdringbuffer.h   |    2 +
     2 files changed, 38 insertions(+), 26 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
    index 2698142..2932cd8 100644
    a b DVDRingBuffer::DVDRingBuffer(const QString &lfilename) :  
    9999
    100100    m_skipstillorwait(true),
    101101    m_cellstartPos(0), m_buttonSelected(false),
    102     m_buttonExists(false), m_cellid(0),
    103     m_lastcellid(0), m_vobid(0),
    104     m_lastvobid(0), m_cellRepeated(false),
     102    m_buttonExists(false),
     103    m_buttonSeenInCell(false), m_lastButtonSeenInCell(false),
     104    m_cellid(0), m_lastcellid(0),
     105    m_vobid(0), m_lastvobid(0),
     106    m_cellRepeated(false),
    105107
    106108    m_curAudioTrack(0),
    107109    m_curSubtitleTrack(0),
    int DVDRingBuffer::safe_read(void *data, uint sz)  
    641643                // clear menus/still frame selections
    642644                m_lastvobid = m_vobid;
    643645                m_lastcellid = m_cellid;
     646                m_lastButtonSeenInCell = m_buttonSeenInCell;
    644647                m_buttonSelected = false;
    645648                m_vobid = m_cellid = 0;
    646649                m_cellRepeated = false;
     650                m_buttonSeenInCell = false;
    647651
    648652                IncrementButtonVersion;
    649653                if (m_inMenu)
    int DVDRingBuffer::safe_read(void *data, uint sz)  
    684688                // clear any existing subs/buttons
    685689                IncrementButtonVersion;
    686690
    687                 // update the stream number
    688                 if (m_inMenu || NumMenuButtons() > 0)
    689                 {
    690                     m_buttonStreamID = 32;
    691                     int aspect = dvdnav_get_video_aspect(m_dvdnav);
    692 
    693                     // workaround where dvd menu is
    694                     // present in VTS_DOMAIN. dvdnav adds 0x80 to stream id
    695                     // proper fix should be put in dvdnav sometime
    696                     int physical_wide = (spu->physical_wide & 0xF);
    697 
    698                     if (aspect != 0 && physical_wide > 0)
    699                         m_buttonStreamID += physical_wide;
    700                 }
    701 
    702691                // not sure
    703692                if (m_autoselectsubtitle)
    704693                    m_curSubtitleTrack = dvdnav_get_active_spu_stream(m_dvdnav);
    int DVDRingBuffer::safe_read(void *data, uint sz)  
    778767
    779768                // if we are in a looping menu, we don't want to reset the
    780769                // selected button when we restart
    781                 if (m_vobid == 0 && m_cellid == 0)
     770                m_vobid  = dsi->dsi_gi.vobu_vob_idn;
     771                m_cellid = dsi->dsi_gi.vobu_c_idn;
     772                if ((m_lastvobid == m_vobid) && (m_lastcellid == m_cellid)
     773                     && m_lastButtonSeenInCell)
    782774                {
    783                     m_vobid  = dsi->dsi_gi.vobu_vob_idn;
    784                     m_cellid = dsi->dsi_gi.vobu_c_idn;
    785                     if ((m_lastvobid == m_vobid) && (m_lastcellid == m_cellid)
    786                          && m_inMenu)
    787                     {
    788                         m_cellRepeated = true;
    789                     }
     775                    m_cellRepeated = true;
    790776                }
    791777
    792778                // update our status
    int DVDRingBuffer::safe_read(void *data, uint sz)  
    809795                    }
    810796                }
    811797
     798                // update the button stream number if this is the
     799                // first NAV pack containing button information
     800                if ( (pci->hli.hl_gi.hli_ss & 0x03) == 0x01 )
     801                {
     802                    m_buttonStreamID = 32;
     803                    int aspect = dvdnav_get_video_aspect(m_dvdnav);
     804
     805                    // workaround where dvd menu is
     806                    // present in VTS_DOMAIN. dvdnav adds 0x80 to stream id
     807                    // proper fix should be put in dvdnav sometime
     808                    int8_t spustream = dvdnav_get_active_spu_stream(m_dvdnav) & 0x7f;
     809
     810                    if (aspect != 0 && spustream > 0)
     811                        m_buttonStreamID += spustream;
     812
     813                    m_buttonSeenInCell = true;
     814                }
     815
    812816                // debug
    813817                LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("DVDNAV_NAV_PACKET - time:%1, pos:%2, vob:%3, cell:%4, seeking:%5, seektime:%6")
    814818                    .arg(m_currentTime)
    int DVDRingBuffer::safe_read(void *data, uint sz)  
    867871                    m_audioStreamsChanged = true;
    868872                }
    869873
     874                // Make sure we know we're not staying in the
     875                // same cell (same vobid/cellid values can
     876                // occur in every VTS)
     877                m_lastvobid  = m_vobid  = 0;
     878                m_lastcellid = m_cellid = 0;
     879
    870880                // release buffer
    871881                if (blockBuf != m_dvdBlockWriteBuf)
    872882                    dvdnav_free_cache_block(m_dvdnav, blockBuf);
  • mythtv/libs/libmythtv/DVD/dvdringbuffer.h

    diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.h b/mythtv/libs/libmythtv/DVD/dvdringbuffer.h
    index 5468db7..1c089fe 100644
    a b class MTV_PUBLIC DVDRingBuffer : public RingBuffer  
    183183    long long      m_cellstartPos;
    184184    bool           m_buttonSelected;
    185185    bool           m_buttonExists;
     186    bool           m_buttonSeenInCell;
     187    bool           m_lastButtonSeenInCell;
    186188    int            m_cellid;
    187189    int            m_lastcellid;
    188190    int            m_vobid;