Skip to content

Commit

Permalink
DVD startup fixes.
Browse files Browse the repository at this point in the history
- re-implement the dvdnav_first_play method that Stanley Skamithi added
some time ago and I removed some time later...

- minor tidy up of the CloseDVD method.

- use the dvdnav_first_play call when 're-starting' the dvd following
the codec scan.

Closes #9143
  • Loading branch information
Mark Kendall committed May 13, 2011
1 parent eecbc99 commit ec474d0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
5 changes: 5 additions & 0 deletions mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h
Expand Up @@ -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.
*/
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythdvdnav/dvdnav/navigation.c
Expand Up @@ -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);
}
Expand Down
27 changes: 11 additions & 16 deletions mythtv/libs/libmythtv/dvdringbuffer.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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<long long> &times)
Expand Down

0 comments on commit ec474d0

Please sign in to comment.