Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp
- index 0fb91b1..a6c423d 100644
- --- a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp
- +++ b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp
- @@ -26,6 +26,12 @@ void AvFormatDecoderDVD::UpdateFramesPlayed(void)
- m_parent->SetFramesPlayed(currentpos + 1);
- }
- +bool AvFormatDecoderDVD::GetFrame(DecodeType decodetype)
- +{
- + // Always try to decode audio and video for DVDs
- + return AvFormatDecoder::GetFrame( kDecodeAV );
- +}
- +
- void AvFormatDecoderDVD::PostProcessTracks(void)
- {
- if (!ringBuffer)
- diff --git a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h
- index 4c9c15d..5044ba4 100644
- --- a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h
- +++ b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h
- @@ -10,6 +10,7 @@ class AvFormatDecoderDVD : public AvFormatDecoder
- PlayerFlags flags);
- virtual void Reset(bool reset_video_data, bool seek_reset, bool reset_file);
- virtual void UpdateFramesPlayed(void);
- + virtual bool GetFrame(DecodeType decodetype); // DecoderBase
- private:
- virtual bool DoRewindSeek(long long desiredFrame);
- diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
- index 0913fe2..1a21400 100644
- --- a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
- +++ b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
- @@ -340,55 +340,6 @@ bool DVDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
- dvdnav_set_readahead_flag(m_dvdnav, 0);
- dvdnav_set_PGC_positioning_flag(m_dvdnav, 1);
- - int32_t num_titles = 0;
- - res = dvdnav_get_number_of_titles(m_dvdnav, &num_titles);
- - if (num_titles == 0 || res == DVDNAV_STATUS_ERR)
- - {
- - char buf[DVD_BLOCK_SIZE * 5];
- - LOG(VB_GENERAL, LOG_INFO,
- - LOC + QString("Reading %1 bytes from the drive")
- - .arg(DVD_BLOCK_SIZE * 5));
- - safe_read(buf, DVD_BLOCK_SIZE * 5);
- - res = dvdnav_get_number_of_titles(m_dvdnav, &num_titles);
- - }
- -
- - if (res == DVDNAV_STATUS_ERR)
- - {
- - LOG(VB_GENERAL, LOG_ERR,
- - LOC + QString("Failed to get the number of titles on the DVD" ));
- - }
- - else
- - {
- - LOG(VB_GENERAL, LOG_INFO,
- - LOC + QString("There are %1 titles on the disk")
- - .arg(num_titles));
- - }
- -
- - int startTitle = 1;
- - dvdnav_status_t result;
- - while (startTitle <= num_titles)
- - {
- - result = dvdnav_title_play(m_dvdnav, startTitle);
- - if (result == DVDNAV_STATUS_OK)
- - break;
- - else if (startTitle < num_titles)
- - LOG(VB_GENERAL, LOG_WARNING, QString("Unable to play DVD title %1, "
- - "trying next title")
- - .arg(startTitle));
- - startTitle++;
- - }
- -
- - if (result == DVDNAV_STATUS_ERR)
- - {
- - LOG(VB_GENERAL, LOG_ERR, QString("Unable to play any title on this "
- - "DVD. Disc may be damaged or "
- - "corrupted as a means of copy "
- - "protection."));
- -
- - rwlock.unlock();
- - return false;
- - }
- -
- // Check we aren't starting in a still frame (which will probably fail as
- // ffmpeg will be unable to create a decoder)
- if (dvdnav_get_next_still_flag(m_dvdnav))
- @@ -444,6 +395,7 @@ bool DVDRingBuffer::StartFromBeginning(void)
- if (m_dvdnav)
- {
- QMutexLocker lock(&m_seekLock);
- + dvdnav_reset(m_dvdnav);
- dvdnav_first_play(m_dvdnav);
- m_audioStreamsChanged = true;
- }
- diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
- index 29f8dbb..5a4d965 100644
- --- a/mythtv/libs/libmythtv/avformatdecoder.cpp
- +++ b/mythtv/libs/libmythtv/avformatdecoder.cpp
- @@ -335,7 +335,8 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent,
- // Audio
- disable_passthru(false),
- m_fps(0.0f),
- - codec_is_mpeg(false)
- + codec_is_mpeg(false),
- + m_processFrames(true)
- {
- memset(&readcontext, 0, sizeof(readcontext));
- memset(ccX08_in_pmt, 0, sizeof(ccX08_in_pmt));
- @@ -684,9 +685,6 @@ bool AvFormatDecoder::DoFastForward(long long desiredFrame, bool discardFrames)
- void AvFormatDecoder::SeekReset(long long newKey, uint skipFrames,
- bool doflush, bool discardFrames)
- {
- - if (ringBuffer->IsInDiscMenuOrStillFrame() || newKey == 0)
- - return;
- -
- LOG(VB_PLAYBACK, LOG_INFO, LOC +
- QString("SeekReset(%1, %2, %3 flush, %4 discard)")
- .arg(newKey).arg(skipFrames)
- @@ -935,6 +933,11 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,
- ringBuffer = rbuffer;
- + // Process frames immediately unless we're decoding
- + // a DVD, in which case don't so that we don't show
- + // anything whilst probing the data streams.
- + m_processFrames = !ringBuffer->IsDVD();
- +
- if (avfRingBuffer)
- delete avfRingBuffer;
- avfRingBuffer = new AVFRingBuffer(rbuffer);
- @@ -982,12 +985,6 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,
- }
- int ret = FindStreamInfo();
- -
- - // Reset DVD/bluray ringbuffers
- - if (!ringBuffer->StartFromBeginning())
- - return -1;
- - ringBuffer->IgnoreWaitStates(false);
- -
- if (ret < 0)
- {
- LOG(VB_GENERAL, LOG_ERR, LOC + "Could not find codec parameters. " +
- @@ -1144,6 +1141,23 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,
- if (getenv("FORCE_DTS_TIMESTAMPS"))
- force_dts_timestamps = true;
- + if (ringBuffer->IsDVD())
- + {
- + // Reset DVD playback and clear any of
- + // our buffers so that none of the data
- + // parsed so far to determine decoders
- + // gets shown.
- + if (!ringBuffer->StartFromBeginning())
- + return -1;
- + ringBuffer->IgnoreWaitStates(false);
- +
- + Reset(true, true, true);
- +
- + // Now we're ready to process and show frames
- + m_processFrames = true;
- + }
- +
- +
- // Return true if recording has position map
- return recordingHasPositionMap;
- }
- @@ -4418,6 +4432,11 @@ bool AvFormatDecoder::GetFrame(DecodeType decodetype)
- skipaudio = (lastvpts == 0);
- + if( !m_processFrames )
- + {
- + return false;
- + }
- +
- hasVideo = HasVideo(ic);
- needDummyVideoFrames = false;
- diff --git a/mythtv/libs/libmythtv/avformatdecoder.h b/mythtv/libs/libmythtv/avformatdecoder.h
- index 5a97dfd..012eb08 100644
- --- a/mythtv/libs/libmythtv/avformatdecoder.h
- +++ b/mythtv/libs/libmythtv/avformatdecoder.h
- @@ -360,6 +360,7 @@ class AvFormatDecoder : public DecoderBase
- float m_fps;
- bool codec_is_mpeg;
- + bool m_processFrames;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement