Skip to content

Commit

Permalink
Add additional logic when performing the 'BACK' action on a DVD to av…
Browse files Browse the repository at this point in the history
…oid getting stuck.

[b16ccb6] relaxed the definition of a menu to any time one or more buttons are defined.  This can make it difficult to exit playback with the 'BACK' action if a DVD is authored such that the title or root jump points do not contain buttons (but maybe show several minutes of trailers before getting to the menu).

Fixes #11649
  • Loading branch information
peper03 committed Jul 10, 2013
1 parent 81fb515 commit 144f5e7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
6 changes: 4 additions & 2 deletions mythtv/libs/libmythdvdnav/dvdnav/navigation.c
Expand Up @@ -276,9 +276,11 @@ dvdnav_status_t dvdnav_stop(dvdnav_t *this) {

dvdnav_status_t dvdnav_go_up(dvdnav_t *this) {
/* A nice easy function... delegate to the VM */
int32_t retval;

pthread_mutex_lock(&this->vm_lock);
vm_jump_up(this->vm);
retval = vm_jump_up(this->vm);
pthread_mutex_unlock(&this->vm_lock);

return DVDNAV_STATUS_OK;
return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
}
46 changes: 46 additions & 0 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
Expand Up @@ -1341,6 +1341,52 @@ bool DVDRingBuffer::GoToMenu(const QString str)
return false;
}

/** \brief Attempts to back-up by trying to jump to the 'Go up' PGC,
* the root menu or the title menu in turn.
* \return true if a jump was possible, false if not.
*/
bool DVDRingBuffer::GoBack(void)
{
bool success = false;
QString target;

QMutexLocker locker(&m_seekLock);

if (dvdnav_is_domain_vts(m_dvdnav) && !m_inMenu)
{
if(dvdnav_go_up(m_dvdnav) == DVDNAV_STATUS_OK)
{
target = "GoUp";
success = true;
}
else
if(dvdnav_menu_call(m_dvdnav, DVD_MENU_Root) == DVDNAV_STATUS_OK)
{
target = "Root";
success = true;
}
else
if(dvdnav_menu_call(m_dvdnav, DVD_MENU_Title) == DVDNAV_STATUS_OK)
{
target = "Title";
success = true;
}
else
{
target = "Nothing available";
}
}
else
{
target = QString("No jump, %1 menu").arg(m_inMenu ? "in" : "not in");
}

LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString("DVDRingBuf: GoBack - %1").arg(target));

return success;
}

void DVDRingBuffer::GoToNextProgram(void)
{
QMutexLocker locker(&m_seekLock);
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/DVD/dvdringbuffer.h
Expand Up @@ -165,6 +165,7 @@ class MTV_PUBLIC DVDRingBuffer : public RingBuffer
bool GoToMenu(const QString str);
void GoToNextProgram(void);
void GoToPreviousProgram(void);
bool GoBack(void);

virtual void IgnoreWaitStates(bool ignore) { m_skipstillorwait = ignore; }
void AudioStreamsChanged(bool change) { m_audioStreamsChanged = change; }
Expand Down
7 changes: 2 additions & 5 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -4463,14 +4463,11 @@ bool TV::ActiveHandleAction(PlayerContext *ctx,
else
{
// If it's a DVD, and we're not trying to execute a
// jumppoint, and it's not in a menu, then first try
// jumping to the title or root menu.
// jumppoint, try to back up.
if (isDVD &&
!GetMythMainWindow()->IsExitingToMain() &&
has_action("BACK", actions) &&
!ctx->buffer->DVD()->IsInMenu() &&
(ctx->player->GoToMenu("title") ||
ctx->player->GoToMenu("root")))
ctx->buffer->DVD()->GoBack())
{
return handled;
}
Expand Down

0 comments on commit 144f5e7

Please sign in to comment.