MythTV  master
mythdvddecoder.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "iso639.h"
3 #include "mythdvdbuffer.h"
4 #include "mythdvdplayer.h"
5 #include "mythdvddecoder.h"
6 
7 // FFmpeg
8 extern "C" {
9 #include "libavcodec/avcodec.h"
10 }
11 
12 // Std
13 #include <thread>
14 
15 #define LOC QString("DVDDec: ")
16 
18  : AvFormatDecoder(Parent, PGInfo, Flags)
19 {
20 }
21 
23 {
26 
27  while (!m_contextList.empty())
28  m_contextList.takeFirst()->DecrRef();
29 
31 }
32 
34 {
35  if (m_lastVideoPkt)
36  {
37  av_packet_unref(m_lastVideoPkt);
38  delete m_lastVideoPkt;
39  m_lastVideoPkt = nullptr;
41  }
42 }
43 
45 {
46  if (Context)
47  {
48  Context->DecrRef();
49  Context = nullptr;
50  }
51 }
52 
53 void MythDVDDecoder::Reset(bool ResetVideoData, bool SeekReset, bool ResetFile)
54 {
55  AvFormatDecoder::Reset(ResetVideoData, SeekReset, ResetFile);
57 }
58 
59 
61 {
62  if (!m_ringBuffer->IsDVD())
63  return;
64 
65  auto currentpos = static_cast<long long>(m_ringBuffer->DVD()->GetCurrentTime().count() * m_fps);
66  m_framesPlayed = m_framesRead = currentpos ;
67  m_parent->SetFramesPlayed(static_cast<uint64_t>(currentpos + 1));
68 }
69 
70 bool MythDVDDecoder::GetFrame(DecodeType /*Type*/, bool &Retry)
71 {
72  // Always try to decode audio and video for DVDs
73  return AvFormatDecoder::GetFrame(kDecodeAV, Retry);
74 }
75 
76 int MythDVDDecoder::ReadPacket(AVFormatContext *Ctx, AVPacket* Pkt, bool& StorePacket)
77 {
78  int result = 0;
79 
80  if (m_framesReq > 0)
81  {
82  m_framesReq--;
83 
84  if (m_lastVideoPkt)
85  {
86  av_packet_ref(Pkt, m_lastVideoPkt);
87  if (m_lastVideoPkt->pts != AV_NOPTS_VALUE)
88  m_lastVideoPkt->pts += Pkt->duration;
89  if (m_lastVideoPkt->dts != AV_NOPTS_VALUE)
90  m_lastVideoPkt->dts += Pkt->duration;
91  }
92  else
93  {
94  LOG(VB_GENERAL, LOG_ERR, LOC + QString( "Need to generate frame @ %1 - %2 but no frame available!")
95  .arg(Pkt->pts).arg(m_framesReq));
96  }
97  }
98  else
99  {
100  bool gotPacket = false;
101 
102  do
103  {
104  gotPacket = true;
105 
106  do
107  {
109  {
110  int32_t lastEvent = m_ringBuffer->DVD()->GetLastEvent();
111  switch(lastEvent)
112  {
113  case DVDNAV_HOP_CHANNEL:
114  // Non-seamless jump - clear all buffers
115  m_framesReq = 0;
117  while (!m_contextList.empty())
118  m_contextList.takeFirst()->DecrRef();
119  Reset(true, false, false);
120  m_audio->Reset();
121  m_parent->DiscardVideoFrames(false, false);
122  // During a seek, the Reset call above resets the frames played
123  // to zero - so we need to re-establish our position. Playback
124  // appears unaffected by removing the Reset call - but better
125  // safe than sorry when it comes to DVD so just update
126  // the frames played.
128  break;
129 
130  case DVDNAV_WAIT:
131  case DVDNAV_STILL_FRAME:
132  if (m_storedPackets.count() > 0)
133  {
134  // Ringbuffer is waiting for the player
135  // to empty its buffers but we have one or
136  // more frames in our buffer that have not
137  // yet been sent to the player.
138  // Make sure no more frames will be buffered
139  // for the time being and start emptying our
140  // buffer.
141 
142  // Force AvFormatDecoder to stop buffering frames
143  StorePacket = false;
144  // Return the first buffered packet
145  AVPacket *storedPkt = m_storedPackets.takeFirst();
146  av_packet_ref(Pkt, storedPkt);
147  av_packet_unref(storedPkt);
148  delete storedPkt;
149  return 0;
150  }
151  break;
152 
153  case DVDNAV_NAV_PACKET:
154  // Don't need to do anything here. There was a timecode discontinuity
155  // and the ringbuffer returned to make sure that any packets still in
156  // ffmpeg's buffers were flushed.
157  break;
158  default:
159  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Unexpected DVD event - %1")
160  .arg(lastEvent));
161  break;
162  }
163 
165  }
166 
167  m_avCodecLock.lock();
168  result = av_read_frame(Ctx, Pkt);
169  m_avCodecLock.unlock();
170 
171  // Make sure we yield. Otherwise other threads may not
172  // get chance to take the lock. Shouldn't be necessary
173  // but calling up the OSD menu in a still frame without
174  // this still causes a deadlock.
175  std::this_thread::yield();
176  } while (m_ringBuffer->DVD()->IsReadingBlocked());
177 
178  if (result >= 0)
179  {
180  Pkt->dts = m_ringBuffer->DVD()->AdjustTimestamp(Pkt->dts);
181  Pkt->pts = m_ringBuffer->DVD()->AdjustTimestamp(Pkt->pts);
182 
183  if (m_returnContext)
184  {
185  // We've jumped in a slideshow and have had to jump again
186  // to find the right video packet to show so only allow
187  // the packets through that let us find it.
188  gotPacket = false;
189 
190  AVStream *curstream = m_ic->streams[Pkt->stream_index];
191 
192  if ((curstream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) ||
193  (curstream->codecpar->codec_id == AV_CODEC_ID_DVD_NAV))
194  {
195  // Allow video or NAV packets through
196  gotPacket = true;
197  }
198  }
199  }
200  } while(!gotPacket);
201  }
202 
203  return result;
204 }
205 
207 {
208  if (Pts != AV_NOPTS_VALUE)
209  {
210  // Remove any contexts we should have
211  // already processed.(but have somehow jumped past)
212  while (!m_contextList.empty() && (Pts >= m_contextList.first()->GetEndPTS()))
213  {
215  m_curContext = m_contextList.takeFirst();
216  LOG(VB_GENERAL, LOG_ERR, LOC + QString("DVD context missed! lba: %1, curpts: %2, nav end pts: %3")
217  .arg(m_curContext->GetLBA()).arg(Pts).arg(m_curContext->GetEndPTS()));
218  }
219 
220  // See whether we can take the next context from the list
221  if (!m_contextList.empty() && (Pts >= m_contextList.first()->GetStartPTS()))
222  {
224  m_curContext = m_contextList.takeFirst();
225 
228 
229  if (m_curContext->GetNumFramesPresent() == 0)
230  {
231  if (m_lastVideoPkt)
232  {
233  // No video frames present, so we need to generate
234  // them based on the last 'sequence end' video packet.
236  }
237  else
238  {
239  // There are no video frames in this VOBU and
240  // we don't have one stored. We've probably
241  // jumped into the middle of a cell.
242  // Jump back to the first VOBU that contains
243  // video so we can get the video frame we need
244  // before jumping back again.
245  m_framesReq = 0;
246  uint32_t lastVideoSector = m_curContext->GetLBAPrevVideoFrame();
247 
248  if (lastVideoSector != INVALID_LBA)
249  {
250  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Missing video. Jumping to sector %1")
251  .arg(lastVideoSector));
252  m_ringBuffer->DVD()->SectorSeek(lastVideoSector);
254  m_curContext = nullptr;
255  }
256  else
257  {
258  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Missing video frame and no previous frame available! lba: %1")
259  .arg(m_curContext->GetLBA()));
260  }
261  }
262  }
263  else
264  {
265  // Normal VOBU with at least one video frame so we don't need to generate frames.
266  m_framesReq = 0;
268  }
269  }
270  }
271 }
272 
273 
274 bool MythDVDDecoder::ProcessVideoPacket(AVStream *Stream, AVPacket *Pkt, bool &Retry)
275 {
276  int64_t pts = Pkt->pts;
277 
278  if (pts == AV_NOPTS_VALUE)
279  pts = Pkt->dts;
280 
281  CheckContext(pts);
282 
283  bool ret = AvFormatDecoder::ProcessVideoPacket(Stream, Pkt, Retry);
284  if (Retry)
285  return ret;
286 
287  if (ret && m_curContext && (pts != AV_NOPTS_VALUE) && (pts + Pkt->duration == m_curContext->GetSeqEndPTS()))
288  {
289  // If this video frame is the last in the sequence,
290  // make a copy of it so we can 'generate' more
291  // to fill in the gaps (e.g. when a single frame
292  // should be displayed with audio)
293  if (!m_lastVideoPkt)
294  {
295  m_lastVideoPkt = new AVPacket;
296  memset(m_lastVideoPkt, 0, sizeof(AVPacket));
297  }
298  else
299  {
300  av_packet_unref(m_lastVideoPkt);
301  }
302 
303  av_init_packet(m_lastVideoPkt);
304  av_packet_ref(m_lastVideoPkt, Pkt);
306 
307  if (m_returnContext)
308  {
309  // After seeking in a slideshow, we needed to find
310  // the previous video frame to display.
311  // We've found it now, so we need to jump back to
312  // where we originally wanted to be.
313  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString( "Found video packet, jumping back to sector %1")
314  .arg(m_returnContext->GetLBA()));
315 
318  }
319  else
320  {
321  if (m_lastVideoPkt->pts != AV_NOPTS_VALUE)
322  m_lastVideoPkt->pts += Pkt->duration;
323 
324  if (m_lastVideoPkt->dts != AV_NOPTS_VALUE)
325  m_lastVideoPkt->dts += Pkt->duration;
326 
328 
329  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString( "SeqEnd @ %1 - require %2 frame(s)")
330  .arg(Pkt->pts).arg(m_framesReq));
331  }
332  }
333 
334  return ret;
335 }
336 
338 {
339  bool ret = true;
340 
341  if (m_returnContext == nullptr)
342  {
343  // Only process video frames if we're not searching for
344  // the previous video frame after seeking in a slideshow.
346  }
347 
348  return ret;
349 }
350 
351 bool MythDVDDecoder::ProcessDataPacket(AVStream *Curstream, AVPacket *Pkt,
352  DecodeType Decodetype)
353 {
354  bool ret = true;
355 
356  if (Curstream->codecpar->codec_id == AV_CODEC_ID_DVD_NAV)
357  {
358  MythDVDContext* context = m_ringBuffer->DVD()->GetDVDContext();
359 
360  if (context)
361  m_contextList.append(context);
362 
363  if ((m_curContext == nullptr) && (!m_contextList.empty()))
364  {
365  // If we don't have a current context, use
366  // the first in the list
367  CheckContext(m_contextList.first()->GetStartPTS());
368 
370  {
371  // If there was no current context but there was
372  // a video packet, we've almost certainly been
373  // seeking so set the timestamps of the video
374  // packet to the new context to ensure we don't
375  // get sync errors.
377  m_lastVideoPkt->dts = m_lastVideoPkt->pts;
378  }
379  }
380  else if (m_lastVideoPkt)
381  {
382  // If we've been generating frames, see whether this
383  // new context should be used already (handles
384  // situations where a VOBU consists of only a NAV
385  // packet and nothing else)
387  }
388  }
389  else
390  {
391  ret = AvFormatDecoder::ProcessDataPacket(Curstream, Pkt, Decodetype);
392  }
393 
394  return ret;
395 }
396 
398 {
399  if (!m_ringBuffer)
400  return;
401  if (!m_ringBuffer->IsDVD())
402  return;
403 
404  QMutexLocker locker(&m_trackLock);
405 
406  if (m_tracks[kTrackTypeAudio].size() > 1)
407  {
408  stable_sort(m_tracks[kTrackTypeAudio].begin(), m_tracks[kTrackTypeAudio].end());
409 
410  int trackNo = -1;
411  int dvdTrack = m_ringBuffer->DVD()->GetTrack(kTrackTypeAudio);
412 
413  for (uint i = 0; i < m_tracks[kTrackTypeAudio].size(); i++)
414  {
415  LOG(VB_PLAYBACK, LOG_INFO, LOC +
416  QString("DVD Audio Track Map Stream id #%1, av_stream_idx %2, MPEG stream 0x%3, lang %4")
417  .arg(m_tracks[kTrackTypeAudio][i].m_stream_id)
418  .arg(m_tracks[kTrackTypeAudio][i].m_av_stream_index)
419  .arg(m_ic->streams[m_tracks[kTrackTypeAudio][i].m_av_stream_index]->id,0,16)
420  .arg(iso639_key_toName(m_tracks[kTrackTypeAudio][i].m_language)));
421 
422  // Find the audio track in our list that maps to the
423  // selected track in the ringbuffer (the ringbuffer's
424  // list should be in the same order but can have gaps,
425  // so we look for the track with the same index)
426  if (m_tracks[kTrackTypeAudio][i].m_stream_id == dvdTrack)
427  trackNo = static_cast<int>(i);
428  }
429 
430  if (trackNo < 0 && (!m_tracks[kTrackTypeAudio].empty()))
431  {
432  // Take the first track
433  trackNo = 0;
434  }
435 
436  if (trackNo >= 0)
437  SetTrack(kTrackTypeAudio, trackNo);
438  }
439 
440  if (!m_tracks[kTrackTypeSubtitle].empty())
441  {
442  std::map<int,uint> lang_sub_cnt;
443  std::map<int,int> stream2idx;
444 
445  // First, create a map containing stream id -> track index
446  // of the subtitle streams that have been found so far.
447  for (uint n = 0; n < m_tracks[kTrackTypeSubtitle].size(); n++)
448  {
449  int stream_id = m_tracks[kTrackTypeSubtitle][n].m_stream_id & 0x1f;
450  stream2idx[stream_id] = static_cast<int>(n);
451  }
452 
453  // Get all subtitle tracks from the DVD and filter out any that
454  // are not mapped in the current program chain.
455  sinfo_vec_t filteredTracks;
456 
457  if (!m_ringBuffer->DVD()->IsInMenu())
458  {
459  for (uint i = 0; i < 32; ++i)
460  {
461  int8_t streamid = m_ringBuffer->DVD()->GetSubtitleTrackNum(i);
462  if (streamid >= 0)
463  {
464  // This stream is mapped in the current program chain
465  int lang = static_cast<int>(m_ringBuffer->DVD()->GetSubtitleLanguage(static_cast<int>(i)));
466  int lang_indx = static_cast<int>(lang_sub_cnt[lang]++);
467  int trackNo = -1;
468 
469  if (stream2idx.count(streamid) != 0)
470  trackNo = stream2idx[streamid];
471 
472  if (trackNo == -1)
473  {
474  // Create a dummy track if the physical stream has not
475  // yet been seen.
476  filteredTracks.push_back(StreamInfo(-1, lang, static_cast<uint>(lang_indx),
477  streamid, 0, 0, false, false, false));
478  }
479  else
480  {
481  // Otherwise use the real data
482  filteredTracks.push_back(m_tracks[kTrackTypeSubtitle][static_cast<uint>(trackNo)]);
483  filteredTracks.back().m_stream_id &= 0x1f;
484  filteredTracks.back().m_language = lang;
485  filteredTracks.back().m_language_index = static_cast<uint>(lang_indx);
486  }
487  }
488  }
489  }
490 
491  m_tracks[kTrackTypeSubtitle] = filteredTracks;
492  stable_sort(m_tracks[kTrackTypeSubtitle].begin(), m_tracks[kTrackTypeSubtitle].end());
493 
494  int track = -1;
495  int selectedStream = m_ringBuffer->DVD()->GetTrack(kTrackTypeSubtitle);
496 
497  // Now iterate over the sorted list and try to find the index of the
498  // currently selected track.
499  for (uint idx = 0; idx < m_tracks[kTrackTypeSubtitle].size(); idx++)
500  {
501  const StreamInfo& stream = m_tracks[kTrackTypeSubtitle][idx];
502  int avidx = stream.m_av_stream_index;
503  QString mpegstream;
504 
505  if (avidx >= 0)
506  mpegstream = QString( "0x%1").arg(m_ic->streams[avidx]->id,0,16);
507  else
508  mpegstream = "n/a";
509 
510  LOG(VB_PLAYBACK, LOG_INFO, LOC +
511  QString("DVD Subtitle Track Map Stream id #%1, av_stream_idx %2, MPEG #%3, lang %4")
512  .arg(stream.m_stream_id)
513  .arg(stream.m_av_stream_index)
514  .arg(mpegstream,
515  iso639_key_toName(stream. m_language)));
516 
517  if ((selectedStream != -1) && (stream.m_stream_id == selectedStream))
518  track = static_cast<int>(idx);
519  }
520 
521  int trackcount = static_cast<int>(m_tracks[kTrackTypeSubtitle].size());
522  if (auto * dvdplayer = dynamic_cast<MythDVDPlayer*>(m_parent); dvdplayer && (track < 0 || track >= trackcount))
523  {
524  emit dvdplayer->DisableDVDSubtitles();
525  }
526  else if (track >= 0 && track < trackcount)
527  {
529  if (auto * player = dynamic_cast<MythPlayerUI*>(m_parent); player)
530  emit player->EnableSubtitles(true);
531  }
532  }
533 }
534 
535 bool MythDVDDecoder::DoRewindSeek(long long DesiredFrame)
536 {
537  if (!m_ringBuffer->IsDVD())
538  return false;
539 
540  m_ringBuffer->Seek(DVDFindPosition(DesiredFrame), SEEK_SET);
541  m_framesPlayed = m_framesRead = m_lastKey = DesiredFrame + 1;
542  m_frameCounter += 100;
543  return true;
544 }
545 
546 void MythDVDDecoder::DoFastForwardSeek(long long DesiredFrame, bool &NeedFlush)
547 {
548  if (!m_ringBuffer->IsDVD())
549  return;
550 
551  m_ringBuffer->Seek(DVDFindPosition(DesiredFrame), SEEK_SET);
552  NeedFlush = true;
553  m_framesPlayed = m_framesRead = m_lastKey = DesiredFrame + 1;
554  m_frameCounter += 100;
555 }
556 
558 {
559  if (!m_ringBuffer->IsDVD())
560  return;
561 
562  if (m_streamsChanged)
563  {
564  // This was originally in HandleDVDStreamChange
565  m_trackLock.lock();
566  ScanStreams(true);
567  m_trackLock.unlock();
568  m_streamsChanged=false;
569  }
570 
571  // Update the title length
573  {
574  ResetPosMap();
575  SyncPositionMap();
577  }
578 
579  // rescan the non-video streams as necessary
581  ScanStreams(true);
582 
583  // Always use the first video stream
584  // (must come after ScanStreams above)
585  for (uint i = 0; i < m_ic->nb_streams; i++)
586  {
587  AVStream *st = m_ic->streams[i];
588  if (st && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
589  {
590  m_trackLock.lock();
591  m_selectedTrack[kTrackTypeVideo].m_av_stream_index = static_cast<int>(i);
592  m_trackLock.unlock();
593  break;
594  }
595  }
596 }
597 
598 int MythDVDDecoder::GetAudioLanguage(uint /*AudioIndex*/, uint StreamIndex)
599 {
600  if ((m_ic->streams[StreamIndex]->id >= 0) && (m_ringBuffer && m_ringBuffer->IsDVD()))
601  {
602  auto track = m_ringBuffer->DVD()->GetAudioTrackNum(static_cast<uint>(m_ic->streams[StreamIndex]->id));
603  return static_cast<int>(m_ringBuffer->DVD()->GetAudioLanguage(track));
604  }
605  return iso639_str3_to_key("und");
606 }
607 
608 long long MythDVDDecoder::DVDFindPosition(long long DesiredFrame)
609 {
610  if (!m_ringBuffer->IsDVD())
611  return 0;
612 
613  int ffrewSkip = 1;
614  int current_speed = 0;
615  if (m_parent)
616  {
617  ffrewSkip = m_parent->GetFFRewSkip();
618  current_speed = static_cast<int>(m_parent->GetNextPlaySpeed());
619  }
620 
621  if (ffrewSkip == 1 || ffrewSkip == 0)
622  {
623  std::chrono::seconds diffTime = std::chrono::seconds(static_cast<int>(ceil((DesiredFrame - m_framesPlayed) / m_fps)));
624  std::chrono::seconds desiredTimePos = m_ringBuffer->DVD()->GetCurrentTime() +
625  diffTime;
626  if (diffTime <= 0s)
627  desiredTimePos--;
628  else
629  desiredTimePos++;
630 
631  if (desiredTimePos < 0s)
632  desiredTimePos = 0s;
633  return (desiredTimePos.count() * 90000LL);
634  }
635  return current_speed;
636 }
637 
639 {
640  int type = 0;
641 
642  if (m_ringBuffer && m_ringBuffer->DVD())
643  {
644  int logical_idx = m_ringBuffer->DVD()->GetAudioTrackNum(static_cast<uint>(m_ic->streams[Index]->id));
645  type = m_ringBuffer->DVD()->GetAudioTrackType(static_cast<uint>(logical_idx));
646  }
647 
648  // These are the only types defined in unofficial documentation
649  if (type > 0 && type < 5)
650  {
652  switch (type)
653  {
654  case 1: return kAudioTypeNormal;
655  case 2: return kAudioTypeAudioDescription;
656  case 3:
657  case 4: return kAudioTypeCommentary;
658  default: break;
659  }
660  return ret;
661  }
662 
663  // If the DVD metadata doesn't include the info then we might as well fall through, maybe we'll get lucky
665 }
kDecodeAV
@ kDecodeAV
Definition: decoderbase.h:52
MythDVDBuffer::GetCurrentTime
std::chrono::seconds GetCurrentTime(void) const
Definition: mythdvdbuffer.cpp:1979
MythDVDDecoder::UpdateFramesPlayed
void UpdateFramesPlayed(void) override
Definition: mythdvddecoder.cpp:60
MythDVDContext::GetLBA
uint32_t GetLBA(void) const
Definition: mythdvdcontext.cpp:29
MythDVDBuffer::GetTrack
int GetTrack(uint Type) const
get the track the dvd should be playing.
Definition: mythdvdbuffer.cpp:1872
MythPlayer::AtNormalSpeed
bool AtNormalSpeed(void) const
Definition: mythplayer.h:161
AudioTrackType
AudioTrackType
Definition: decoderbase.h:55
DecoderBase::m_selectedTrack
std::array< StreamInfo, kTrackTypeCount > m_selectedTrack
Definition: decoderbase.h:362
mythdvddecoder.h
MythDVDDecoder::~MythDVDDecoder
~MythDVDDecoder() override
Definition: mythdvddecoder.cpp:22
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
DecoderBase::m_ringBuffer
MythMediaBuffer * m_ringBuffer
Definition: decoderbase.h:289
AudioPlayer::Reset
void Reset(void)
Definition: audioplayer.cpp:83
MythDVDDecoder::m_returnContext
MythDVDContext * m_returnContext
Definition: mythdvddecoder.h:48
AvFormatDecoder::SetTrack
int SetTrack(uint Type, int TrackNo) override
Definition: avformatdecoder.cpp:4092
DecoderBase::m_fps
double m_fps
Definition: decoderbase.h:291
AvFormatDecoder::m_storedPackets
QList< AVPacket * > m_storedPackets
Definition: avformatdecoder.h:287
INVALID_LBA
#define INVALID_LBA
Definition: mythdvddecoder.h:10
MythDVDContext::GetNumFrames
int GetNumFrames(void) const
Returns the duration of this VOBU in frames.
Definition: mythdvdcontext.cpp:37
MythMediaBuffer::Seek
long long Seek(long long Position, int Whence, bool HasLock=false)
Definition: mythmediabuffer.cpp:472
MythOpticalBuffer::IsInMenu
bool IsInMenu(void) const override
Definition: mythopticalbuffer.cpp:9
LOC
#define LOC
Definition: mythdvddecoder.cpp:15
StreamInfo::m_av_stream_index
int m_av_stream_index
Definition: decoderbase.h:94
MythDVDDecoder::m_lbaLastVideoPkt
uint32_t m_lbaLastVideoPkt
Definition: mythdvddecoder.h:46
DecoderBase::m_parent
MythPlayer * m_parent
Definition: decoderbase.h:286
MythDVDDecoder::m_contextList
QList< MythDVDContext * > m_contextList
Definition: mythdvddecoder.h:44
StreamInfo::m_stream_id
int m_stream_id
Definition: decoderbase.h:99
Frame
Definition: zmdefines.h:93
MythDVDDecoder::DoRewindSeek
bool DoRewindSeek(long long DesiredFrame) override
Definition: mythdvddecoder.cpp:535
MythDVDDecoder::CheckContext
void CheckContext(int64_t Pts)
Definition: mythdvddecoder.cpp:206
MythDVDBuffer::GetDVDContext
MythDVDContext * GetDVDContext(void)
Definition: mythdvdbuffer.cpp:483
mythdvdbuffer.h
MythDVDContext::GetEndPTS
int64_t GetEndPTS(void) const
Definition: mythdvdcontext.cpp:19
MythPlayer::GetNextPlaySpeed
float GetNextPlaySpeed(void) const
Definition: mythplayer.h:143
MythMediaBuffer::IsDVD
bool IsDVD(void) const
Definition: mythmediabuffer.cpp:1830
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
DecoderBase::m_trackLock
QRecursiveMutex m_trackLock
Definition: decoderbase.h:356
MythDVDContext::GetSeqEndPTS
int64_t GetSeqEndPTS(void) const
Definition: mythdvdcontext.cpp:24
PlayerFlags
PlayerFlags
Definition: mythplayer.h:65
MythDVDDecoder::ReleaseLastVideoPkt
void ReleaseLastVideoPkt(void)
Definition: mythdvddecoder.cpp:33
MythPlayer
Definition: mythplayer.h:86
AvFormatDecoder::SeekReset
void SeekReset(long long newkey, uint skipFrames, bool doFlush, bool discardFrames) override
Definition: avformatdecoder.cpp:672
MythDVDBuffer::GetLastEvent
int32_t GetLastEvent(void) const
Definition: mythdvdbuffer.cpp:491
iso639_key_toName
QString iso639_key_toName(int iso639_2)
Converts a canonical key to language name in English.
Definition: iso639.cpp:109
sinfo_vec_t
std::vector< StreamInfo > sinfo_vec_t
Definition: decoderbase.h:111
MythPlayer::DiscardVideoFrames
void DiscardVideoFrames(bool KeyFrame, bool Flushed)
Places frames in the available frames queue.
Definition: mythplayer.cpp:637
MythDVDDecoder::m_curContext
MythDVDContext * m_curContext
Definition: mythdvddecoder.h:43
DecoderBase::m_tracks
std::array< sinfo_vec_t, kTrackTypeCount > m_tracks
Definition: decoderbase.h:360
AvFormatDecoder::m_streamsChanged
bool m_streamsChanged
Definition: avformatdecoder.h:364
MythDVDBuffer::IsReadingBlocked
bool IsReadingBlocked(void)
Definition: mythdvdbuffer.cpp:1227
MythDVDDecoder::ProcessDataPacket
bool ProcessDataPacket(AVStream *Curstream, AVPacket *Pkt, DecodeType Decodetype) override
Definition: mythdvddecoder.cpp:351
AvFormatDecoder::Reset
void Reset(bool reset_video_data, bool seek_reset, bool reset_file) override
Definition: avformatdecoder.cpp:828
kAudioTypeAudioDescription
@ kAudioTypeAudioDescription
Definition: decoderbase.h:58
kAudioTypeNormal
@ kAudioTypeNormal
Definition: decoderbase.h:57
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
MythPlayerUI
Definition: mythplayerui.h:10
StreamInfo
Definition: decoderbase.h:74
MythDVDDecoder::DVDFindPosition
long long DVDFindPosition(long long DesiredFrame)
Definition: mythdvddecoder.cpp:608
MythDVDDecoder::GetAudioTrackType
AudioTrackType GetAudioTrackType(uint Index) override
Definition: mythdvddecoder.cpp:638
mythdvdplayer.h
MythDVDBuffer::GetAudioTrackType
int GetAudioTrackType(uint Index)
Definition: mythdvdbuffer.cpp:1771
MythDVDBuffer::GetAudioTrackNum
int GetAudioTrackNum(uint StreamId)
get the logical track index (into PGC_AST_CTL) of the element that maps the given physical stream id.
Definition: mythdvdbuffer.cpp:1739
MythDVDPlayer
Definition: mythdvdplayer.h:10
DecoderBase::m_audio
AudioPlayer * m_audio
Definition: decoderbase.h:288
DecodeType
DecodeType
Definition: decoderbase.h:47
MythDVDDecoder::m_framesReq
int m_framesReq
Definition: mythdvddecoder.h:47
MythDVDDecoder::DoFastForwardSeek
void DoFastForwardSeek(long long DesiredFrame, bool &NeedFlush) override
Seeks to the keyframe just before the desiredFrame if exact seeks is enabled, or the frame just after...
Definition: mythdvddecoder.cpp:546
MythDVDContext::GetNumFramesPresent
int GetNumFramesPresent(void) const
Returns the number of video frames present in this VOBU.
Definition: mythdvdcontext.cpp:45
MythDVDContext::GetStartPTS
int64_t GetStartPTS(void) const
Definition: mythdvdcontext.cpp:14
AvFormatDecoder::ProcessVideoPacket
virtual bool ProcessVideoPacket(AVStream *stream, AVPacket *pkt, bool &Retry)
Definition: avformatdecoder.cpp:3387
MythDVDContext
Encapsulates playback context at any given moment.
Definition: mythdvdcontext.h:16
MythDVDBuffer::PGCLengthChanged
bool PGCLengthChanged(void)
check if pgc length has changed
Definition: mythdvdbuffer.cpp:1189
AvFormatDecoder::m_ic
AVFormatContext * m_ic
Definition: avformatdecoder.h:264
MythDVDDecoder::ProcessVideoPacket
bool ProcessVideoPacket(AVStream *Stream, AVPacket *Pkt, bool &Retry) override
Definition: mythdvddecoder.cpp:274
MythDVDBuffer::GetAudioLanguage
uint GetAudioLanguage(int Index)
get the audio language from the dvd
Definition: mythdvdbuffer.cpp:1715
MythDVDDecoder::GetAudioLanguage
int GetAudioLanguage(uint AudioIndex, uint StreamIndex) override
Definition: mythdvddecoder.cpp:598
DecoderBase::ResetPosMap
virtual void ResetPosMap(void)
Definition: decoderbase.cpp:647
MythDVDBuffer::AudioStreamsChanged
bool AudioStreamsChanged(void) const
Definition: mythdvdbuffer.cpp:1172
MythDVDDecoder::MythDVDDecoder
MythDVDDecoder(MythPlayer *Parent, const ProgramInfo &PGInfo, PlayerFlags Flags)
Definition: mythdvddecoder.cpp:17
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:85
kTrackTypeAudio
@ kTrackTypeAudio
Definition: decoderbase.h:29
AvFormatDecoder::ProcessVideoFrame
virtual bool ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame)
Definition: avformatdecoder.cpp:3561
MythDVDDecoder::ProcessVideoFrame
bool ProcessVideoFrame(AVStream *Stream, AVFrame *Frame) override
Definition: mythdvddecoder.cpp:337
uint
unsigned int uint
Definition: compat.h:140
kTrackTypeSubtitle
@ kTrackTypeSubtitle
Definition: decoderbase.h:31
AvFormatDecoder::ProcessDataPacket
virtual bool ProcessDataPacket(AVStream *curstream, AVPacket *pkt, DecodeType decodetype)
Definition: avformatdecoder.cpp:4059
DecoderBase::SyncPositionMap
virtual bool SyncPositionMap(void)
Updates the position map used for skipping frames.
Definition: decoderbase.cpp:322
MythDVDBuffer::AdjustTimestamp
uint32_t AdjustTimestamp(uint32_t Timestamp) const
Definition: mythdvdbuffer.cpp:467
MythDVDContext::GetLBAPrevVideoFrame
uint32_t GetLBAPrevVideoFrame(void) const
Returns the logical block address of the previous VOBU containing video.
Definition: mythdvdcontext.cpp:73
MythDVDDecoder::ReleaseContext
static void ReleaseContext(MythDVDContext *&Context)
Definition: mythdvddecoder.cpp:44
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
AvFormatDecoder::GetAudioTrackType
virtual AudioTrackType GetAudioTrackType(uint StreamIndex)
Definition: avformatdecoder.cpp:2622
DecoderBase::m_framesPlayed
long long m_framesPlayed
Definition: decoderbase.h:299
MythDVDDecoder::StreamChangeCheck
void StreamChangeCheck(void) override
Definition: mythdvddecoder.cpp:557
MythDVDDecoder::PostProcessTracks
void PostProcessTracks(void) override
Definition: mythdvddecoder.cpp:397
MythPlayer::SetFramesPlayed
void SetFramesPlayed(uint64_t played)
Definition: mythplayer.cpp:562
MythDVDDecoder::m_lastVideoPkt
AVPacket * m_lastVideoPkt
Definition: mythdvddecoder.h:45
AvFormatDecoder::m_avCodecLock
QRecursiveMutex m_avCodecLock
Definition: avformatdecoder.h:373
MythDVDDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: mythdvddecoder.cpp:70
MythDVDBuffer::UnblockReading
void UnblockReading(void)
Definition: mythdvdbuffer.cpp:1222
mpeg::chrono::pts
std::chrono::duration< CHRONO_TYPE, std::ratio< 1, 90000 > > pts
Definition: mythchrono.h:55
MythDVDBuffer::GetSubtitleTrackNum
int8_t GetSubtitleTrackNum(uint StreamId)
get the logical subtitle track/stream number from the dvd
Definition: mythdvdbuffer.cpp:1800
iso639.h
ISO 639-1 and ISO 639-2 support functions.
MythDVDBuffer::SectorSeek
bool SectorSeek(uint64_t Sector)
Definition: mythdvdbuffer.cpp:150
DecoderBase::m_lastKey
long long m_lastKey
Definition: decoderbase.h:304
MythMediaBuffer::DVD
const MythDVDBuffer * DVD(void) const
Definition: mythmediabuffer.cpp:1840
MythDVDDecoder::Reset
void Reset(bool ResetVideoData, bool SeekReset, bool ResetFile) override
Definition: mythdvddecoder.cpp:53
kTrackTypeVideo
@ kTrackTypeVideo
Definition: decoderbase.h:30
DecoderBase::m_framesRead
long long m_framesRead
Definition: decoderbase.h:300
MythDVDBuffer::GetSubtitleLanguage
uint GetSubtitleLanguage(int Id)
Get the subtitle language from the dvd.
Definition: mythdvdbuffer.cpp:1790
iso639_str3_to_key
static int iso639_str3_to_key(const unsigned char *iso639_2)
Definition: iso639.h:59
AvFormatDecoder::GetFrame
bool GetFrame(DecodeType Type, bool &Retry) override
Demux, preprocess and possibly decode a frame of video/audio.
Definition: avformatdecoder.cpp:4814
AvFormatDecoder::ScanStreams
int ScanStreams(bool novideo)
Definition: avformatdecoder.cpp:1949
MythPlayer::GetFFRewSkip
int GetFFRewSkip(void) const
Definition: mythplayer.h:140
MythDVDDecoder::ReadPacket
int ReadPacket(AVFormatContext *Ctx, AVPacket *Pkt, bool &StorePacket) override
Definition: mythdvddecoder.cpp:76
kAudioTypeCommentary
@ kAudioTypeCommentary
Definition: decoderbase.h:62
DecoderBase::m_frameCounter
uint64_t m_frameCounter
Definition: decoderbase.h:301