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