Skip to content

Commit

Permalink
VTS title and clean up menu looping detection.
Browse files Browse the repository at this point in the history
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.

Fixes #11445

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information
Richard authored and stuartm committed Mar 13, 2013
1 parent b6c0ec5 commit 6fce212
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 deletions.
62 changes: 36 additions & 26 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
Expand Up @@ -99,9 +99,11 @@ DVDRingBuffer::DVDRingBuffer(const QString &lfilename) :

m_skipstillorwait(true),
m_cellstartPos(0), m_buttonSelected(false),
m_buttonExists(false), m_cellid(0),
m_lastcellid(0), m_vobid(0),
m_lastvobid(0), m_cellRepeated(false),
m_buttonExists(false),
m_buttonSeenInCell(false), m_lastButtonSeenInCell(false),
m_cellid(0), m_lastcellid(0),
m_vobid(0), m_lastvobid(0),
m_cellRepeated(false),

m_curAudioTrack(0),
m_curSubtitleTrack(0),
Expand Down Expand Up @@ -638,9 +640,11 @@ int DVDRingBuffer::safe_read(void *data, uint sz)
// clear menus/still frame selections
m_lastvobid = m_vobid;
m_lastcellid = m_cellid;
m_lastButtonSeenInCell = m_buttonSeenInCell;
m_buttonSelected = false;
m_vobid = m_cellid = 0;
m_cellRepeated = false;
m_buttonSeenInCell = false;

IncrementButtonVersion;
if (m_inMenu)
Expand Down Expand Up @@ -681,21 +685,6 @@ int DVDRingBuffer::safe_read(void *data, uint sz)
// clear any existing subs/buttons
IncrementButtonVersion;

// update the stream number
if (m_inMenu || NumMenuButtons() > 0)
{
m_buttonStreamID = 32;
int aspect = dvdnav_get_video_aspect(m_dvdnav);

// workaround where dvd menu is
// present in VTS_DOMAIN. dvdnav adds 0x80 to stream id
// proper fix should be put in dvdnav sometime
int physical_wide = (spu->physical_wide & 0xF);

if (aspect != 0 && physical_wide > 0)
m_buttonStreamID += physical_wide;
}

// not sure
if (m_autoselectsubtitle)
m_curSubtitleTrack = dvdnav_get_active_spu_stream(m_dvdnav);
Expand Down Expand Up @@ -775,15 +764,12 @@ int DVDRingBuffer::safe_read(void *data, uint sz)

// if we are in a looping menu, we don't want to reset the
// selected button when we restart
if (m_vobid == 0 && m_cellid == 0)
m_vobid = dsi->dsi_gi.vobu_vob_idn;
m_cellid = dsi->dsi_gi.vobu_c_idn;
if ((m_lastvobid == m_vobid) && (m_lastcellid == m_cellid)
&& m_lastButtonSeenInCell)
{
m_vobid = dsi->dsi_gi.vobu_vob_idn;
m_cellid = dsi->dsi_gi.vobu_c_idn;
if ((m_lastvobid == m_vobid) && (m_lastcellid == m_cellid)
&& m_inMenu)
{
m_cellRepeated = true;
}
m_cellRepeated = true;
}

// update our status
Expand All @@ -806,6 +792,24 @@ int DVDRingBuffer::safe_read(void *data, uint sz)
}
}

// update the button stream number if this is the
// first NAV pack containing button information
if ( (pci->hli.hl_gi.hli_ss & 0x03) == 0x01 )
{
m_buttonStreamID = 32;
int aspect = dvdnav_get_video_aspect(m_dvdnav);

// workaround where dvd menu is
// present in VTS_DOMAIN. dvdnav adds 0x80 to stream id
// proper fix should be put in dvdnav sometime
int8_t spustream = dvdnav_get_active_spu_stream(m_dvdnav) & 0x7f;

if (aspect != 0 && spustream > 0)
m_buttonStreamID += spustream;

m_buttonSeenInCell = true;
}

// debug
LOG(VB_PLAYBACK, LOG_DEBUG, LOC + "DVDNAV_NAV_PACKET");

Expand Down Expand Up @@ -858,6 +862,12 @@ int DVDRingBuffer::safe_read(void *data, uint sz)
m_audioStreamsChanged = true;
}

// Make sure we know we're not staying in the
// same cell (same vobid/cellid values can
// occur in every VTS)
m_lastvobid = m_vobid = 0;
m_lastcellid = m_cellid = 0;

// release buffer
if (blockBuf != m_dvdBlockWriteBuf)
dvdnav_free_cache_block(m_dvdnav, blockBuf);
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.h
Expand Up @@ -183,6 +183,8 @@ class MTV_PUBLIC DVDRingBuffer : public RingBuffer
long long m_cellstartPos;
bool m_buttonSelected;
bool m_buttonExists;
bool m_buttonSeenInCell;
bool m_lastButtonSeenInCell;
int m_cellid;
int m_lastcellid;
int m_vobid;
Expand Down

0 comments on commit 6fce212

Please sign in to comment.