Skip to content
Permalink
Browse files

DVD startup fixes.

- 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
Mark Kendall committed May 13, 2011
1 parent eecbc99 commit ec474d0b3eea4506b7a36612eea3397e054b406d
@@ -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.
*/
@@ -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);
}
@@ -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<long long> &times)

0 comments on commit ec474d0

Please sign in to comment.
You can’t perform that action at this time.