MythTV  master
mythplayer.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #undef HAVE_AV_CONFIG_H
4 
5 // C++ headers
6 #include <algorithm>
7 #include <cassert>
8 #include <cmath>
9 #include <cstdint>
10 #include <cstdio>
11 #include <cstdlib>
12 #include <unistd.h>
13 
14 // Qt headers
15 #include <QCoreApplication>
16 #include <QDir>
17 #include <QHash>
18 #include <QMap>
19 #include <QThread>
20 #include <QtCore/qnumeric.h>
21 #include <utility>
22 
23 // MythTV headers
24 #include "mthread.h"
25 #include "mythconfig.h"
26 #include "mythplayer.h"
27 #include "DetectLetterbox.h"
28 #include "audioplayer.h"
29 #include "programinfo.h"
30 #include "mythcorecontext.h"
31 #include "livetvchain.h"
32 #include "avformatdecoder.h"
33 #include "dummydecoder.h"
34 #include "tv_play.h"
35 #include "mythlogging.h"
36 #include "mythmiscutil.h"
37 #include "audiooutput.h"
38 #include "cardutil.h"
39 #include "mythavutil.h"
40 #include "jitterometer.h"
41 #include "mythtimer.h"
42 #include "mythuiactions.h"
43 #include "io/mythmediabuffer.h"
44 #include "tv_actions.h"
46 #include "mythvideooutnull.h"
47 #include "mythcodeccontext.h"
48 
49 // MythUI headers
50 #include <mythmainwindow.h>
51 
52 extern "C" {
53 #include "libavcodec/avcodec.h"
54 }
55 
56 #include "remoteencoder.h"
57 
58 #if ! HAVE_ROUND
59 #define round(x) ((int) ((x) + 0.5))
60 #endif
61 
62 static unsigned dbg_ident(const MythPlayer* /*player*/);
63 
64 #define LOC QString("Player(%1): ").arg(dbg_ident(this),0,36)
65 
68 
69 // Exact frame seeking, no inaccuracy allowed.
70 const double MythPlayer::kInaccuracyNone = 0;
71 
72 // By default, when seeking, snap to a keyframe if the keyframe's
73 // distance from the target frame is less than 10% of the total seek
74 // distance.
75 const double MythPlayer::kInaccuracyDefault = 0.1;
76 
77 // Allow greater inaccuracy (50%) in the cutlist editor (unless the
78 // editor seek distance is set to 1 frame or 1 keyframe).
79 const double MythPlayer::kInaccuracyEditor = 0.5;
80 
81 // Any negative value means completely inexact, i.e. seek to the
82 // keyframe that is closest to the target.
83 const double MythPlayer::kInaccuracyFull = -1.0;
84 
86  : m_playerCtx(Context),
87  m_playerFlags(Flags),
88  // CC608/708
89  m_cc608(this), m_cc708(this),
90  // Audio
91  m_audio(this, (Flags & kAudioMuted) != 0)
92 {
93  m_playerThread = QThread::currentThread();
94 #ifdef Q_OS_ANDROID
95  m_playerThreadId = gettid();
96 #endif
99 
102  m_clearSavedPosition = gCoreContext->GetNumSetting("ClearSavedPosition", 1);
103  m_endExitPrompt = gCoreContext->GetNumSetting("EndOfRecordingExitPrompt");
104 
105  // Get VBI page number
106  QString mypage = gCoreContext->GetSetting("VBIpageNr", "888");
107  bool valid = false;
108  uint tmp = mypage.toInt(&valid, 16);
109  m_ttPageNum = (valid) ? tmp : m_ttPageNum;
111 }
112 
114 {
115  QMutexLocker lock2(&m_vidExitLock);
116 
117  SetDecoder(nullptr);
118 
119  delete m_decoderThread;
120  m_decoderThread = nullptr;
121 
122  delete m_videoOutput;
123  m_videoOutput = nullptr;
124 }
125 
127 {
128  m_watchingRecording = mode;
129  if (m_decoder)
131 }
132 
134 {
136 }
137 
139 {
140  m_bufferPauseLock.lock();
141  if (m_playerCtx->m_buffer)
142  {
145  }
146  m_bufferPaused = true;
147  m_bufferPauseLock.unlock();
148 }
149 
151 {
152  m_bufferPauseLock.lock();
153  if (m_playerCtx->m_buffer)
155  m_bufferPaused = false;
156  m_bufferPauseLock.unlock();
157 }
158 
160 {
161  while (!m_pauseLock.tryLock(100))
162  {
163  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Waited 100ms to get pause lock.");
165  }
166  bool already_paused = m_allPaused;
167  if (already_paused)
168  {
169  m_pauseLock.unlock();
170  return already_paused;
171  }
172  m_nextPlaySpeed = 0.0;
173  m_nextNormalSpeed = false;
174  PauseVideo();
175  m_audio.Pause(true);
176  PauseDecoder();
177  PauseBuffer();
178  if (!m_decoderPaused)
179  PauseDecoder(); // Retry in case audio only stream
181  {
184  else if (m_videoOutput && !FlagIsSet(kVideoIsNull))
186  }
187  m_pauseLock.unlock();
189  return already_paused;
190 }
191 
192 bool MythPlayer::Play(float speed, bool normal, bool unpauseaudio)
193 {
194  m_pauseLock.lock();
195  LOG(VB_PLAYBACK, LOG_INFO, LOC +
196  QString("Play(%1, normal %2, unpause audio %3)")
197  .arg(speed,5,'f',1).arg(normal).arg(unpauseaudio));
198 
199  if (m_deleteMap.IsEditing())
200  {
201  LOG(VB_GENERAL, LOG_ERR, LOC + "Ignoring Play(), in edit mode.");
202  m_pauseLock.unlock();
203  return false;
204  }
205 
207 
209  UnpauseBuffer();
210  UnpauseDecoder();
211  if (unpauseaudio)
212  m_audio.Pause(false);
213  UnpauseVideo();
214  m_allPaused = false;
215  m_nextPlaySpeed = speed;
216  m_nextNormalSpeed = normal;
217  m_pauseLock.unlock();
219  return true;
220 }
221 
223 {
224  m_videoPauseLock.lock();
225  m_needNewPauseFrame = true;
226  m_videoPaused = true;
227  m_videoPauseLock.unlock();
228 }
229 
231 {
232  m_videoPauseLock.lock();
233  m_videoPaused = false;
234  m_videoPauseLock.unlock();
235 }
236 
238 {
240  if (!m_playerCtx)
241  return;
242 
243  m_playerCtx->LockPlayingInfo(__FILE__, __LINE__);
244  m_playerCtx->SetPlayingInfo(&pginfo);
245  m_playerCtx->UnlockPlayingInfo(__FILE__, __LINE__);
246 }
247 
248 void MythPlayer::SetPlaying(bool is_playing)
249 {
250  QMutexLocker locker(&m_playingLock);
251 
252  m_playing = is_playing;
253 
254  m_playingWaitCond.wakeAll();
255 }
256 
257 bool MythPlayer::IsPlaying(uint wait_in_msec, bool wait_for) const
258 {
259  QMutexLocker locker(&m_playingLock);
260 
261  if (!wait_in_msec)
262  return m_playing;
263 
264  MythTimer t;
265  t.start();
266 
267  while ((wait_for != m_playing) && ((uint)t.elapsed() < wait_in_msec))
268  {
269  m_playingWaitCond.wait(
270  &m_playingLock, std::max(0,(int)wait_in_msec - t.elapsed()));
271  }
272 
273  return m_playing;
274 }
275 
277 {
278  if (!m_playerCtx)
279  return false;
280 
281  if (!m_decoder)
282  {
283  LOG(VB_GENERAL, LOG_ERR, LOC + "Cannot create a video renderer without a decoder.");
284  return false;
285  }
286 
289 
290  if (!m_videoOutput)
291  {
292  LOG(VB_GENERAL, LOG_ERR, LOC + "Couldn't create VideoOutput instance. Exiting..");
293  SetErrored(tr("Failed to initialize video output"));
294  return false;
295  }
296 
297  return true;
298 }
299 
300 void MythPlayer::ReinitVideo(bool ForceUpdate)
301 {
302 
303  bool aspect_only = false;
304  {
305  QMutexLocker locker(&m_vidExitLock);
306  m_videoOutput->SetVideoFrameRate(static_cast<float>(m_videoFrameRate));
307  float aspect = (m_forcedVideoAspect > 0) ? m_forcedVideoAspect : m_videoAspect;
309  m_decoder->GetVideoCodecID(), aspect_only,
310  m_maxReferenceFrames, ForceUpdate))
311  {
312  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to Reinitialize Video. Exiting..");
313  SetErrored(tr("Failed to reinitialize video output"));
314  return;
315  }
316 
317  // Signal to the main thread to reinit OSD
318  m_reinitOsd = true;
319  }
320 
321  if (!aspect_only)
322  ClearAfterSeek();
323 
324  // Signal to main thread to reinit subtitles
325  if (m_textDisplayMode)
326  EnableSubtitles(true);
327 }
328 
329 void MythPlayer::SetKeyframeDistance(int keyframedistance)
330 {
331  m_keyframeDist = (keyframedistance > 0) ? static_cast<uint>(keyframedistance) : m_keyframeDist;
332 }
333 
334 void MythPlayer::SetVideoParams(int width, int height, double fps,
335  float aspect, bool ForceUpdate,
336  int ReferenceFrames, FrameScanType /*scan*/, const QString& codecName)
337 {
338  bool paramsChanged = ForceUpdate;
339 
340  if (width >= 0 && height >= 0)
341  {
342  paramsChanged = true;
343  m_videoDim = m_videoDispDim = QSize(width, height);
344  m_videoAspect = aspect > 0.0F ? aspect : static_cast<float>(width) / height;
345  }
346 
347  if (!qIsNaN(fps) && fps > 0.0 && fps < 121.0)
348  {
349  paramsChanged = true;
350  m_videoFrameRate = fps;
351  if (m_ffrewSkip != 0 && m_ffrewSkip != 1)
352  {
353  UpdateFFRewSkip();
354  }
355  else
356  {
357  float temp_speed = (m_playSpeed == 0.0F) ?
360  1.0 / (m_videoFrameRate * static_cast<double>(temp_speed)));
361  }
362  }
363 
364  if (!codecName.isEmpty())
365  {
366  m_codecName = codecName;
367  paramsChanged = true;
368  }
369 
370  if (ReferenceFrames > 0)
371  {
372  m_maxReferenceFrames = ReferenceFrames;
373  paramsChanged = true;
374  }
375 
376  if (!paramsChanged)
377  return;
378 
379  if (m_videoOutput)
380  ReinitVideo(ForceUpdate);
381 
382  if (IsErrored())
383  return;
384 }
385 
386 
387 void MythPlayer::SetFrameRate(double fps)
388 {
389  m_videoFrameRate = fps;
390  float temp_speed = (m_playSpeed == 0.0F) ? m_audio.GetStretchFactor() : m_playSpeed;
391  SetFrameInterval(kScan_Progressive, 1.0 / (m_videoFrameRate * static_cast<double>(temp_speed)));
392 }
393 
394 void MythPlayer::SetFileLength(int total, int frames)
395 {
396  m_totalLength = total;
397  m_totalFrames = frames;
398 }
399 
400 void MythPlayer::SetDuration(int duration)
401 {
402  m_totalDuration = duration;
403 }
404 
406 {
407  m_isDummy = true;
408 
409  if (!m_videoOutput)
410  {
412  SetVideoParams(720, 576, 25.00, 1.25F, false, 2);
413  }
414 
415  m_playerCtx->LockPlayingInfo(__FILE__, __LINE__);
416  auto *dec = new DummyDecoder(this, *(m_playerCtx->m_playingInfo));
417  m_playerCtx->UnlockPlayingInfo(__FILE__, __LINE__);
418  SetDecoder(dec);
419 }
420 
422 {
425 }
426 
427 int MythPlayer::OpenFile(int Retries)
428 {
429  // Sanity check
431  return -1;
432 
433  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Opening '%1'").arg(m_playerCtx->m_buffer->GetSafeFilename()));
434 
435  m_isDummy = false;
437 
438  // Dummy setup for livetv transtions. Can we get rid of this?
439  if (m_playerCtx->m_tvchain)
440  {
441  int currentposition = m_playerCtx->m_tvchain->GetCurPos();
442  if (m_playerCtx->m_tvchain->GetInputType(currentposition) == "DUMMY")
443  {
444  OpenDummy();
445  return 0;
446  }
447  }
448 
449  // Start the RingBuffer read ahead thread
451 
453  TestBufferVec testbuf {};
454  testbuf.reserve(kDecoderProbeBufferSize);
455 
456  UnpauseBuffer();
457 
458  // delete any pre-existing recorder
459  SetDecoder(nullptr);
460  int testreadsize = 2048;
461 
462  // Test the incoming buffer and create a suitable decoder
463  MythTimer bigTimer;
464  bigTimer.start();
465  int timeout = std::max((Retries + 1) * 500, 30000);
466  while (testreadsize <= kDecoderProbeBufferSize)
467  {
468  testbuf.resize(testreadsize);
469  MythTimer peekTimer;
470  peekTimer.start();
471  while (m_playerCtx->m_buffer->Peek(testbuf) != testreadsize)
472  {
473  // NB need to allow for streams encountering network congestion
474  if (peekTimer.elapsed() > 30000 || bigTimer.elapsed() > timeout
476  {
477  LOG(VB_GENERAL, LOG_ERR, LOC +
478  QString("OpenFile(): Could not read first %1 bytes of '%2'")
479  .arg(testreadsize)
481  SetErrored(tr("Could not read first %1 bytes").arg(testreadsize));
482  return -1;
483  }
484  LOG(VB_GENERAL, LOG_WARNING, LOC + "OpenFile() waiting on data");
485  usleep(50 * 1000);
486  }
487 
488  m_playerCtx->LockPlayingInfo(__FILE__, __LINE__);
489  CreateDecoder(testbuf);
490  m_playerCtx->UnlockPlayingInfo(__FILE__, __LINE__);
491  if (m_decoder || (bigTimer.elapsed() > timeout))
492  break;
493  testreadsize <<= 1;
494  }
495 
496  // Fail
497  if (!m_decoder)
498  {
499  LOG(VB_GENERAL, LOG_ERR, LOC +
500  QString("Couldn't find an A/V decoder for: '%1'")
502  SetErrored(tr("Could not find an A/V decoder"));
503 
504  return -1;
505  }
506 
507  if (m_decoder->IsErrored())
508  {
509  LOG(VB_GENERAL, LOG_ERR, LOC + "Could not initialize A/V decoder.");
510  SetDecoder(nullptr);
511  SetErrored(tr("Could not initialize A/V decoder"));
512 
513  return -1;
514  }
515 
516  // Pre-init the decoder
520  // TODO (re)move this into MythTranscode player
522 
523  // Open the decoder
524  int result = m_decoder->OpenFile(m_playerCtx->m_buffer, false, testbuf);
525 
526  if (result < 0)
527  {
528  LOG(VB_GENERAL, LOG_ERR, QString("Couldn't open decoder for: %1")
530  SetErrored(tr("Could not open decoder"));
531  return -1;
532  }
533 
534  // Disable audio if necessary
536 
537  // Livetv, recording or in-progress
538  if (result > 0)
539  {
540  m_hasFullPositionMap = true;
543  }
544 
545  // Determine the initial bookmark and update it for the cutlist
549 
552  {
553  gCoreContext->SaveSetting("DefaultChanid",
554  static_cast<int>(m_playerCtx->m_playingInfo->GetChanID()));
555  QString callsign = m_playerCtx->m_playingInfo->GetChannelSchedulingID();
556  QString channum = m_playerCtx->m_playingInfo->GetChanNum();
557  gCoreContext->SaveSetting("DefaultChanKeys", callsign + "[]:[]" + channum);
559  {
560  uint cardid = static_cast<uint>(m_playerCtx->m_recorder->GetRecorderNumber());
561  CardUtil::SetStartChannel(cardid, channum);
562  }
563  }
564 
565  return IsErrored() ? -1 : 0;
566 }
567 
568 void MythPlayer::SetFramesPlayed(uint64_t played)
569 {
570  m_framesPlayed = played;
571  if (m_videoOutput)
573 }
574 
579 {
580  if (m_videoOutput)
581  return m_videoOutput->FreeVideoFrames();
582  return 0;
583 }
584 
587 {
588  if (m_videoOutput)
591 }
592 
603 {
604  if (m_videoOutput)
606  return nullptr;
607 }
608 
613  int64_t timecode,
614  bool wrap)
615 {
616  if (wrap)
617  WrapTimecode(timecode, TC_VIDEO);
618  buffer->m_timecode = timecode;
619  m_latestVideoTimecode = timecode;
620 
621  if (m_videoOutput)
622  m_videoOutput->ReleaseFrame(buffer);
623 
624  // FIXME need to handle this in the correct place in the main thread (DVD stills?)
625  //if (m_allPaused)
626  // CheckAspectRatio(buffer);
627 }
628 
633 {
634  if (m_videoOutput)
635  m_videoOutput->DiscardFrame(buffer);
636 }
637 
651 void MythPlayer::DiscardVideoFrames(bool KeyFrame, bool Flushed)
652 {
653  if (m_videoOutput)
654  m_videoOutput->DiscardFrames(KeyFrame, Flushed);
655 }
656 
658 {
659  EofState eof = GetEof();
660  if (eof != kEofStateNone && !m_allPaused)
661  return true;
662  if (GetEditMode())
663  return false;
664  if (m_liveTV)
665  return false;
667  return true;
668  return false;
669 }
670 
672 {
673  if (m_videoOutput)
674  m_videoOutput->DeLimboFrame(frame);
675 }
676 
683 {
684  if (trackType >= kTrackTypeSubtitle &&
686  {
687  m_enableCaptions = true;
688  }
689 }
690 
692 {
693  if (enable)
694  m_enableCaptions = true;
695  else
696  m_disableCaptions = true;
697 }
698 
700 {
701  if (enable)
703  else
705 }
706 
708 {
709  m_allowForcedSubtitles = allow;
710  emit SignalOSDMessage(m_allowForcedSubtitles ? tr("Forced Subtitles On") : tr("Forced Subtitles Off"));
711 }
712 
714 {
715  if (m_decoder)
717  m_frameInterval = static_cast<int>(lround(1000000.0 * frame_period) / m_fpsMultiplier);
718 
719  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("SetFrameInterval Interval:%1 Speed:%2 Scan:%3 (Multiplier: %4)")
721 }
722 
724 {
725  // try to get preferential scheduling, but ignore if we fail to.
726  myth_nice(-19);
727 }
728 
729 void MythPlayer::SetBuffering(bool new_buffering)
730 {
731  if (!m_buffering && new_buffering)
732  {
733  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Waiting for video buffers...");
734  m_buffering = true;
735  m_bufferingStart = QTime::currentTime();
736  m_bufferingLastMsg = QTime::currentTime();
737  }
738  else if (m_buffering && !new_buffering)
739  {
740  m_buffering = false;
741  }
742 }
743 
744 // For debugging playback set this to increase the timeout so that
745 // playback does not fail if stepping through code.
746 // Set PREBUFFERDEBUG to any value and you will get 30 minutes.
747 static char *preBufferDebug = getenv("PREBUFFERDEBUG");
748 
750 {
751  if (!m_videoOutput)
752  return false;
753 
754  if (!(min_buffers ? (m_videoOutput->ValidVideoFrames() >= min_buffers) :
756  {
757  SetBuffering(true);
758 
759  // This piece of code is to address the problem, when starting
760  // Live TV, of jerking and stuttering. Without this code
761  // that could go on forever, but is cured by a pause and play.
762  // This code inserts a brief pause and play when the potential
763  // for the jerking is detected.
764 
765  bool watchingTV = IsWatchingInprogress();
766  if ((m_liveTV || watchingTV) && !FlagIsSet(kMusicChoice))
767  {
768  uint64_t frameCount = GetCurrentFrameCount();
769  uint64_t framesLeft = frameCount - m_framesPlayed;
770  auto margin = static_cast<uint64_t>(m_videoFrameRate * 3);
771  if (framesLeft < margin)
772  {
774  {
775  LOG(VB_PLAYBACK, LOG_NOTICE, LOC + "Pause to allow live tv catch up");
776  LOG(VB_PLAYBACK, LOG_NOTICE, LOC + QString("Played: %1 Avail: %2 Buffered: %3 Margin: %4")
777  .arg(m_framesPlayed).arg(frameCount)
778  .arg(m_videoOutput->ValidVideoFrames()).arg(margin));
779  }
780  }
781  }
782 
783  usleep(static_cast<uint>(m_frameInterval >> 3));
784  int waited_for = m_bufferingStart.msecsTo(QTime::currentTime());
785  int last_msg = m_bufferingLastMsg.msecsTo(QTime::currentTime());
786  if (last_msg > 100 && !FlagIsSet(kMusicChoice))
787  {
788  if (++m_bufferingCounter == 10)
789  LOG(VB_GENERAL, LOG_NOTICE, LOC +
790  "To see more buffering messages use -v playback");
791  if (m_bufferingCounter >= 10)
792  {
793  LOG(VB_PLAYBACK, LOG_NOTICE, LOC +
794  QString("Waited %1ms for video buffers %2")
795  .arg(waited_for).arg(m_videoOutput->GetFrameStatus()));
796  }
797  else
798  {
799  LOG(VB_GENERAL, LOG_NOTICE, LOC +
800  QString("Waited %1ms for video buffers %2")
801  .arg(waited_for).arg(m_videoOutput->GetFrameStatus()));
802  }
803  m_bufferingLastMsg = QTime::currentTime();
805  && gCoreContext->GetBoolSetting("MusicChoiceEnabled", false))
806  {
808  LOG(VB_GENERAL, LOG_NOTICE, LOC + "Music Choice program detected - disabling AV Sync.");
810  }
811  if (waited_for > 7000 && m_audio.IsBufferAlmostFull()
812  && !FlagIsSet(kMusicChoice))
813  {
814  // We are likely to enter this condition
815  // if the audio buffer was too full during GetFrame in AVFD
816  LOG(VB_GENERAL, LOG_NOTICE, LOC + "Resetting audio buffer");
817  m_audio.Reset();
818  }
819  // Finish audio pause for sync after 1 second
820  // in case of infrequent video frames (e.g. music choice)
821  if (m_avSync.GetAVSyncAudioPause() && waited_for > 1000)
823  }
824  int msecs = 500;
825  if (preBufferDebug)
826  msecs = 1800000;
827  if ((waited_for > msecs /*500*/) && !m_videoOutput->EnoughFreeFrames())
828  {
829  LOG(VB_GENERAL, LOG_NOTICE, LOC +
830  "Timed out waiting for frames, and"
831  "\n\t\t\tthere are not enough free frames. "
832  "Discarding buffered frames.");
833  // This call will result in some ugly frames, but allows us
834  // to recover from serious problems if frames get leaked.
835  DiscardVideoFrames(true, true);
836  }
837  msecs = 30000;
838  if (preBufferDebug)
839  msecs = 1800000;
840  if (waited_for > msecs /*30000*/) // 30 seconds for internet streamed media
841  {
842  LOG(VB_GENERAL, LOG_ERR, LOC +
843  "Waited too long for decoder to fill video buffers. Exiting..");
844  SetErrored(tr("Video frame buffering failed too many times."));
845  }
846  return false;
847  }
848 
850  m_audio.Pause(false);
851  SetBuffering(false);
852  return true;
853 }
854 
856 {
857  m_vidExitLock.lock();
858  delete m_videoOutput;
859  m_videoOutput = nullptr;
860  m_vidExitLock.unlock();
861 }
862 
863 bool MythPlayer::FastForward(float seconds)
864 {
865  if (!m_videoOutput)
866  return false;
867 
868  if (m_ffTime <= 0)
869  {
870  float current = ComputeSecs(m_framesPlayed, true);
871  float dest = current + seconds;
872  float length = ComputeSecs(m_totalFrames, true);
873 
874  if (dest > length)
875  {
876  int64_t pos = TranslatePositionMsToFrame(seconds * 1000, false);
877  if (CalcMaxFFTime(pos) < 0)
878  return true;
879  // Reach end of recording, go to 1 or 3s before the end
880  dest = (m_liveTV || IsWatchingInprogress()) ? -3.0 : -1.0;
881  }
882  uint64_t target = FindFrame(dest, true);
883  m_ffTime = target - m_framesPlayed;
884  }
885  return m_ffTime > CalcMaxFFTime(m_ffTime, false);
886 }
887 
888 bool MythPlayer::Rewind(float seconds)
889 {
890  if (!m_videoOutput)
891  return false;
892 
893  if (m_rewindTime <= 0)
894  {
895  float current = ComputeSecs(m_framesPlayed, true);
896  float dest = current - seconds;
897  if (dest < 0)
898  {
899  int64_t pos = TranslatePositionMsToFrame(seconds * 1000, false);
900  if (CalcRWTime(pos) < 0)
901  return true;
902  dest = 0;
903  }
904  uint64_t target = FindFrame(dest, true);
905  m_rewindTime = m_framesPlayed - target;
906  }
907  return (uint64_t)m_rewindTime >= m_framesPlayed;
908 }
909 
910 bool MythPlayer::JumpToFrame(uint64_t frame)
911 {
912  if (!m_videoOutput)
913  return false;
914 
915  bool ret = false;
916  m_ffTime = m_rewindTime = 0;
917  if (frame > m_framesPlayed)
918  {
919  m_ffTime = frame - m_framesPlayed;
920  ret = m_ffTime > CalcMaxFFTime(m_ffTime, false);
921  }
922  else if (frame < m_framesPlayed)
923  {
924  m_rewindTime = m_framesPlayed - frame;
925  ret = m_ffTime > CalcMaxFFTime(m_ffTime, false);
926  }
927  return ret;
928 }
929 
930 
931 void MythPlayer::JumpChapter(int chapter)
932 {
933  if (m_jumpChapter == 0)
934  m_jumpChapter = chapter;
935 }
936 
937 void MythPlayer::ResetPlaying(bool resetframes)
938 {
939  ClearAfterSeek();
940  m_ffrewSkip = 1;
941  if (resetframes)
942  m_framesPlayed = 0;
943  if (m_decoder)
944  {
945  m_decoder->Reset(true, true, true);
946  if (m_decoder->IsErrored())
947  SetErrored("Unable to reset video decoder");
948  }
949 }
950 
952 {
953  bool last = !(m_playerCtx->m_tvchain->HasNext());
954  SetWatchingRecording(last);
955 }
956 
957 // This is called from decoder thread. Set an indicator that will
958 // be checked and actioned in the player thread.
960 {
961  LOG(VB_PLAYBACK, LOG_INFO, LOC + "FileChangedCallback");
962  m_fileChanged = true;
963 }
964 
966 {
967  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("StopPlaying - begin"));
968  m_playerThread->setPriority(QThread::NormalPriority);
969 #ifdef Q_OS_ANDROID
970  setpriority(PRIO_PROCESS, m_playerThreadId, 0);
971 #endif
972 
973  emit CheckCallbacks();
974  DecoderEnd();
975  VideoEnd();
976  AudioEnd();
977 
978  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("StopPlaying - end"));
979 }
980 
982 {
984 }
985 
987 {
988  m_decoderPauseLock.lock();
990  {
991  m_decoderPaused = true;
992  m_decoderThreadPause.wakeAll();
993  m_decoderPauseLock.unlock();
994  return m_decoderPaused;
995  }
996 
997  int tries = 0;
998  m_pauseDecoder = true;
999  while (m_decoderThread && !m_killDecoder && (tries++ < 100) &&
1001  {
1002  emit CheckCallbacks();
1003  LOG(VB_GENERAL, LOG_WARNING, LOC + "Waited 100ms for decoder to pause");
1004  }
1005  m_pauseDecoder = false;
1006  m_decoderPauseLock.unlock();
1007  return m_decoderPaused;
1008 }
1009 
1011 {
1012  m_decoderPauseLock.lock();
1013 
1015  {
1016  m_decoderPaused = false;
1017  m_decoderThreadUnpause.wakeAll();
1018  m_decoderPauseLock.unlock();
1019  return;
1020  }
1021 
1022  if (!IsInStillFrame())
1023  {
1024  int tries = 0;
1025  m_unpauseDecoder = true;
1026  while (m_decoderThread && !m_killDecoder && (tries++ < 100) &&
1028  {
1029  emit CheckCallbacks();
1030  LOG(VB_GENERAL, LOG_WARNING, LOC + "Waited 100ms for decoder to unpause");
1031  }
1032  m_unpauseDecoder = false;
1033  }
1034  m_decoderPauseLock.unlock();
1035 }
1036 
1037 void MythPlayer::DecoderStart(bool start_paused)
1038 {
1039  if (m_decoderThread)
1040  {
1041  if (m_decoderThread->isRunning())
1042  {
1043  LOG(VB_GENERAL, LOG_ERR, LOC + "Decoder thread already running");
1044  }
1045  delete m_decoderThread;
1046  }
1047 
1048  m_killDecoder = false;
1049  m_decoderPaused = start_paused;
1050  m_decoderThread = new MythDecoderThread(this, start_paused);
1051  if (m_decoderThread)
1053 }
1054 
1056 {
1057  PauseDecoder();
1058  SetPlaying(false);
1059  // Ensure any hardware frames are released (after pausing the decoder) to
1060  // allow the decoder to exit cleanly
1061  DiscardVideoFrames(true, true);
1062 
1063  m_killDecoder = true;
1064  int tries = 0;
1065  while (m_decoderThread && !m_decoderThread->wait(100) && (tries++ < 50))
1066  LOG(VB_PLAYBACK, LOG_INFO, LOC +
1067  "Waited 100ms for decoder loop to stop");
1068 
1070  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to stop decoder loop.");
1071  else
1072  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Exited decoder loop.");
1073  SetDecoder(nullptr);
1074 }
1075 
1077 {
1079  {
1080  if (m_pauseDecoder)
1081  PauseDecoder();
1082  if (m_unpauseDecoder)
1083  UnpauseDecoder();
1084  }
1085 }
1086 
1089 {
1092 
1093  if (!m_decoderChangeLock.tryLock(50))
1094  return kEofStateNone;
1095 
1097  m_decoderChangeLock.unlock();
1098  return eof;
1099 }
1100 
1102 {
1104  {
1105  if (m_decoder)
1106  m_decoder->SetEofState(eof);
1107  return;
1108  }
1109 
1110  if (!m_decoderChangeLock.tryLock(50))
1111  return;
1112 
1113  if (m_decoder)
1114  m_decoder->SetEofState(eof);
1115  m_decoderChangeLock.unlock();
1116 }
1118 
1119 void MythPlayer::DecoderLoop(bool pause)
1120 {
1121  if (pause)
1122  PauseDecoder();
1123 
1124  while (!m_killDecoder && !IsErrored())
1125  {
1127 
1129  {
1130  usleep(1000);
1131  continue;
1132  }
1133 
1135  {
1136  if (!m_decoderChangeLock.tryLock(1))
1137  continue;
1138  if (m_decoder)
1139  {
1140  m_forcePositionMapSync = false;
1142  }
1143  m_decoderChangeLock.unlock();
1144  }
1145 
1146  if (m_decoderSeek >= 0)
1147  {
1148  if (!m_decoderChangeLock.tryLock(1))
1149  continue;
1150  if (m_decoder)
1151  {
1152  m_decoderSeekLock.lock();
1153  if (((uint64_t)m_decoderSeek < m_framesPlayed) && m_decoder)
1155  else if (m_decoder)
1157  m_decoderSeek = -1;
1158  m_decoderSeekLock.unlock();
1159  }
1160  m_decoderChangeLock.unlock();
1161  }
1162 
1163  bool obey_eof = (GetEof() != kEofStateNone) &&
1165  if (m_isDummy || ((m_decoderPaused || m_ffrewSkip == 0 || obey_eof) &&
1166  !m_decodeOneFrame))
1167  {
1168  usleep(1000);
1169  continue;
1170  }
1171 
1174 
1175  DecoderGetFrame(dt);
1176  m_decodeOneFrame = false;
1177  }
1178 
1179  // Clear any wait conditions
1181  m_decoderSeek = -1;
1182 }
1183 
1185 {
1186  if (!m_decoder)
1187  return false;
1188 
1189  if (m_ffrewSkip > 0)
1190  {
1191  long long delta = m_decoder->GetFramesRead() - m_framesPlayed;
1192  long long real_skip = CalcMaxFFTime(m_ffrewSkip - m_ffrewAdjust + delta) - delta;
1193  long long target_frame = m_decoder->GetFramesRead() + real_skip;
1194  if (real_skip >= 0)
1195  {
1196  m_decoder->DoFastForward(target_frame, false);
1197  }
1198  long long seek_frame = m_decoder->GetFramesRead();
1199  m_ffrewAdjust = seek_frame - target_frame;
1200  }
1201  else if (CalcRWTime(-m_ffrewSkip) >= 0)
1202  {
1204  }
1206 }
1207 
1209 {
1210  long long cur_frame = m_decoder->GetFramesPlayed();
1211  bool toBegin = -cur_frame > m_ffrewSkip + m_ffrewAdjust;
1212  long long real_skip = (toBegin) ? -cur_frame : m_ffrewSkip + m_ffrewAdjust;
1213  long long target_frame = cur_frame + real_skip;
1214  bool ret = m_decoder->DoRewind(target_frame, false);
1215  long long seek_frame = m_decoder->GetFramesPlayed();
1216  m_ffrewAdjust = target_frame - seek_frame;
1217  return ret;
1218 }
1219 
1220 bool MythPlayer::DecoderGetFrame(DecodeType decodetype, bool unsafe)
1221 {
1222  bool ret = false;
1223  if (!m_videoOutput)
1224  return false;
1225 
1226  // Wait for frames to be available for decoding onto
1227  int tries = 0;
1228  while (!unsafe && (!m_videoOutput->EnoughFreeFrames() || m_audio.IsBufferAlmostFull()))
1229  {
1231  return false;
1232 
1233  if (++tries > 10)
1234  {
1235  if (++m_videobufRetries >= 2000)
1236  {
1237  LOG(VB_GENERAL, LOG_ERR, LOC +
1238  "Decoder timed out waiting for free video buffers.");
1239  // We've tried for 20 seconds now, give up so that we don't
1240  // get stuck permanently in this state
1241  SetErrored("Decoder timed out waiting for free video buffers.");
1242  }
1243  return false;
1244  }
1245 
1246  usleep(1000);
1247  }
1248  m_videobufRetries = 0;
1249 
1250  if (!m_decoderChangeLock.tryLock(5))
1251  return false;
1253  {
1254  m_decoderChangeLock.unlock();
1255  return false;
1256  }
1257 
1258  if (m_ffrewSkip == 1 || m_decodeOneFrame)
1259  ret = DoGetFrame(decodetype);
1260  else if (m_ffrewSkip != 0)
1261  ret = DecoderGetFrameFFREW();
1262  m_decoderChangeLock.unlock();
1263  return ret;
1264 }
1265 
1280 {
1281  bool ret = false;
1282  QElapsedTimer timeout;
1283  timeout.start();
1284  bool retry = true;
1285  // retry for a maximum of 5 seconds
1286  while (retry && !m_pauseDecoder && !m_killDecoder && !timeout.hasExpired(5000))
1287  {
1288  retry = false;
1289  ret = m_decoder->GetFrame(Type, retry);
1290  if (retry)
1291  {
1292  m_decoderChangeLock.unlock();
1293  QThread::usleep(10000);
1294  m_decoderChangeLock.lock();
1295  }
1296  }
1297 
1298  if (timeout.hasExpired(5000))
1299  return false;
1300  return ret;
1301 }
1302 
1303 void MythPlayer::WrapTimecode(int64_t &timecode, TCTypes tc_type)
1304 {
1305  timecode += m_tcWrap[tc_type];
1306 }
1307 
1308 bool MythPlayer::PrepareAudioSample(int64_t &timecode)
1309 {
1310  WrapTimecode(timecode, TC_AUDIO);
1311  return false;
1312 }
1313 
1315 {
1316  uint64_t bookmark = 0;
1317 
1320  bookmark = 0;
1321  else
1322  {
1323  m_playerCtx->LockPlayingInfo(__FILE__, __LINE__);
1324  if (const ProgramInfo *pi = m_playerCtx->m_playingInfo)
1325  {
1326  bookmark = pi->QueryBookmark();
1327  // Disable progstart if the program has a cutlist.
1328  if (bookmark == 0 && !pi->HasCutlist())
1329  bookmark = pi->QueryProgStart();
1330  if (bookmark == 0)
1331  bookmark = pi->QueryLastPlayPos();
1332  }
1333  m_playerCtx->UnlockPlayingInfo(__FILE__, __LINE__);
1334  }
1335 
1336  return bookmark;
1337 }
1338 
1340 {
1341  bool skip_changed = false;
1342 
1343  float temp_speed = (m_playSpeed == 0.0F) ?
1345  if (m_playSpeed >= 0.0F && m_playSpeed <= 3.0F)
1346  {
1347  skip_changed = (m_ffrewSkip != 1);
1348  if (m_decoder)
1350  m_frameInterval = (int) (1000000.0 / m_videoFrameRate / static_cast<double>(temp_speed))
1351  / m_fpsMultiplier;
1352  m_ffrewSkip = static_cast<int>(m_playSpeed != 0.0F);
1353  }
1354  else
1355  {
1356  skip_changed = true;
1357  m_frameInterval = 200000;
1358  m_frameInterval = (fabs(m_playSpeed) >= 3.0F) ? 133466 : m_frameInterval;
1359  m_frameInterval = (fabs(m_playSpeed) >= 5.0F) ? 133466 : m_frameInterval;
1360  m_frameInterval = (fabs(m_playSpeed) >= 8.0F) ? 250250 : m_frameInterval;
1361  m_frameInterval = (fabs(m_playSpeed) >= 10.0F) ? 133466 : m_frameInterval;
1362  m_frameInterval = (fabs(m_playSpeed) >= 16.0F) ? 187687 : m_frameInterval;
1363  m_frameInterval = (fabs(m_playSpeed) >= 20.0F) ? 150150 : m_frameInterval;
1364  m_frameInterval = (fabs(m_playSpeed) >= 30.0F) ? 133466 : m_frameInterval;
1365  m_frameInterval = (fabs(m_playSpeed) >= 60.0F) ? 133466 : m_frameInterval;
1366  m_frameInterval = (fabs(m_playSpeed) >= 120.0F) ? 133466 : m_frameInterval;
1367  m_frameInterval = (fabs(m_playSpeed) >= 180.0F) ? 133466 : m_frameInterval;
1368  float ffw_fps = fabs(static_cast<double>(m_playSpeed)) * m_videoFrameRate;
1369  float dis_fps = 1000000.0F / m_frameInterval;
1370  m_ffrewSkip = (int)ceil(ffw_fps / dis_fps);
1372  m_ffrewAdjust = 0;
1373  }
1374 
1375  return skip_changed;
1376 }
1377 
1379 {
1380  float last_speed = m_playSpeed;
1384 
1385  bool skip_changed = UpdateFFRewSkip();
1386 
1387  if (skip_changed && m_videoOutput)
1388  {
1390  if (m_playSpeed != 0.0F && !(last_speed == 0.0F && m_ffrewSkip == 1))
1392  }
1393 
1394  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Play speed: " +
1395  QString("rate: %1 speed: %2 skip: %3 => new interval %4")
1396  .arg(m_videoFrameRate).arg(static_cast<double>(m_playSpeed))
1398 
1399  if (m_videoOutput)
1400  m_videoOutput->SetVideoFrameRate(static_cast<float>(m_videoFrameRate));
1401 
1403  {
1406  }
1407 }
1408 
1409 bool MythPlayer::DoRewind(uint64_t frames, double inaccuracy)
1410 {
1412  return false;
1413 
1414  uint64_t number = frames + 1;
1415  uint64_t desiredFrame = (m_framesPlayed > number) ? m_framesPlayed - number : 0;
1416 
1417  m_limitKeyRepeat = false;
1418  if (desiredFrame < m_videoFrameRate)
1419  m_limitKeyRepeat = true;
1420 
1421  uint64_t seeksnap_wanted = UINT64_MAX;
1422  if (inaccuracy != kInaccuracyFull)
1423  seeksnap_wanted = frames * inaccuracy;
1424  ClearBeforeSeek(frames);
1425  WaitForSeek(desiredFrame, seeksnap_wanted);
1426  m_rewindTime = 0;
1427  ClearAfterSeek();
1428  return true;
1429 }
1430 
1436 long long MythPlayer::CalcRWTime(long long rw) const
1437 {
1438  bool hasliveprev = (m_liveTV && m_playerCtx->m_tvchain &&
1440 
1441  if (!hasliveprev || ((int64_t)m_framesPlayed >= rw))
1442  {
1443  return rw;
1444  }
1445 
1446  m_playerCtx->m_tvchain->JumpToNext(false, ((int64_t)m_framesPlayed - rw) / m_videoFrameRate);
1447 
1448  return -1;
1449 }
1450 
1455 long long MythPlayer::CalcMaxFFTime(long long ffframes, bool setjump) const
1456 {
1457  float maxtime = 1.0;
1458  bool islivetvcur = (m_liveTV && m_playerCtx->m_tvchain &&
1460 
1461  if (m_liveTV || IsWatchingInprogress())
1462  maxtime = 3.0;
1463 
1464  long long ret = ffframes;
1465  float ff = ComputeSecs(ffframes, true);
1466  float secsPlayed = ComputeSecs(m_framesPlayed, true);
1467  float secsWritten = ComputeSecs(m_totalFrames, true);
1468 
1469  m_limitKeyRepeat = false;
1470 
1471  if (m_liveTV && !islivetvcur && m_playerCtx->m_tvchain)
1472  {
1473  // recording has completed, totalFrames will always be up to date
1474  if ((ffframes + m_framesPlayed > m_totalFrames) && setjump)
1475  {
1476  ret = -1;
1477  // Number of frames to be skipped is from the end of the current segment
1478  m_playerCtx->m_tvchain->JumpToNext(true, ((int64_t)m_totalFrames - (int64_t)m_framesPlayed - ffframes) / m_videoFrameRate);
1479  }
1480  }
1481  else if (islivetvcur || IsWatchingInprogress())
1482  {
1483  if ((ff + secsPlayed) > secsWritten)
1484  {
1485  // If we attempt to seek past the last known duration,
1486  // check for up to date data
1487  long long framesWritten = m_playerCtx->m_recorder->GetFramesWritten();
1488 
1489  secsWritten = ComputeSecs(framesWritten, true);
1490  }
1491 
1492  float behind = secsWritten - secsPlayed;
1493 
1494  if (behind < maxtime) // if we're close, do nothing
1495  ret = 0;
1496  else if (behind - ff <= maxtime)
1497  ret = TranslatePositionMsToFrame(1000 * (secsWritten - maxtime),
1498  true) - m_framesPlayed;
1499 
1500  if (behind < maxtime * 3)
1501  m_limitKeyRepeat = true;
1502  }
1503  else if (IsPaused())
1504  {
1505  uint64_t lastFrame =
1507  if (m_framesPlayed + ffframes >= lastFrame)
1508  ret = lastFrame - 1 - m_framesPlayed;
1509  }
1510  else
1511  {
1512  float secsMax = secsWritten - 2.F * maxtime;
1513  if (secsMax <= 0.F)
1514  ret = 0;
1515  else if (secsMax < secsPlayed + ff)
1516  ret = TranslatePositionMsToFrame(1000 * secsMax, true)
1517  - m_framesPlayed;
1518  }
1519 
1520  return ret;
1521 }
1522 
1530 {
1531  if (!m_videoOutput || !m_decoder)
1532  return false;
1533 
1534  return m_playerCtx->m_buffer->IsNearEnd(
1536 }
1537 
1541 {
1542  if (!m_playerCtx)
1543  return false;
1544 
1545  m_playerCtx->LockPlayingInfo(__FILE__, __LINE__);
1547  !m_decoder)
1548  {
1549  m_playerCtx->UnlockPlayingInfo(__FILE__, __LINE__);
1550  return false;
1551  }
1552  m_playerCtx->UnlockPlayingInfo(__FILE__, __LINE__);
1553 
1554  auto margin = (long long)(m_videoFrameRate * 2);
1555  margin = (long long) (margin * m_audio.GetStretchFactor());
1556  bool watchingTV = IsWatchingInprogress();
1557 
1558  uint64_t framesRead = m_framesPlayed;
1559  uint64_t framesLeft = 0;
1560 
1562  {
1563  if (framesRead >= m_deleteMap.GetLastFrame())
1564  return true;
1565  uint64_t frameCount = GetCurrentFrameCount();
1566  framesLeft = (frameCount > framesRead) ? frameCount - framesRead : 0;
1567  return (framesLeft < (uint64_t)margin);
1568  }
1569 
1570  if (!m_liveTV && !watchingTV)
1571  return false;
1572 
1574  return false;
1575 
1576  if (m_playerCtx->m_recorder)
1577  {
1578  framesLeft =
1580 
1581  // if it looks like we are near end, get an updated GetFramesWritten()
1582  if (framesLeft < (uint64_t)margin)
1583  framesLeft = m_playerCtx->m_recorder->GetFramesWritten() - framesRead;
1584  }
1585 
1586  return (framesLeft < (uint64_t)margin);
1587 }
1588 
1589 bool MythPlayer::DoFastForward(uint64_t frames, double inaccuracy)
1590 {
1592  return false;
1593 
1594  uint64_t number = (frames ? frames - 1 : 0);
1595  uint64_t desiredFrame = m_framesPlayed + number;
1596 
1597  if (!m_deleteMap.IsEditing() && IsInDelete(desiredFrame))
1598  {
1599  uint64_t endcheck = m_deleteMap.GetLastFrame();
1600  if (desiredFrame > endcheck)
1601  desiredFrame = endcheck;
1602  }
1603 
1604  uint64_t seeksnap_wanted = UINT64_MAX;
1605  if (inaccuracy != kInaccuracyFull)
1606  seeksnap_wanted = frames * inaccuracy;
1607  ClearBeforeSeek(frames);
1608  WaitForSeek(desiredFrame, seeksnap_wanted);
1609  m_ffTime = 0;
1610  ClearAfterSeek(false);
1611  return true;
1612 }
1613 
1614 void MythPlayer::DoJumpToFrame(uint64_t frame, double inaccuracy)
1615 {
1616  if (frame > m_framesPlayed)
1617  DoFastForward(frame - m_framesPlayed, inaccuracy);
1618  else if (frame <= m_framesPlayed)
1619  DoRewind(m_framesPlayed - frame, inaccuracy);
1620 }
1621 
1622 void MythPlayer::WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted)
1623 {
1624  if (!m_decoder)
1625  return;
1626 
1628  m_decoder->SetSeekSnap(seeksnap_wanted);
1629 
1630  bool islivetvcur = (m_liveTV && m_playerCtx->m_tvchain &&
1632 
1633  uint64_t max = GetCurrentFrameCount();
1634  if (islivetvcur || IsWatchingInprogress())
1635  {
1636  max = (uint64_t)m_playerCtx->m_recorder->GetFramesWritten();
1637  }
1638  if (frame >= max)
1639  frame = max - 1;
1640 
1641  m_decoderSeekLock.lock();
1642  m_decoderSeek = frame;
1643  m_decoderSeekLock.unlock();
1644 
1645  int count = 0;
1646  bool needclear = false;
1647  while (m_decoderSeek >= 0)
1648  {
1649  // Waiting blocks the main UI thread but the decoder may
1650  // have initiated a callback into the UI thread to create
1651  // certain resources. Ensure the callback is processed.
1652  // Ideally MythPlayer should be fully event driven and these
1653  // calls wouldn't be necessary.
1654  emit CheckCallbacks();
1655 
1656  // Wait a little
1657  usleep(50 * 1000);
1658 
1659  // provide some on screen feedback if seeking is slow
1660  count++;
1661  if (!(count % 3) && !m_hasFullPositionMap)
1662  {
1663  emit SeekingSlow(count);
1664  needclear = true;
1665  }
1666  }
1667  if (needclear)
1668  emit SeekingComplete();
1669 }
1670 
1683 void MythPlayer::ClearAfterSeek(bool clearvideobuffers)
1684 {
1685  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("ClearAfterSeek(%1)")
1686  .arg(clearvideobuffers));
1687 
1688  if (clearvideobuffers && m_videoOutput)
1690 
1691  int64_t savedTC = m_tcWrap[TC_AUDIO];
1692 
1693  m_tcWrap.fill(0);
1694  m_tcWrap[TC_AUDIO] = savedTC;
1695  m_audio.Reset();
1696 
1697  // Reenable (or re-disable) subtitles, which ultimately does
1698  // nothing except to call ResetCaptions() to erase any captions
1699  // currently on-screen. The key is that the erasing is done in
1700  // the UI thread, not the decoder thread.
1705  m_needNewPauseFrame = true;
1706 
1707  m_avSync.InitAVSync();
1708 }
1709 
1717 // NOLINTNEXTLINE(readability-convert-member-functions-to-static)
1718 void MythPlayer::ClearBeforeSeek(uint64_t Frames)
1719 {
1720 #ifdef USING_MEDIACODEC
1721  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("ClearBeforeSeek: decoder %1 frames %2 recording %3 livetv %4")
1723 
1724  if ((Frames < 2) || !m_videoOutput /*|| !(m_liveTV || m_watchingRecording)*/)
1725  return;
1726 
1727  m_decoderChangeLock.lock();
1729  m_decoderChangeLock.unlock();
1730  if (codec_is_mediacodec(codec))
1731  m_videoOutput->DiscardFrames(true, true);
1732 #else
1733  Q_UNUSED(Frames);
1734 #endif
1735 }
1736 
1737 bool MythPlayer::IsInDelete(uint64_t frame)
1738 {
1739  return m_deleteMap.IsInDelete(frame);
1740 }
1741 
1743 {
1745 }
1746 
1747 QString MythPlayer::GetEncodingType(void) const
1748 {
1749  if (m_decoder)
1751  return QString();
1752 }
1753 
1755 {
1756  if (m_decoder)
1757  return m_decoder->GetRawAudioState();
1758  return false;
1759 }
1760 
1761 QString MythPlayer::GetXDS(const QString &key) const
1762 {
1763  if (!m_decoder)
1764  return QString();
1765  return m_decoder->GetXDS(key);
1766 }
1767 
1769 {
1771  m_forcePositionMapSync = true;
1772 }
1773 
1774 // Returns the total frame count, as totalFrames for a completed
1775 // recording, or the most recent frame count from the recorder for
1776 // live TV or an in-progress recording.
1778 {
1779  uint64_t result = m_totalFrames;
1780  if (IsWatchingInprogress())
1782  return result;
1783 }
1784 
1785 // Finds the frame number associated with the given time offset. A
1786 // positive offset or +0.0F indicate offset from the beginning. A
1787 // negative offset or -0.0F indicate offset from the end. Limit the
1788 // result to within bounds of the video.
1789 uint64_t MythPlayer::FindFrame(float offset, bool use_cutlist) const
1790 {
1791  bool islivetvcur = (m_liveTV && m_playerCtx->m_tvchain &&
1793  uint64_t length_ms = TranslatePositionFrameToMs(m_totalFrames, use_cutlist);
1794  uint64_t position_ms = 0;
1795 
1796  if (signbit(offset))
1797  {
1798  // Always get an updated totalFrame value for in progress recordings
1799  if (islivetvcur || IsWatchingInprogress())
1800  {
1801  uint64_t framesWritten = m_playerCtx->m_recorder->GetFramesWritten();
1802 
1803  if (m_totalFrames < framesWritten)
1804  {
1805  // Known duration is less than what the backend reported, use new value
1806  length_ms =
1807  TranslatePositionFrameToMs(framesWritten, use_cutlist);
1808  }
1809  }
1810  uint64_t offset_ms = llroundf(-offset * 1000);
1811  position_ms = (offset_ms > length_ms) ? 0 : length_ms - offset_ms;
1812  }
1813  else
1814  {
1815  position_ms = llroundf(offset * 1000);
1816 
1817  if (offset > length_ms)
1818  {
1819  // Make sure we have an updated totalFrames
1820  if ((islivetvcur || IsWatchingInprogress()) &&
1821  (length_ms < offset))
1822  {
1823  long long framesWritten =
1825 
1826  length_ms =
1827  TranslatePositionFrameToMs(framesWritten, use_cutlist);
1828  }
1829  position_ms = std::min(position_ms, length_ms);
1830  }
1831  }
1832  return TranslatePositionMsToFrame(position_ms, use_cutlist);
1833 }
1834 
1835 // If position == -1, it signifies that we are computing the current
1836 // duration of an in-progress recording. In this case, we fetch the
1837 // current frame rate and frame count from the recorder.
1838 uint64_t MythPlayer::TranslatePositionFrameToMs(uint64_t position,
1839  bool use_cutlist) const
1840 {
1841  float frameRate = GetFrameRate();
1842  if (position == UINT64_MAX &&
1844  {
1845  float recorderFrameRate = m_playerCtx->m_recorder->GetFrameRate();
1846  if (recorderFrameRate > 0)
1847  frameRate = recorderFrameRate;
1848  position = m_playerCtx->m_recorder->GetFramesWritten();
1849  }
1850  return m_deleteMap.TranslatePositionFrameToMs(position, frameRate,
1851  use_cutlist);
1852 }
1853 
1855 {
1856  if (m_decoder)
1857  return m_decoder->GetNumChapters();
1858  return 0;
1859 }
1860 
1862 {
1863  if (m_decoder)
1865  return 0;
1866 }
1867 
1868 void MythPlayer::GetChapterTimes(QList<long long> &times)
1869 {
1870  if (m_decoder)
1871  return m_decoder->GetChapterTimes(times);
1872 }
1873 
1874 bool MythPlayer::DoJumpChapter(int chapter)
1875 {
1876  int64_t desiredFrame = -1;
1877  int total = GetNumChapters();
1878  int current = GetCurrentChapter();
1879 
1880  if (chapter < 0 || chapter > total)
1881  {
1882 
1883  if (chapter < 0)
1884  {
1885  chapter = current -1;
1886  if (chapter < 0) chapter = 0;
1887  }
1888  else if (chapter > total)
1889  {
1890  chapter = current + 1;
1891  if (chapter > total) chapter = total;
1892  }
1893  }
1894 
1895  desiredFrame = GetChapter(chapter);
1896  LOG(VB_PLAYBACK, LOG_INFO, LOC +
1897  QString("DoJumpChapter: current %1 want %2 (frame %3)")
1898  .arg(current).arg(chapter).arg(desiredFrame));
1899 
1900  if (desiredFrame < 0)
1901  {
1902  LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("DoJumpChapter failed."));
1903  m_jumpChapter = 0;
1904  return false;
1905  }
1906 
1907  DoJumpToFrame(desiredFrame, kInaccuracyNone);
1908  m_jumpChapter = 0;
1909  return true;
1910 }
1911 
1912 int64_t MythPlayer::GetChapter(int chapter)
1913 {
1914  if (m_decoder)
1915  return m_decoder->GetChapter(chapter);
1916  return 0;
1917 }
1918 
1923 {
1924  m_totalDecoderPause = true;
1925  PauseDecoder();
1926 
1927  {
1928  while (!m_decoderChangeLock.tryLock(10))
1929  LOG(VB_GENERAL, LOG_INFO, LOC + "Waited 10ms for decoder lock");
1930  delete m_decoder;
1931  m_decoder = dec;
1932  m_decoderChangeLock.unlock();
1933  }
1934  // reset passthrough override
1935  m_disablePassthrough = false;
1937  m_totalDecoderPause = false;
1938 }
1939 
1940 bool MythPlayer::PosMapFromEnc(uint64_t start,
1941  frm_pos_map_t &posMap,
1942  frm_pos_map_t &durMap)
1943 {
1944  // Reads only new positionmap entries from encoder
1945  if (!(m_liveTV || (m_playerCtx->m_recorder &&
1947  return false;
1948 
1949  // if livetv, and we're not the last entry, don't get it from the encoder
1950  if (HasTVChainNext())
1951  return false;
1952 
1953  LOG(VB_PLAYBACK, LOG_INFO, LOC +
1954  QString("Filling position map from %1 to %2") .arg(start).arg("end"));
1955 
1956  m_playerCtx->m_recorder->FillPositionMap(start, -1, posMap);
1957  m_playerCtx->m_recorder->FillDurationMap(start, -1, durMap);
1958 
1959  return true;
1960 }
1961 
1962 void MythPlayer::SetErrored(const QString &reason)
1963 {
1964  QMutexLocker locker(&m_errorLock);
1965 
1966  if (m_videoOutput)
1968 
1969  if (m_errorMsg.isEmpty())
1970  {
1971  m_errorMsg = reason;
1972  }
1973  else
1974  {
1975  LOG(VB_GENERAL, LOG_ERR, LOC + QString("%1").arg(reason));
1976  }
1977 }
1978 
1980 {
1981  QMutexLocker locker(&m_errorLock);
1982 
1983  m_errorMsg = QString();
1984 }
1985 
1986 bool MythPlayer::IsErrored(void) const
1987 {
1988  QMutexLocker locker(&m_errorLock);
1989  return !m_errorMsg.isEmpty();
1990 }
1991 
1992 QString MythPlayer::GetError(void) const
1993 {
1994  QMutexLocker locker(&m_errorLock);
1995  return m_errorMsg;
1996 }
1997 
1999 {
2000  if (!m_decoder)
2001  return;
2002 
2004 }
2005 
2007 {
2008  if (!m_decoder)
2009  return;
2010 
2012 }
2013 
2015 {
2016  if (!m_decoder)
2017  return;
2018 
2020 }
2021 
2023 {
2024  if (m_decoder && m_audio.HasAudioOut())
2025  {
2026  float stretch = m_audio.GetStretchFactor();
2027  m_disablePassthrough |= (stretch < 0.99F) || (stretch > 1.01F);
2028  LOG(VB_PLAYBACK, LOG_INFO, LOC +
2029  QString("Stretch Factor %1, %2 passthru ")
2031  .arg((m_disablePassthrough) ? "disable" : "allow"));
2033  }
2034 }
2035 
2037 {
2038  if (m_decoder && m_audio.HasAudioOut())
2040 }
2041 
2043 {
2044  if (m_decoder && m_audio.HasAudioOut())
2046 }
2047 
2048 static unsigned dbg_ident(const MythPlayer *player)
2049 {
2050  static QMutex s_dbgLock;
2051  static unsigned s_dbgNextIdent = 0;
2052  using DbgMapType = QHash<const MythPlayer*, unsigned>;
2053  static DbgMapType s_dbgIdent;
2054 
2055  QMutexLocker locker(&s_dbgLock);
2056  DbgMapType::iterator it = s_dbgIdent.find(player);
2057  if (it != s_dbgIdent.end())
2058  return *it;
2059  return s_dbgIdent[player] = s_dbgNextIdent++;
2060 }
MythPlayer::IsNearEnd
bool IsNearEnd(void)
Returns true iff near end of recording.
Definition: mythplayer.cpp:1540
DeleteMap::SetPlayerContext
void SetPlayerContext(PlayerContext *ctx)
Definition: deletemap.h:31
DecoderBase::GetCurrentChapter
virtual int GetCurrentChapter(long long)
Definition: decoderbase.h:155
kLiveTVAutoExpire
@ kLiveTVAutoExpire
Definition: programtypes.h:239
kDecodeAV
@ kDecodeAV
Definition: decoderbase.h:52
MythPlayer::m_buffering
bool m_buffering
Definition: mythplayer.h:474
DecoderBase::DoFastForward
virtual bool DoFastForward(long long desiredFrame, bool discardFrames=true)
Skips ahead or rewinds to desiredFrame.
Definition: decoderbase.cpp:704
MythPlayer::EnableSubtitles
void EnableSubtitles(bool enable)
Definition: mythplayer.cpp:691
build_compdb.dest
dest
Definition: build_compdb.py:9
MythPlayer::m_frameInterval
int m_frameInterval
always adjusted for play_speed
Definition: mythplayer.h:522
dbg_ident
static unsigned dbg_ident(const MythPlayer *)
Definition: mythplayer.cpp:2048
PlayerContext::GetState
TVState GetState(void) const
Definition: playercontext.cpp:336
MythPlayer::m_enableForcedSubtitles
bool m_enableForcedSubtitles
Definition: mythplayer.h:497
LiveTVChain::GetCurPos
int GetCurPos(void) const
Definition: livetvchain.h:54
MythPlayer::m_errorLock
QMutex m_errorLock
Definition: mythplayer.h:425
MThread::start
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:288
hardwareprofile.smolt.timeout
float timeout
Definition: smolt.py:103
kDecoderProbeBufferSize
const int kDecoderProbeBufferSize
Definition: decoderbase.h:22
MythPlayer::m_videoPaused
bool m_videoPaused
Definition: mythplayer.h:418
DecoderBase::GetFramesPlayed
long long GetFramesPlayed(void) const
Definition: decoderbase.h:203
PlayerContext::UnlockPlayingInfo
void UnlockPlayingInfo(const char *file, int line) const
Definition: playercontext.cpp:248
MythPlayer::m_watchingRecording
bool m_watchingRecording
Definition: mythplayer.h:429
MythVideoOutputNull::Create
static MythVideoOutputNull * Create(QSize VideoDim, QSize VideoDispDim, float VideoAspect, MythCodecID CodecID)
Definition: mythvideooutnull.cpp:53
RemoteEncoder::GetRecorderNumber
int GetRecorderNumber(void) const
Definition: remoteencoder.cpp:61
MythVideoOutput::DirectRenderFormats
const VideoFrameTypes * DirectRenderFormats() const
Definition: mythvideoout.cpp:422
MythPlayer::SetEof
void SetEof(EofState eof)
Definition: mythplayer.cpp:1101
MythPlayer::m_inJumpToProgramPause
bool m_inJumpToProgramPause
Definition: mythplayer.h:411
AudioPlayer::Reset
void Reset(void)
Definition: audioplayer.cpp:83
MythPlayer::UpdateFFRewSkip
bool UpdateFFRewSkip(void)
Definition: mythplayer.cpp:1339
MythPlayer::PrepareAudioSample
virtual bool PrepareAudioSample(int64_t &timecode)
Definition: mythplayer.cpp:1308
MythPlayer::m_bufferPaused
bool m_bufferPaused
Definition: mythplayer.h:417
MythPlayer::m_commBreakMap
CommBreakMap m_commBreakMap
Definition: mythplayer.h:512
DecoderBase::GetEof
EofState GetEof(void)
Definition: decoderbase.h:135
MythPlayer::ChangeSpeed
virtual void ChangeSpeed(void)
Definition: mythplayer.cpp:1378
MythPlayer::m_decoderThread
MythDecoderThread * m_decoderThread
Definition: mythplayer.h:393
MythPlayer::m_cc608
CC608Reader m_cc608
Definition: mythplayer.h:502
DeleteMap::TrackerReset
void TrackerReset(uint64_t frame)
Resets the internal state tracker.
Definition: deletemap.cpp:806
kEofStateNone
@ kEofStateNone
Definition: decoderbase.h:69
MythPlayer::m_bufferingCounter
int m_bufferingCounter
Definition: mythplayer.h:538
PlayerContext::SetPlayingInfo
void SetPlayingInfo(const ProgramInfo *info)
assign programinfo to the context
Definition: playercontext.cpp:505
MythPlayer::TranslatePositionMsToFrame
uint64_t TranslatePositionMsToFrame(uint64_t position, bool use_cutlist) const
Definition: mythplayer.h:284
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:14
MythPlayer::kNightModeContrastAdjustment
static const int kNightModeContrastAdjustment
Definition: mythplayer.h:266
LiveTVChain::HasNext
bool HasNext(void) const
Definition: livetvchain.cpp:405
MythPlayer::CheckCallbacks
void CheckCallbacks()
MythPlayer::m_ffrewAdjust
int m_ffrewAdjust
Definition: mythplayer.h:525
MythPlayer::m_decoderThreadUnpause
QWaitCondition m_decoderThreadUnpause
Definition: mythplayer.h:402
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
MythVideoOutput::InputChanged
virtual bool InputChanged(const QSize &VideoDim, const QSize &VideoDispDim, float VideoAspect, MythCodecID CodecID, bool &AspectChanged, int ReferenceFrames, bool ForceChange)
Tells video output to discard decoded frames and wait for new ones.
Definition: mythvideoout.cpp:217
MythPlayer::UnpauseBuffer
void UnpauseBuffer(void)
Definition: mythplayer.cpp:150
MythPlayer::SeekingSlow
void SeekingSlow(int Count)
MythPlayer::m_avSync
MythPlayerAVSync m_avSync
Definition: mythplayer.h:456
MythPlayer::DecoderPauseCheck
virtual void DecoderPauseCheck(void)
Definition: mythplayer.cpp:1076
MythPlayer::m_playSpeed
float m_playSpeed
Definition: mythplayer.h:521
MythVideoOutput::FreeVideoFrames
int FreeVideoFrames()
Returns number of frames available for decoding onto.
Definition: mythvideoout.cpp:319
kMusicChoice
@ kMusicChoice
Definition: mythplayer.h:90
RemoteEncoder::FillDurationMap
void FillDurationMap(int64_t start, int64_t end, frm_pos_map_t &durationMap)
Definition: remoteencoder.cpp:293
MythVideoOutput::GetError
VideoErrorState GetError() const
Definition: mythvideoout.cpp:295
MythPlayer::CheckTVChain
void CheckTVChain()
Definition: mythplayer.cpp:951
MythPlayer::m_totalDecoderPause
bool m_totalDecoderPause
Definition: mythplayer.h:409
MythPlayer::OpenFile
virtual int OpenFile(int Retries=4)
Definition: mythplayer.cpp:427
MythPlayer::m_allowForcedSubtitles
bool m_allowForcedSubtitles
Definition: mythplayer.h:499
MythPlayer::m_nextNormalSpeed
bool m_nextNormalSpeed
Definition: mythplayer.h:527
CardUtil::SetStartChannel
static bool SetStartChannel(uint inputid, const QString &channum)
Definition: cardutil.cpp:1616
MythPlayer::PrebufferEnoughFrames
virtual bool PrebufferEnoughFrames(int min_buffers=0)
Definition: mythplayer.cpp:749
CommBreakMap::SetTracker
void SetTracker(uint64_t framesPlayed)
Definition: commbreakmap.cpp:68
DetectLetterbox.h
MythPlayer::m_videobufRetries
int m_videobufRetries
How often we have tried to wait for a video output buffer and failed.
Definition: mythplayer.h:449
MythPlayer::IsPaused
bool IsPaused(void) const
Definition: mythplayer.h:171
MythPlayer::m_decoderSeekLock
QMutex m_decoderSeekLock
Definition: mythplayer.h:404
ProgramInfo::GetChanNum
QString GetChanNum(void) const
This is the channel "number", in the form 1, 1_2, 1-2, 1#1, etc.
Definition: programinfo.h:374
MythVideoOutput::s_defaultFrameTypes
static VideoFrameTypes s_defaultFrameTypes
Definition: mythvideoout.h:36
MythPlayer::m_forcePositionMapSync
bool m_forcePositionMapSync
Definition: mythplayer.h:513
MythPlayer::HasReachedEof
virtual bool HasReachedEof(void) const
Definition: mythplayer.cpp:657
MythPlayer::AudioEnd
virtual void AudioEnd(void)
Definition: mythplayer.cpp:981
TC_VIDEO
@ TC_VIDEO
Definition: mythplayer.h:53
MythCoreContext::IsDatabaseIgnored
bool IsDatabaseIgnored(void) const
/brief Returns true if database is being ignored.
Definition: mythcorecontext.cpp:893
MythPlayer::m_latestVideoTimecode
int64_t m_latestVideoTimecode
Definition: mythplayer.h:455
arg
arg(title).arg(filename).arg(doDelete))
ProgramInfo::GetChannelSchedulingID
QString GetChannelSchedulingID(void) const
This is the unique programming identifier of a channel.
Definition: programinfo.h:381
AudioPlayer::SetStretchFactor
void SetStretchFactor(float factor)
Definition: audioplayer.cpp:369
MythPlayer::m_ffrewSkip
int m_ffrewSkip
Definition: mythplayer.h:524
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:82
MythPlayer::SetCommBreakMap
void SetCommBreakMap(frm_dir_map_t &newMap)
Definition: mythplayer.cpp:1768
FrameScanType
FrameScanType
Definition: videoouttypes.h:61
MythPlayer::syncWithAudioStretch
void syncWithAudioStretch()
Definition: mythplayer.cpp:2022
MythPlayer::m_errorMsg
QString m_errorMsg
Reason why NVP exited with a error.
Definition: mythplayer.h:426
preBufferDebug
static char * preBufferDebug
Definition: mythplayer.cpp:747
MythPlayer::m_bufferPauseLock
QMutex m_bufferPauseLock
Definition: mythplayer.h:405
AudioPlayer::CheckFormat
void CheckFormat(void)
Definition: audioplayer.cpp:172
DecoderBase::IsErrored
bool IsErrored() const
Definition: decoderbase.h:224
Context
QHash< QString, Action * > Context
Definition: action.h:77
AudioPlayer::IsBufferAlmostFull
bool IsBufferAlmostFull(void)
Definition: audioplayer.cpp:493
MythPlayer::SaveTotalFrames
void SaveTotalFrames(void)
Definition: mythplayer.cpp:2014
MythPlayer::IsErrored
bool IsErrored(void) const
Definition: mythplayer.cpp:1986
MythPlayer::m_normalSpeed
bool m_normalSpeed
Definition: mythplayer.h:528
RemoteEncoder::GetFramesWritten
long long GetFramesWritten(void)
Returns number of frames written to disk by TVRec's RecorderBase instance.
Definition: remoteencoder.cpp:193
CC608Reader::SetTTPageNum
void SetTTPageNum(int page)
Definition: cc608reader.h:83
MythPlayer::GetFrameRate
float GetFrameRate(void) const
Definition: mythplayer.h:153
MythTimer::start
void start(void)
starts measuring elapsed time.
Definition: mythtimer.cpp:47
MythMediaBuffer::Unpause
void Unpause(void)
Unpauses the read-ahead thread.
Definition: mythmediabuffer.cpp:700
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythMediaBuffer::GetSafeFilename
QString GetSafeFilename(void)
Definition: mythmediabuffer.cpp:1740
MythPlayer::GetCurrentFrameCount
uint64_t GetCurrentFrameCount(void) const
Definition: mythplayer.cpp:1777
AudioPlayer::HasAudioOut
bool HasAudioOut(void) const
Definition: audioplayer.h:54
VBIMode::Parse
static uint Parse(const QString &vbiformat)
Definition: tv.h:16
DeleteMap::IsEmpty
bool IsEmpty(void) const
Definition: deletemap.cpp:259
is_current_thread
bool is_current_thread(MThread *thread)
Use this to determine if you are in the named thread.
Definition: mthread.cpp:40
mythplayer.h
MythPlayer::m_pauseLock
QMutex m_pauseLock
Definition: mythplayer.h:407
MythVideoOutput::SetFramesPlayed
virtual void SetFramesPlayed(long long FramesPlayed)
Definition: mythvideoout.cpp:280
MythPlayer::CalcRWTime
long long CalcRWTime(long long rw) const
CalcRWTime(rw): rewind rw frames back.
Definition: mythplayer.cpp:1436
PlayerFlags
PlayerFlags
Definition: mythplayer.h:79
MythPlayer::GetEof
EofState GetEof(void) const
Definition: mythplayer.cpp:1088
MythPlayer::Pause
bool Pause(void)
Definition: mythplayer.cpp:159
MythPlayer
Definition: mythplayer.h:100
RemoteEncoder::IsValidRecorder
bool IsValidRecorder(void) const
Definition: remoteencoder.cpp:56
MythPlayer::SignalOSDMessage
void SignalOSDMessage(const QString &Message)
MythPlayer::GetBookmark
virtual uint64_t GetBookmark(void)
Definition: mythplayer.cpp:1314
DecoderBase::GetVideoCodecID
virtual MythCodecID GetVideoCodecID(void) const =0
MythPlayer::m_nextPlaySpeed
float m_nextPlaySpeed
Definition: mythplayer.h:520
MythPlayer::GetChapterTimes
virtual void GetChapterTimes(QList< long long > &times)
Definition: mythplayer.cpp:1868
MythPlayer::m_bufferingLastMsg
QTime m_bufferingLastMsg
Definition: mythplayer.h:476
MythPlayer::SeekingComplete
void SeekingComplete()
CommBreakMap::SetMap
void SetMap(const frm_dir_map_t &newMap, uint64_t framesPlayed)
Definition: commbreakmap.cpp:132
hardwareprofile.scan.scan
def scan(profile, smoonURL, gate)
Definition: scan.py:57
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
DecoderBase::GetChapterTimes
virtual void GetChapterTimes(QList< long long > &)
Definition: decoderbase.h:156
MythPlayer::m_videoPauseLock
QMutex m_videoPauseLock
Definition: mythplayer.h:406
MythPlayer::SetErrored
void SetErrored(const QString &reason)
Definition: mythplayer.cpp:1962
MythPlayer::GetEncodingType
QString GetEncodingType(void) const
Definition: mythplayer.cpp:1747
MythPlayer::DiscardVideoFrames
void DiscardVideoFrames(bool KeyFrame, bool Flushed)
Places frames in the available frames queue.
Definition: mythplayer.cpp:651
MythPlayer::m_needNewPauseFrame
bool m_needNewPauseFrame
Definition: mythplayer.h:416
MythMediaBuffer::GetStopReads
bool GetStopReads(void) const
Definition: mythmediabuffer.cpp:1771
DeleteMap::TrackerWantsToJump
bool TrackerWantsToJump(uint64_t frame, uint64_t &to) const
Returns true if the given frame has passed the last cut point start and provides the frame number of ...
Definition: deletemap.cpp:840
MythPlayer::SetDecoder
void SetDecoder(DecoderBase *dec)
Sets the stream decoder, deleting any existing recorder.
Definition: mythplayer.cpp:1922
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
MythPlayer::kInaccuracyNone
static const double kInaccuracyNone
Definition: mythplayer.h:267
MythVideoFrame::m_timecode
long long m_timecode
Definition: mythframe.h:122
MythVideoOutput::SetPrebuffering
void SetPrebuffering(bool Normal)
Sets whether to use a normal number of buffers or fewer buffers.
Definition: mythvideoout.cpp:301
MythPlayerAVSync::ResetAVSyncForLiveTV
bool ResetAVSyncForLiveTV(AudioPlayer *Audio)
Definition: mythplayeravsync.cpp:55
MythPlayer::ResetErrored
void ResetErrored(void)
Definition: mythplayer.cpp:1979
DecoderBase::GetChapter
virtual long long GetChapter(int)
Definition: decoderbase.h:157
MythPlayer::HasTVChainNext
bool HasTVChainNext(void) const
Definition: mythplayer.cpp:1742
MythPlayer::TranslatePositionFrameToMs
uint64_t TranslatePositionFrameToMs(uint64_t position, bool use_cutlist) const
Definition: mythplayer.cpp:1838
MythPlayer::GetRawAudioState
bool GetRawAudioState(void) const
Definition: mythplayer.cpp:1754
MythPlayer::~MythPlayer
~MythPlayer() override
Definition: mythplayer.cpp:113
EofState
EofState
Definition: decoderbase.h:68
mythdecoderthread.h
MythPlayer::m_audio
AudioPlayer m_audio
Definition: mythplayer.h:509
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
MythPlayer::PauseChanged
void PauseChanged(bool Paused)
DecoderBase::SaveTotalDuration
void SaveTotalDuration(void)
Definition: decoderbase.cpp:1235
MythMediaBuffer::GetFilename
QString GetFilename(void) const
Definition: mythmediabuffer.cpp:1732
MythPlayer::UnpauseVideo
void UnpauseVideo(void)
Definition: mythplayer.cpp:230
MythPlayer::m_decoder
DecoderBase * m_decoder
Definition: mythplayer.h:389
MythPlayer::ComputeSecs
float ComputeSecs(uint64_t position, bool use_cutlist) const
Definition: mythplayer.h:299
RemoteEncoder::GetCachedFramesWritten
long long GetCachedFramesWritten(void) const
Return value last returned by GetFramesWritten().
Definition: remoteencoder.h:41
MythPlayer::m_framesPlayed
uint64_t m_framesPlayed
Definition: mythplayer.h:450
MythPlayer::m_rewindTime
long long m_rewindTime
Definition: mythplayer.h:454
DecoderBase::ForceSetupAudioStream
virtual void ForceSetupAudioStream(void)
Definition: decoderbase.h:147
MythPlayer::kNightModeBrightenssAdjustment
static const int kNightModeBrightenssAdjustment
Definition: mythplayer.h:265
programinfo.h
LiveTVChain::JumpToNext
void JumpToNext(bool up, int pos)
JumpToNext(bool up, int pos) jump to the next (up == true) or previous (up == false) liveTV program I...
Definition: livetvchain.cpp:617
mythvideooutnull.h
MythPlayer::m_totalLength
long long m_totalLength
Definition: mythplayer.h:452
MythPlayer::GetChapter
virtual int64_t GetChapter(int chapter)
Definition: mythplayer.cpp:1912
mythlogging.h
codec_is_mediacodec
#define codec_is_mediacodec(id)
Definition: mythcodecid.h:323
MythVideoOutput::ValidVideoFrames
virtual int ValidVideoFrames() const
Returns number of frames that are fully decoded.
Definition: mythvideoout.cpp:313
CommBreakMap::ResetLastSkip
void ResetLastSkip(void)
Definition: commbreakmap.cpp:28
MythPlayer::DirectRenderFormats
const VideoFrameTypes * DirectRenderFormats(void)
Return a list of frame types that can be rendered directly.
Definition: mythplayer.cpp:586
MythPlayer::m_ffTime
long long m_ffTime
If m_ffTime>0, number of frames to seek forward.
Definition: mythplayer.h:445
MythMediaBuffer::WaitForPause
void WaitForPause(void)
Waits for Pause(void) to take effect.
Definition: mythmediabuffer.cpp:714
AudioPlayer::DeleteOutput
void DeleteOutput(void)
Definition: audioplayer.cpp:92
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:66
MythPlayer::ClearBeforeSeek
void ClearBeforeSeek(uint64_t Frames)
Discard video frames prior to seeking.
Definition: mythplayer.cpp:1718
PlayerContext::m_playingInfo
ProgramInfo * m_playingInfo
Currently playing info.
Definition: playercontext.h:116
tv_actions.h
MythPlayer::m_tcWrap
tctype_arr m_tcWrap
Definition: mythplayer.h:531
MythPlayer::DecoderGetFrame
bool DecoderGetFrame(DecodeType decodetype, bool unsafe=false)
Definition: mythplayer.cpp:1220
MythPlayer::SetPlayingInfo
void SetPlayingInfo(const ProgramInfo &pginfo)
Definition: mythplayer.cpp:237
MythVideoOutput::ClearAfterSeek
virtual void ClearAfterSeek()
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideoout.cpp:307
MythPlayer::m_captionsEnabledbyDefault
bool m_captionsEnabledbyDefault
This allows us to enable captions/subtitles later if the streams are not immediately available when t...
Definition: mythplayer.h:493
MythVideoOutput::DeLimboFrame
virtual void DeLimboFrame(MythVideoFrame *Frame)
Releases a frame for reuse if it is in limbo.
Definition: mythvideoout.cpp:443
RemoteEncoder::GetFrameRate
float GetFrameRate(void)
Returns recordering frame rate set by nvr.
Definition: remoteencoder.cpp:158
hardwareprofile.i18n.t
t
Definition: i18n.py:36
PlayerContext::LockPlayingInfo
void LockPlayingInfo(const char *file, int line) const
Definition: playercontext.cpp:236
MythPlayer::FindFrame
uint64_t FindFrame(float offset, bool use_cutlist) const
Definition: mythplayer.cpp:1789
MythPlayer::m_bookmarkSeek
uint64_t m_bookmarkSeek
Definition: mythplayer.h:438
DecoderBase::GetfpsMultiplier
int GetfpsMultiplier(void) const
Definition: decoderbase.h:261
MythPlayer::DoJumpChapter
virtual bool DoJumpChapter(int chapter)
Definition: mythplayer.cpp:1874
VideoFrameTypes
std::vector< VideoFrameType > VideoFrameTypes
Definition: mythframe.h:78
MythVideoOutput::GetFrameStatus
QString GetFrameStatus() const
Returns string with status of each frame for debugging.
Definition: mythvideoout.cpp:344
MythPlayer::m_videoOutput
MythVideoOutput * m_videoOutput
Definition: mythplayer.h:391
MythPlayer::m_hasFullPositionMap
bool m_hasFullPositionMap
Definition: mythplayer.h:431
MythPlayer::IsInDelete
bool IsInDelete(uint64_t frame)
Definition: mythplayer.cpp:1737
MythPlayer::m_clearSavedPosition
int m_clearSavedPosition
Definition: mythplayer.h:439
PlayerContext::m_buffer
MythMediaBuffer * m_buffer
Definition: playercontext.h:115
MythPlayer::MythDecoderThread
friend class MythDecoderThread
Definition: mythplayer.h:107
MythPlayer::MythPlayer
MythPlayer(PlayerContext *Context, PlayerFlags Flags=kNoFlags)
Definition: mythplayer.cpp:85
ScanTypeToString
QString ScanTypeToString(FrameScanType Scan)
Definition: videoouttypes.h:177
DecodeType
DecodeType
Definition: decoderbase.h:48
MythPlayer::m_decoderPauseLock
QMutex m_decoderPauseLock
Definition: mythplayer.h:403
MythPlayerAVSync::GetAVSyncAudioPause
bool GetAVSyncAudioPause() const
Definition: mythplayeravsync.cpp:45
MythVideoOutput::GetNextFreeFrame
virtual MythVideoFrame * GetNextFreeFrame()
Blocks until it is possible to return a frame for decoding onto.
Definition: mythvideoout.cpp:430
MythPlayer::InitVideo
virtual bool InitVideo(void)
Definition: mythplayer.cpp:276
MythPlayer::m_totalDuration
int64_t m_totalDuration
Definition: mythplayer.h:453
kTrackTypeTeletextCaptions
@ kTrackTypeTeletextCaptions
Definition: decoderbase.h:34
MythPlayer::PauseVideo
void PauseVideo(void)
Definition: mythplayer.cpp:222
DeleteMap::IsInDelete
bool IsInDelete(uint64_t frame) const
Returns true if the given frame is deemed to be within a region that should be cut.
Definition: deletemap.cpp:570
DecoderBase::ResetTotalDuration
void ResetTotalDuration(void)
Definition: decoderbase.h:258
MythPlayer::ClearAfterSeek
void ClearAfterSeek(bool clearvideobuffers=true)
This is to support seeking...
Definition: mythplayer.cpp:1683
MythPlayer::m_bufferingStart
QTime m_bufferingStart
Definition: mythplayer.h:475
MythPlayer::m_ttPageNum
int m_ttPageNum
VBI page to display when in PAL vbimode.
Definition: mythplayer.h:486
MythPlayer::SetBuffering
void SetBuffering(bool new_buffering)
Definition: mythplayer.cpp:729
MythPlayer::PauseDecoder
bool PauseDecoder(void)
Definition: mythplayer.cpp:986
DeleteMap::LoadMap
void LoadMap(const QString &undoMessage="")
Loads the delete map from the database.
Definition: deletemap.cpp:737
TCTypes
TCTypes
Timecode types.
Definition: mythplayer.h:52
MythPlayer::m_totalFrames
uint64_t m_totalFrames
Definition: mythplayer.h:451
hardwareprofile.smolt.long
long
Definition: smolt.py:76
MythPlayer::ResetPlaying
virtual void ResetPlaying(bool resetframes=true)
Definition: mythplayer.cpp:937
MythPlayerAVSync::SetAVSyncMusicChoice
void SetAVSyncMusicChoice(AudioPlayer *Audio)
Definition: mythplayeravsync.cpp:64
MythPlayer::m_videoFrameRate
double m_videoFrameRate
Video (input) Frame Rate (often inaccurate)
Definition: mythplayer.h:461
DeleteMap::TranslatePositionFrameToMs
uint64_t TranslatePositionFrameToMs(uint64_t position, float fallback_framerate, bool use_cutlist) const
Definition: deletemap.cpp:895
get_encoding_type
QString get_encoding_type(MythCodecID codecid)
Definition: mythcodecid.cpp:475
MythVideoOutput::GetFramesPlayed
virtual long long GetFramesPlayed()
Definition: mythvideoout.cpp:285
TestBufferVec
std::vector< char > TestBufferVec
Definition: decoderbase.h:23
DecoderBase::GetXDS
virtual QString GetXDS(const QString &) const
Definition: decoderbase.h:248
jitterometer.h
MythPlayer::m_playerCtx
PlayerContext * m_playerCtx
Definition: mythplayer.h:392
DecoderBase::GetFPS
virtual double GetFPS(void) const
Definition: decoderbase.h:197
MythPlayer::m_forcedVideoAspect
float m_forcedVideoAspect
Definition: mythplayer.h:468
MythPlayer::m_videoDispDim
QSize m_videoDispDim
Video (input) width & height.
Definition: mythplayer.h:464
MythPlayer::DeLimboFrame
void DeLimboFrame(MythVideoFrame *frame)
Definition: mythplayer.cpp:671
MythVideoOutput::DiscardFrames
virtual void DiscardFrames(bool KeyFrame, bool Flushed)
Releases all frames not being actively displayed from any queue onto the queue of frames ready for de...
Definition: mythvideoout.cpp:471
MythPlayer::m_codecName
QString m_codecName
Codec Name - used by playback profile.
Definition: mythplayer.h:463
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:87
MythPlayer::PosMapFromEnc
bool PosMapFromEnc(uint64_t start, frm_pos_map_t &posMap, frm_pos_map_t &durMap)
Definition: mythplayer.cpp:1940
MythPlayer::m_disableForcedSubtitles
bool m_disableForcedSubtitles
Definition: mythplayer.h:498
MythMediaBuffer::LiveMode
bool LiveMode(void) const
Returns true if this RingBuffer has been assigned a LiveTVChain.
Definition: mythmediabuffer.cpp:1791
MythPlayer::m_keyframeDist
uint m_keyframeDist
Video (input) Number of frames between key frames (often inaccurate)
Definition: mythplayer.h:471
MythPlayer::m_pauseDecoder
bool m_pauseDecoder
Definition: mythplayer.h:412
MythPlayer::GetEditMode
bool GetEditMode(void) const
Definition: mythplayer.h:342
MythPlayer::EnableForcedSubtitles
void EnableForcedSubtitles(bool enable)
Definition: mythplayer.cpp:699
MythPlayer::m_fpsMultiplier
int m_fpsMultiplier
used to detect changes
Definition: mythplayer.h:523
uint
unsigned int uint
Definition: compat.h:140
MythPlayer::m_endExitPrompt
int m_endExitPrompt
Definition: mythplayer.h:440
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:56
MythPlayer::m_unpauseDecoder
bool m_unpauseDecoder
Definition: mythplayer.h:413
MythPlayer::m_playerFlags
PlayerFlags m_playerFlags
Definition: mythplayer.h:398
MythPlayer::UnpauseDecoder
void UnpauseDecoder(void)
Definition: mythplayer.cpp:1010
MythPlayer::m_playingLock
QMutex m_playingLock
Definition: mythplayer.h:424
MythPlayer::PauseBuffer
void PauseBuffer(void)
Definition: mythplayer.cpp:138
MythPlayer::m_deleteMap
DeleteMap m_deleteMap
Definition: mythplayer.h:515
PlayerContext::m_tvchain
LiveTVChain * m_tvchain
Definition: playercontext.h:114
DecoderBase::GetRawAudioState
virtual bool GetRawAudioState(void) const
Definition: decoderbase.h:191
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:929
MythPlayer::m_vbiMode
uint m_vbiMode
VBI decoder to use.
Definition: mythplayer.h:485
kTrackTypeSubtitle
@ kTrackTypeSubtitle
Definition: decoderbase.h:31
MythPlayer::VideoEnd
virtual void VideoEnd(void)
Definition: mythplayer.cpp:855
MythPlayer::DoFastForward
bool DoFastForward(uint64_t frames, double inaccuracy)
Definition: mythplayer.cpp:1589
MythPlayer::m_playerThread
QThread * m_playerThread
Definition: mythplayer.h:394
MythPlayer::m_limitKeyRepeat
bool m_limitKeyRepeat
Definition: mythplayer.h:432
MythPlayer::DecoderGetFrameREW
virtual bool DecoderGetFrameREW(void)
Definition: mythplayer.cpp:1208
MythPlayer::DecoderEnd
virtual void DecoderEnd(void)
Definition: mythplayer.cpp:1055
mythmediabuffer.h
DecoderBase::SyncPositionMap
virtual bool SyncPositionMap(void)
Updates the position map used for skipping frames.
Definition: decoderbase.cpp:316
MythPlayer::ReinitVideo
virtual void ReinitVideo(bool ForceUpdate)
Definition: mythplayer.cpp:300
frm_pos_map_t
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
Definition: programtypes.h:46
MythVideoOutput::EnoughFreeFrames
bool EnoughFreeFrames()
Returns true iff enough frames are available to decode onto.
Definition: mythvideoout.cpp:325
MythPlayer::m_decoderPaused
bool m_decoderPaused
Definition: mythplayer.h:410
MythPlayer::DoJumpToFrame
void DoJumpToFrame(uint64_t frame, double inaccuracy)
Definition: mythplayer.cpp:1614
MythPlayer::SetVideoParams
virtual void SetVideoParams(int w, int h, double fps, float aspect, bool ForceUpdate, int ReferenceFrames, FrameScanType=kScan_Ignore, const QString &codecName=QString())
Definition: mythplayer.cpp:334
MythPlayer::JumpChapter
void JumpChapter(int chapter)
Definition: mythplayer.cpp:931
MythVideoOutput::ReleaseFrame
virtual void ReleaseFrame(MythVideoFrame *Frame)
Releases a frame from the ready for decoding queue onto the queue of frames ready for display.
Definition: mythvideoout.cpp:437
DecoderBase::SetSeekSnap
void SetSeekSnap(uint64_t snap)
Definition: decoderbase.h:137
MythPlayer::GetNumChapters
virtual int GetNumChapters(void)
Definition: mythplayer.cpp:1854
DecoderBase::GetNumChapters
virtual int GetNumChapters(void)
Definition: decoderbase.h:154
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:923
MythPlayer::m_jumpChapter
int m_jumpChapter
Definition: mythplayer.h:435
MythPlayer::InitFrameInterval
virtual void InitFrameInterval()
Definition: mythplayer.cpp:723
MythPlayer::GetError
QString GetError(void) const
Definition: mythplayer.cpp:1992
MythPlayer::m_enableCaptions
bool m_enableCaptions
Definition: mythplayer.h:495
DecoderBase::SetWatchingRecording
virtual void SetWatchingRecording(bool mode)
Definition: decoderbase.cpp:76
kState_WatchingPreRecorded
@ kState_WatchingPreRecorded
Watching Pre-recorded is a TV only state for when we are watching a pre-existing recording.
Definition: tv.h:67
DecoderBase::SetTranscoding
void SetTranscoding(bool value)
Definition: decoderbase.h:222
MythPlayer::SetFileLength
void SetFileLength(int total, int frames)
Definition: mythplayer.cpp:394
DecoderBase::GetFrame
virtual bool GetFrame(DecodeType Type, bool &Retry)=0
Demux, preprocess and possibly decode a frame of video/audio.
MythTimer::elapsed
int elapsed(void)
Returns milliseconds elapsed since last start() or restart()
Definition: mythtimer.cpp:90
MythPlayer::m_textDisplayMode
uint m_textDisplayMode
Definition: mythplayer.h:479
MythPlayer::SetDuration
void SetDuration(int duration)
Definition: mythplayer.cpp:400
MythPlayerAVSync::ResetAVSyncClockBase
void ResetAVSyncClockBase()
Definition: mythplayeravsync.cpp:40
MythPlayerAVSync::InitAVSync
void InitAVSync()
Definition: mythplayeravsync.cpp:17
kDecodeVideo
@ kDecodeVideo
Definition: decoderbase.h:50
MythPlayer::CreateDecoder
virtual void CreateDecoder(TestBufferVec &TestBuffer)
Definition: mythplayer.cpp:421
LiveTVChain::GetInputType
QString GetInputType(int pos=-1) const
Definition: livetvchain.cpp:696
MythVideoOutput::SetVideoFrameRate
virtual void SetVideoFrameRate(float playback_fps)
Definition: mythvideoout.cpp:167
MythPlayer::CalcMaxFFTime
virtual long long CalcMaxFFTime(long long ff, bool setjump=true) const
CalcMaxFFTime(ffframes): forward ffframes forward.
Definition: mythplayer.cpp:1455
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:370
livetvchain.h
ProgramInfo::QueryAutoExpire
AutoExpireType QueryAutoExpire(void) const
Returns "autoexpire" field from "recorded" table.
Definition: programinfo.cpp:3271
kVideoIsNull
@ kVideoIsNull
Definition: mythplayer.h:87
MythPlayer::SetKeyframeDistance
void SetKeyframeDistance(int keyframedistance)
Definition: mythplayer.cpp:329
MythMediaBuffer::IsBookmarkAllowed
virtual bool IsBookmarkAllowed(void)
Definition: mythmediabuffer.h:126
DecoderBase::UpdateFramesPlayed
virtual void UpdateFramesPlayed(void)
Definition: decoderbase.cpp:870
MythPlayer::m_textDesired
bool m_textDesired
Definition: mythplayer.h:494
MythPlayer::SetWatchingRecording
void SetWatchingRecording(bool mode)
Definition: mythplayer.cpp:126
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:68
MythPlayer::m_liveTV
bool m_liveTV
Definition: mythplayer.h:428
kEofStateImmediate
@ kEofStateImmediate
Definition: decoderbase.h:71
assert
#define assert(x)
Definition: audiooutputalsa.cpp:18
mythmiscutil.h
MythPlayer::IsReallyNearEnd
bool IsReallyNearEnd(void) const
Returns true iff really near end of recording.
Definition: mythplayer.cpp:1529
MythPlayer::IsWatchingInprogress
bool IsWatchingInprogress(void) const
Definition: mythplayer.cpp:133
MythPlayer::TracksChanged
void TracksChanged(uint trackType)
This tries to re-enable captions/subtitles if the user wants them and one of the captions/subtitles t...
Definition: mythplayer.cpp:682
MythPlayer::m_decoderThreadPause
QWaitCondition m_decoderThreadPause
Definition: mythplayer.h:401
mythcorecontext.h
MythPlayer::m_fileChanged
bool m_fileChanged
Definition: mythplayer.h:526
MythPlayer::SetFramesPlayed
void SetFramesPlayed(uint64_t played)
Definition: mythplayer.cpp:568
MythPlayer::FileChangedCallback
void FileChangedCallback()
Definition: mythplayer.cpp:959
MythPlayer::m_maxReferenceFrames
int m_maxReferenceFrames
Number of reference frames used in the video stream.
Definition: mythplayer.h:466
cardutil.h
MythPlayer::WaitForSeek
void WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted)
Definition: mythplayer.cpp:1622
MythPlayer::GetFreeVideoFrames
int GetFreeVideoFrames(void) const
Returns the number of frames available for decoding onto.
Definition: mythplayer.cpp:578
MythPlayer::m_errorType
int m_errorType
Definition: mythplayer.h:427
avformatdecoder.h
setpriority
#define setpriority(x, y, z)
Definition: compat.h:204
TC_AUDIO
@ TC_AUDIO
Definition: mythplayer.h:54
MythPlayer::m_disableCaptions
bool m_disableCaptions
Definition: mythplayer.h:496
MythPlayer::SetDisablePassThrough
void SetDisablePassThrough(bool disabled)
Definition: mythplayer.cpp:2036
MythPlayer::SetAllowForcedSubtitles
void SetAllowForcedSubtitles(bool allow)
Definition: mythplayer.cpp:707
MythPlayer::kInaccuracyEditor
static const double kInaccuracyEditor
Definition: mythplayer.h:269
MythPlayer::m_decodeOneFrame
bool m_decodeOneFrame
Definition: mythplayer.h:415
MythPlayer::SetPlaying
void SetPlaying(bool is_playing)
Definition: mythplayer.cpp:248
audiooutput.h
MythPlayer::m_transcoding
bool m_transcoding
Definition: mythplayer.h:430
ProgramInfo::IsVideo
bool IsVideo(void) const
Definition: programinfo.h:482
dummydecoder.h
mythavutil.h
MythPlayer::GetNextVideoFrame
MythVideoFrame * GetNextVideoFrame(void)
Removes a frame from the available queue for decoding onto.
Definition: mythplayer.cpp:602
RemoteEncoder::FillPositionMap
void FillPositionMap(int64_t start, int64_t end, frm_pos_map_t &positionMap)
Definition: remoteencoder.cpp:267
MythMediaBuffer::Start
void Start(void)
Starts the read-ahead thread.
Definition: mythmediabuffer.cpp:613
AvFormatDecoder::CanHandle
static bool CanHandle(TestBufferVec &testbuf, const QString &filename)
Perform an av_probe_input_format on the passed data to see if we can decode it with this class.
Definition: avformatdecoder.cpp:849
MythPlayer::SetFrameRate
void SetFrameRate(double fps)
Definition: mythplayer.cpp:387
MythPlayer::ResetTotalDuration
void ResetTotalDuration(void)
Definition: mythplayer.cpp:2006
MythPlayer::SetFrameInterval
void SetFrameInterval(FrameScanType scan, double frame_period)
Definition: mythplayer.cpp:713
MythPlayer::m_decoderSeek
int64_t m_decoderSeek
Definition: mythplayer.h:408
mthread.h
kAudioMuted
@ kAudioMuted
Definition: mythplayer.h:88
MythPlayer::IsPlaying
bool IsPlaying(uint wait_in_msec=0, bool wait_for=true) const
Definition: mythplayer.cpp:257
MThread::isRunning
bool isRunning(void) const
Definition: mthread.cpp:268
PlayerContext
Definition: playercontext.h:49
MythPlayer::m_isDummy
bool m_isDummy
Definition: mythplayer.h:535
MythPlayer::m_videoDim
QSize m_videoDim
Video (input) buffer width & height.
Definition: mythplayer.h:465
MythPlayer::m_vidExitLock
QMutex m_vidExitLock
Definition: mythplayer.h:423
remoteencoder.h
AudioPlayer::GetStretchFactor
float GetStretchFactor(void) const
Definition: audioplayer.h:66
audioplayer.h
DecoderBase::SetDisablePassThrough
virtual void SetDisablePassThrough(bool disable)
Disables AC3/DTS pass through.
Definition: decoderbase.h:145
mythtimer.h
MythPlayer::m_videoAspect
float m_videoAspect
Video (input) Apect Ratio.
Definition: mythplayer.h:467
AudioPlayer::Pause
bool Pause(bool pause)
Definition: audioplayer.cpp:178
MythPlayer::ForceSetupAudioStream
void ForceSetupAudioStream(void)
Definition: mythplayer.cpp:2042
MythPlayer::DecoderGetFrameFFREW
virtual bool DecoderGetFrameFFREW(void)
Definition: mythplayer.cpp:1184
mythcodeccontext.h
MythPlayer::kInaccuracyFull
static const double kInaccuracyFull
Definition: mythplayer.h:270
MythPlayer::JumpToFrame
virtual bool JumpToFrame(uint64_t frame)
Definition: mythplayer.cpp:910
MythPlayer::StopPlaying
virtual void StopPlaying(void)
Definition: mythplayer.cpp:965
MythPlayer::m_allPaused
bool m_allPaused
Definition: mythplayer.h:419
mythuiactions.h
MythPlayer::SaveTotalDuration
void SaveTotalDuration(void)
Definition: mythplayer.cpp:1998
MythPlayer::ReleaseNextVideoFrame
virtual void ReleaseNextVideoFrame(MythVideoFrame *buffer, int64_t timecode, bool wrap=true)
Places frame on the queue of frames ready for display.
Definition: mythplayer.cpp:612
DecoderBase::OpenFile
virtual int OpenFile(MythMediaBuffer *Buffer, bool novideo, TestBufferVec &testbuf)=0
MythPlayer::m_decoderChangeLock
QMutex m_decoderChangeLock
Definition: mythplayer.h:390
MythPlayer::IsInStillFrame
virtual bool IsInStillFrame() const
Definition: mythplayer.h:257
LiveTVChain::HasPrev
bool HasPrev(void) const
Definition: livetvchain.h:61
MythPlayer::GetXDS
QString GetXDS(const QString &key) const
Definition: mythplayer.cpp:1761
myth_nice
bool myth_nice(int val)
Definition: mythmiscutil.cpp:698
PRIO_PROCESS
#define PRIO_PROCESS
Definition: compat.h:203
MythMediaBuffer::Peek
int Peek(void *Buffer, int Count)
Definition: mythmediabuffer.cpp:1170
MythVideoFrame
Definition: mythframe.h:83
MythPlayer::OpenDummy
void OpenDummy(void)
Definition: mythplayer.cpp:405
MythPlayer::m_playing
bool m_playing
Definition: mythplayer.h:420
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:898
PlayerContext::m_recorder
RemoteEncoder * m_recorder
Definition: playercontext.h:113
DecoderBase::Reset
virtual void Reset(bool reset_video_data, bool seek_reset, bool reset_file)
Definition: decoderbase.cpp:42
MThread::wait
bool wait(unsigned long time=ULONG_MAX)
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:305
MythMediaBuffer::IsNearEnd
bool IsNearEnd(double Framerate, uint Frames) const
Definition: mythmediabuffer.cpp:408
DeleteMap::GetLastFrame
uint64_t GetLastFrame(void) const
Returns the number of the last frame in the video that is not in a cut sequence.
Definition: deletemap.cpp:855
MythVideoOutput::EnoughDecodedFrames
bool EnoughDecodedFrames()
Returns true iff there are plenty of decoded frames ready for display.
Definition: mythvideoout.cpp:332
LOC
#define LOC
Definition: mythplayer.cpp:64
MythPlayer::DecoderLoop
virtual void DecoderLoop(bool pause)
Definition: mythplayer.cpp:1119
DecoderBase::SetEofState
virtual void SetEofState(EofState eof)
Definition: decoderbase.h:131
MythPlayer::WrapTimecode
void WrapTimecode(int64_t &timecode, TCTypes tc_type)
Definition: mythplayer.cpp:1303
MythPlayer::m_disablePassthrough
bool m_disablePassthrough
Definition: mythplayer.h:543
DummyDecoder
Definition: dummydecoder.h:10
mythmainwindow.h
DecoderBase::SetLiveTVMode
void SetLiveTVMode(bool live)
Definition: decoderbase.h:139
FlagIsSet
#define FlagIsSet(arg)
Definition: mythplayer.h:93
MythMediaBuffer::IsSeekingAllowed
virtual bool IsSeekingAllowed(void)
Definition: mythmediabuffer.h:125
MythPlayer::m_reinitOsd
bool m_reinitOsd
Definition: mythplayer.h:506
MythPlayer::DoRewind
bool DoRewind(uint64_t frames, double inaccuracy)
Definition: mythplayer.cpp:1409
MythPlayer::kInaccuracyDefault
static const double kInaccuracyDefault
Definition: mythplayer.h:268
MythPlayer::FastForward
virtual bool FastForward(float seconds)
Definition: mythplayer.cpp:863
DecoderBase::GetFramesRead
long long GetFramesRead(void) const
Definition: decoderbase.h:202
MythMediaBuffer::Pause
void Pause(void)
Pauses the read-ahead thread.
Definition: mythmediabuffer.cpp:686
DecoderBase::DoRewind
virtual bool DoRewind(long long desiredFrame, bool discardFrames=true)
Definition: decoderbase.cpp:549
DeleteMap::IsEditing
bool IsEditing(void) const
Definition: deletemap.h:40
MythPlayer::DoGetFrame
bool DoGetFrame(DecodeType DecodeType)
Get one frame from the decoder.
Definition: mythplayer.cpp:1279
MythPlayer::Play
bool Play(float speed=1.0, bool normal=true, bool unpauseaudio=true)
Definition: mythplayer.cpp:192
MythPlayer::m_playingWaitCond
QWaitCondition m_playingWaitCond
Definition: mythplayer.h:422
DecoderBase
Definition: decoderbase.h:121
MythPlayer::m_killDecoder
bool volatile m_killDecoder
Definition: mythplayer.h:414
MythVideoOutput::DiscardFrame
virtual void DiscardFrame(MythVideoFrame *frame)
Releases frame from any queue onto the queue of frames ready for decoding onto.
Definition: mythvideoout.cpp:464
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:915
tv_play.h
MythPlayer::DecoderStart
virtual void DecoderStart(bool start_paused)
Definition: mythplayer.cpp:1037
DecoderBase::SaveTotalFrames
void SaveTotalFrames(void)
Definition: decoderbase.cpp:1243
MythPlayer::Rewind
virtual bool Rewind(float seconds)
Definition: mythplayer.cpp:888
MythPlayer::GetCurrentChapter
virtual int GetCurrentChapter(void)
Definition: mythplayer.cpp:1861
MythPlayer::DiscardVideoFrame
void DiscardVideoFrame(MythVideoFrame *buffer)
Places frame in the available frames queue.
Definition: mythplayer.cpp:632