Ticket #8375: start_dvd_from_beginning_after_24233.diff

File start_dvd_from_beginning_after_24233.diff, 3.5 KB (added by skamithi, 10 years ago)

create dvdnav function called startfrombeginning() used after av_find_stream_info in AFD.

  • mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h

    diff --git a/mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h b/mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h
    index 1e4c825..55f4213 100644
    a b dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *self, int32_t *titles); 
    272272dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *self, int32_t title, int32_t *parts);
    273273
    274274/*
     275 * Play DVD from the Beginning
     276*/
     277void dvdnav_first_play(dvdnav_t *self);
     278
     279/*
    275280 * Plays the specified title of the DVD from its beginning (that is: part 1).
    276281 */
    277282dvdnav_status_t dvdnav_title_play(dvdnav_t *self, int32_t title);
  • mythtv/libs/libmythdvdnav/dvdnav/navigation.c

    diff --git a/mythtv/libs/libmythdvdnav/dvdnav/navigation.c b/mythtv/libs/libmythdvdnav/dvdnav/navigation.c
    index a89448a..c13787a 100644
    a b dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int32_t *title, int32_ 
    122122  return DVDNAV_STATUS_ERR;
    123123}
    124124
     125void dvdnav_first_play(dvdnav_t *this) {
     126  pthread_mutex_lock(&this->vm_lock);
     127  this->started = 0;
     128  vm_start(this->vm);
     129  this->started = 1;
     130  pthread_mutex_unlock(&this->vm_lock);
     131}
     132
    125133dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int32_t title) {
    126134  return dvdnav_part_play(this, title, 1);
    127135}
    dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int32_t title, int32_t part) { 
    135143    pthread_mutex_unlock(&this->vm_lock);
    136144    return DVDNAV_STATUS_ERR;
    137145  }
    138   if (!this->started) {
    139     /* don't report an error but be nice */
    140     vm_start(this->vm);
    141     this->started = 1;
    142   }
     146 
     147  pthread_mutex_unlock(&this->vm_lock);
     148  if (!this->started)
     149    dvdnav_first_play(this);
     150  pthread_mutex_lock(&this->vm_lock);
     151
     152
    143153  if (!this->vm->state.pgc) {
    144154    printerr("No current PGC.");
    145155    pthread_mutex_unlock(&this->vm_lock);
  • mythtv/libs/libmythtv/DVDRingBuffer.cpp

    diff --git a/mythtv/libs/libmythtv/DVDRingBuffer.cpp b/mythtv/libs/libmythtv/DVDRingBuffer.cpp
    index 43e5ce5..5fbe93a 100644
    a b bool DVDRingBufferPriv::OpenFile(const QString &filename) 
    226226    }
    227227}
    228228
     229
     230void DVDRingBufferPriv::StartFromBeginning(void)
     231{
     232    if (m_dvdnav)
     233    {
     234        QMutexLocker lock(&m_seekLock);
     235        dvdnav_first_play(m_dvdnav);
     236    }
     237}
     238
    229239/** \brief returns current position in the PGC.
    230240 */
    231241long long DVDRingBufferPriv::GetReadPosition(void)
  • mythtv/libs/libmythtv/DVDRingBuffer.h

    diff --git a/mythtv/libs/libmythtv/DVDRingBuffer.h b/mythtv/libs/libmythtv/DVDRingBuffer.h
    index 39d8ef6..bde9734 100644
    a b class MPUBLIC DVDRingBufferPriv 
    8080    bool OpenFile(const QString &filename);
    8181    void PlayTitleAndPart(int _title, int _part)
    8282        { dvdnav_part_play(m_dvdnav, _title, _part); }
     83    void StartFromBeginning(void);
    8384    void CloseDVD(void);
    8485    bool nextTrack(void);
    8586    void prevTrack(void);
  • mythtv/libs/libmythtv/avformatdecoder.cpp

    diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
    index 2b2c290..283cd67 100644
    a b int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 
    11431143    }
    11441144    if (ringBuffer->isDVD())
    11451145    {
    1146         ringBuffer->Seek(0, SEEK_SET);
     1146        ringBuffer->DVD()->StartFromBeginning();
    11471147        ringBuffer->DVD()->IgnoreStillOrWait(false);
    11481148    }
    1149 
    11501149    if (ret < 0)
    11511150    {
    11521151        VERBOSE(VB_IMPORTANT, LOC_ERR + "Could not find codec parameters. " +