diff --git a/mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h b/mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h index 522ba9db92c..c545ca6cbd2 100644 --- a/mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h +++ b/mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h @@ -261,6 +261,11 @@ dvdnav_status_t dvdnav_stop(dvdnav_t *self); * title/part navigation * *********************************************************************/ +/* + * Play DVD from the Beginning + */ +void dvdnav_first_play(dvdnav_t *self); + /* * Returns the number of titles on the disk. */ diff --git a/mythtv/libs/libmythdvdnav/dvdnav/navigation.c b/mythtv/libs/libmythdvdnav/dvdnav/navigation.c index c91f61b66d9..07e02a607e2 100644 --- a/mythtv/libs/libmythdvdnav/dvdnav/navigation.c +++ b/mythtv/libs/libmythdvdnav/dvdnav/navigation.c @@ -169,6 +169,14 @@ dvdnav_status_t dvdnav_current_title_program(dvdnav_t *this, int32_t *title, int return DVDNAV_STATUS_ERR; } +void dvdnav_first_play(dvdnav_t *this) { + pthread_mutex_lock(&this->vm_lock); + this->started = 0; + vm_start(this->vm); + this->started = 1; + pthread_mutex_unlock(&this->vm_lock); +} + dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int32_t title) { return dvdnav_part_play(this, title, 1); } diff --git a/mythtv/libs/libmythtv/dvdringbuffer.cpp b/mythtv/libs/libmythtv/dvdringbuffer.cpp index 3126a754f7e..617fac4ca40 100644 --- a/mythtv/libs/libmythtv/dvdringbuffer.cpp +++ b/mythtv/libs/libmythtv/dvdringbuffer.cpp @@ -141,6 +141,8 @@ void DVDRingBuffer::CloseDVD(void) dvdnav_close(m_dvdnav); m_dvdnav = NULL; } + m_gotStop = false; + m_audioStreamsChanged = true; } void DVDRingBuffer::ClearChapterCache(void) @@ -299,10 +301,7 @@ bool DVDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) rwlock.lockForWrite(); if (m_dvdnav) - { - dvdnav_close(m_dvdnav); - m_dvdnav = NULL; - } + CloseDVD(); filename = lfilename; QByteArray fname = filename.toLocal8Bit(); @@ -412,9 +411,6 @@ bool DVDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) bool DVDRingBuffer::StartFromBeginning(void) { - if (!m_dvdnav) - return false; - VERBOSE(VB_IMPORTANT, LOC + "Resetting DVD device."); // if a DVDNAV_STOP event has been emitted, dvdnav_reset does not @@ -424,20 +420,19 @@ bool DVDRingBuffer::StartFromBeginning(void) VERBOSE(VB_IMPORTANT, LOC + "DVD errored after initial scan - trying again"); CloseDVD(); - m_gotStop = false; OpenFile(filename); if (!m_dvdnav) - { VERBOSE(VB_IMPORTANT, LOC + "Failed to re-open DVD."); - return false; - } } - QMutexLocker lock(&m_seekLock); - dvdnav_reset(m_dvdnav); - dvdnav_title_play(m_dvdnav, 0); - m_audioStreamsChanged = true; - return true; + if (m_dvdnav) + { + QMutexLocker lock(&m_seekLock); + dvdnav_first_play(m_dvdnav); + m_audioStreamsChanged = true; + } + + return m_dvdnav; } void DVDRingBuffer::GetChapterTimes(QList ×)