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) :
|
| 99 | 99 | |
| 100 | 100 | m_skipstillorwait(true), |
| 101 | 101 | 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), |
| 105 | 107 | |
| 106 | 108 | m_curAudioTrack(0), |
| 107 | 109 | m_curSubtitleTrack(0), |
| … |
… |
int DVDRingBuffer::safe_read(void *data, uint sz)
|
| 641 | 643 | // clear menus/still frame selections |
| 642 | 644 | m_lastvobid = m_vobid; |
| 643 | 645 | m_lastcellid = m_cellid; |
| | 646 | m_lastButtonSeenInCell = m_buttonSeenInCell; |
| 644 | 647 | m_buttonSelected = false; |
| 645 | 648 | m_vobid = m_cellid = 0; |
| 646 | 649 | m_cellRepeated = false; |
| | 650 | m_buttonSeenInCell = false; |
| 647 | 651 | |
| 648 | 652 | IncrementButtonVersion; |
| 649 | 653 | if (m_inMenu) |
| … |
… |
int DVDRingBuffer::safe_read(void *data, uint sz)
|
| 684 | 688 | // clear any existing subs/buttons |
| 685 | 689 | IncrementButtonVersion; |
| 686 | 690 | |
| 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 | | |
| 702 | 691 | // not sure |
| 703 | 692 | if (m_autoselectsubtitle) |
| 704 | 693 | m_curSubtitleTrack = dvdnav_get_active_spu_stream(m_dvdnav); |
| … |
… |
int DVDRingBuffer::safe_read(void *data, uint sz)
|
| 778 | 767 | |
| 779 | 768 | // if we are in a looping menu, we don't want to reset the |
| 780 | 769 | // 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) |
| 782 | 774 | { |
| 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; |
| 790 | 776 | } |
| 791 | 777 | |
| 792 | 778 | // update our status |
| … |
… |
int DVDRingBuffer::safe_read(void *data, uint sz)
|
| 809 | 795 | } |
| 810 | 796 | } |
| 811 | 797 | |
| | 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 | |
| 812 | 816 | // debug |
| 813 | 817 | LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("DVDNAV_NAV_PACKET - time:%1, pos:%2, vob:%3, cell:%4, seeking:%5, seektime:%6") |
| 814 | 818 | .arg(m_currentTime) |
| … |
… |
int DVDRingBuffer::safe_read(void *data, uint sz)
|
| 867 | 871 | m_audioStreamsChanged = true; |
| 868 | 872 | } |
| 869 | 873 | |
| | 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 | |
| 870 | 880 | // release buffer |
| 871 | 881 | if (blockBuf != m_dvdBlockWriteBuf) |
| 872 | 882 | dvdnav_free_cache_block(m_dvdnav, blockBuf); |
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
|
| 183 | 183 | long long m_cellstartPos; |
| 184 | 184 | bool m_buttonSelected; |
| 185 | 185 | bool m_buttonExists; |
| | 186 | bool m_buttonSeenInCell; |
| | 187 | bool m_lastButtonSeenInCell; |
| 186 | 188 | int m_cellid; |
| 187 | 189 | int m_lastcellid; |
| 188 | 190 | int m_vobid; |