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