Ticket #11288: DVDPlaybackCleanup.diff
File DVDPlaybackCleanup.diff, 6.7 KB (added by , 11 years ago) |
---|
-
mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp
diff --git a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp index 8e89ddf..a27dfe5 100644
a b void AvFormatDecoderDVD::UpdateFramesPlayed(void) 26 26 m_parent->SetFramesPlayed(currentpos + 1); 27 27 } 28 28 29 bool AvFormatDecoderDVD::GetFrame(DecodeType decodetype) 30 { 31 // Always try to decode audio and video for DVDs 32 return AvFormatDecoder::GetFrame( kDecodeAV ); 33 } 34 29 35 void AvFormatDecoderDVD::PostProcessTracks(void) 30 36 { 31 37 if (!ringBuffer) -
mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h
diff --git a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h index 71fbc39..1b15425 100644
a b class AvFormatDecoderDVD : public AvFormatDecoder 10 10 PlayerFlags flags); 11 11 virtual void Reset(bool reset_video_data, bool seek_reset, bool reset_file); 12 12 virtual void UpdateFramesPlayed(void); 13 virtual bool GetFrame(DecodeType decodetype); // DecoderBase 13 14 14 15 private: 15 16 virtual bool DoRewindSeek(long long desiredFrame); -
mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp index e14296a..d8d7de9 100644
a b bool DVDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) 340 340 dvdnav_set_readahead_flag(m_dvdnav, 0); 341 341 dvdnav_set_PGC_positioning_flag(m_dvdnav, 1); 342 342 343 int32_t num_titles = 0;344 res = dvdnav_get_number_of_titles(m_dvdnav, &num_titles);345 if (num_titles == 0 || res == DVDNAV_STATUS_ERR)346 {347 char buf[DVD_BLOCK_SIZE * 5];348 LOG(VB_GENERAL, LOG_INFO,349 LOC + QString("Reading %1 bytes from the drive")350 .arg(DVD_BLOCK_SIZE * 5));351 safe_read(buf, DVD_BLOCK_SIZE * 5);352 res = dvdnav_get_number_of_titles(m_dvdnav, &num_titles);353 }354 355 if (res == DVDNAV_STATUS_ERR)356 {357 LOG(VB_GENERAL, LOG_ERR,358 LOC + QString("Failed to get the number of titles on the DVD" ));359 }360 else361 {362 LOG(VB_GENERAL, LOG_INFO,363 LOC + QString("There are %1 titles on the disk")364 .arg(num_titles));365 }366 367 int startTitle = 1;368 dvdnav_status_t result = DVDNAV_STATUS_ERR;369 while (startTitle <= num_titles)370 {371 result = dvdnav_title_play(m_dvdnav, startTitle);372 if (result == DVDNAV_STATUS_OK)373 break;374 else if (startTitle < num_titles)375 LOG(VB_GENERAL, LOG_WARNING, QString("Unable to play DVD title %1, "376 "trying next title")377 .arg(startTitle));378 startTitle++;379 }380 381 if (result == DVDNAV_STATUS_ERR)382 {383 LOG(VB_GENERAL, LOG_ERR, QString("Unable to play any title on this "384 "DVD. Disc may be damaged or "385 "corrupted as a means of copy "386 "protection."));387 388 rwlock.unlock();389 return false;390 }391 392 343 // Check we aren't starting in a still frame (which will probably fail as 393 344 // ffmpeg will be unable to create a decoder) 394 345 if (dvdnav_get_next_still_flag(m_dvdnav)) … … bool DVDRingBuffer::StartFromBeginning(void) 444 395 if (m_dvdnav) 445 396 { 446 397 QMutexLocker lock(&m_seekLock); 398 dvdnav_reset(m_dvdnav); 447 399 dvdnav_first_play(m_dvdnav); 448 400 m_audioStreamsChanged = true; 449 401 } -
mythtv/libs/libmythtv/avformatdecoder.cpp
diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp index 7284da3..5517954 100644
a b AvFormatDecoder::AvFormatDecoder(MythPlayer *parent, 335 335 // Audio 336 336 disable_passthru(false), 337 337 m_fps(0.0f), 338 codec_is_mpeg(false) 338 codec_is_mpeg(false), 339 m_processFrames(true) 339 340 { 340 341 memset(&readcontext, 0, sizeof(readcontext)); 341 342 memset(ccX08_in_pmt, 0, sizeof(ccX08_in_pmt)); … … void AvFormatDecoder::SeekReset(long long newKey, uint skipFrames, 685 686 if (!ringBuffer) 686 687 return; // nothing to reset... 687 688 688 if (ringBuffer->IsInDiscMenuOrStillFrame() || newKey == 0)689 return;690 691 689 LOG(VB_PLAYBACK, LOG_INFO, LOC + 692 690 QString("SeekReset(%1, %2, %3 flush, %4 discard)") 693 691 .arg(newKey).arg(skipFrames) … … int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 936 934 937 935 ringBuffer = rbuffer; 938 936 937 // Process frames immediately unless we're decoding 938 // a DVD, in which case don't so that we don't show 939 // anything whilst probing the data streams. 940 m_processFrames = !ringBuffer->IsDVD(); 941 939 942 if (avfRingBuffer) 940 943 delete avfRingBuffer; 941 944 avfRingBuffer = new AVFRingBuffer(rbuffer); … … int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 983 986 } 984 987 985 988 int ret = FindStreamInfo(); 986 987 // Reset DVD/bluray ringbuffers988 if (!ringBuffer->StartFromBeginning())989 return -1;990 ringBuffer->IgnoreWaitStates(false);991 992 989 if (ret < 0) 993 990 { 994 991 LOG(VB_GENERAL, LOG_ERR, LOC + "Could not find codec parameters. " + … … int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 1144 1141 if (getenv("FORCE_DTS_TIMESTAMPS")) 1145 1142 force_dts_timestamps = true; 1146 1143 1144 if (ringBuffer->IsDVD()) 1145 { 1146 // Reset DVD playback and clear any of 1147 // our buffers so that none of the data 1148 // parsed so far to determine decoders 1149 // gets shown. 1150 if (!ringBuffer->StartFromBeginning()) 1151 return -1; 1152 ringBuffer->IgnoreWaitStates(false); 1153 1154 Reset(true, true, true); 1155 1156 // Now we're ready to process and show frames 1157 m_processFrames = true; 1158 } 1159 1160 1147 1161 // Return true if recording has position map 1148 1162 return recordingHasPositionMap; 1149 1163 } … … bool AvFormatDecoder::GetFrame(DecodeType decodetype) 4468 4482 4469 4483 skipaudio = (lastvpts == 0); 4470 4484 4485 if( !m_processFrames ) 4486 { 4487 return false; 4488 } 4489 4471 4490 hasVideo = HasVideo(ic); 4472 4491 needDummyVideoFrames = false; 4473 4492 -
mythtv/libs/libmythtv/avformatdecoder.h
diff --git a/mythtv/libs/libmythtv/avformatdecoder.h b/mythtv/libs/libmythtv/avformatdecoder.h index 3d0ec2a..11b3914 100644
a b class AvFormatDecoder : public DecoderBase 358 358 359 359 float m_fps; 360 360 bool codec_is_mpeg; 361 bool m_processFrames; 361 362 }; 362 363 363 364 #endif