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