MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
mythplayer.h
Go to the documentation of this file.
1 #ifndef MYTHPLAYER_H
2 #define MYTHPLAYER_H
3 
4 #include <stdint.h>
5 
6 #include <sys/time.h>
7 
8 #include <QObject>
9 #include <QEvent>
10 
11 #include "playercontext.h"
12 #include "volumebase.h"
13 #include "ringbuffer.h"
14 #include "osd.h"
15 #include "jitterometer.h"
16 #include "videooutbase.h"
17 #include "teletextreader.h"
18 #include "subtitlereader.h"
19 #include "tv_play.h"
20 #include "yuv2rgb.h"
21 #include "cc608reader.h"
22 #include "cc608decoder.h"
23 #include "cc708reader.h"
24 #include "cc708decoder.h"
25 #include "cc708window.h"
26 #include "decoderbase.h"
27 #include "deletemap.h"
28 #include "commbreakmap.h"
29 #include "audioplayer.h"
30 
31 #include "mythtvexp.h"
32 
33 #include "filter.h"
34 
35 using namespace std;
36 
37 class VideoOutput;
38 class RemoteEncoder;
39 class MythSqlDatabase;
40 class ProgramInfo;
41 class DecoderBase;
42 class FilterManager;
43 class FilterChain;
44 class VideoSync;
45 class LiveTVChain;
46 class TV;
47 struct SwsContext;
48 class InteractiveTV;
49 class NSAutoreleasePool;
50 class DetectLetterbox;
51 class MythPlayer;
52 
53 typedef void (*StatusCallback)(int, void*);
54 
56 enum TCTypes
57 {
58  TC_VIDEO = 0,
62 };
63 #define TCTYPESMAX 4
64 
65 // Caption Display modes
66 enum
67 {
68  kDisplayNone = 0x000,
72  kDisplayCC608 = 0x008,
73  kDisplayCC708 = 0x010,
79 };
80 
82 {
83  kNoFlags = 0x000000,
84  kDecodeLowRes = 0x000001,
86  kDecodeFewBlocks = 0x000004,
87  kDecodeNoLoopFilter = 0x000008,
88  kDecodeNoDecode = 0x000010,
89  kDecodeDisallowCPU = 0x000020, // NB CPU always available by default
90  kDecodeAllowGPU = 0x000040, // VDPAU, VAAPI, DXVA2
91  kDecodeAllowEXT = 0x000080, // VDA, CrystalHD
92  kVideoIsNull = 0x000100,
93  kAudioMuted = 0x010000,
94 };
95 
96 #define FlagIsSet(arg) (playerFlags & arg)
97 
98 class DecoderThread : public MThread
99 {
100  public:
101  DecoderThread(MythPlayer *mp, bool start_paused)
102  : MThread("Decoder"), m_mp(mp), m_start_paused(start_paused) { }
103  ~DecoderThread() { wait(); }
104 
105  protected:
106  virtual void run(void);
107 
108  private:
111 };
112 
113 class MTV_PUBLIC MythPlayer
114 {
115  Q_DECLARE_TR_FUNCTIONS(MythPlayer)
116 
117  // Do NOT add a decoder class to this list
118  friend class PlayerContext;
119  friend class CC708Reader;
120  friend class CC608Reader;
121  friend class DecoderThread;
122  friend class DetectLetterbox;
123  friend class TeletextScreen;
124  friend class SubtitleScreen;
125  friend class InteractiveScreen;
126  friend class BDOverlayScreen;
127  friend class VideoPerformanceTest;
128  // TODO remove these
129  friend class TV;
130  friend class Transcode;
131 
132  public:
134  virtual ~MythPlayer();
135 
136  // Initialisation
137  virtual int OpenFile(uint retries = 4);
138  bool InitVideo(void);
139 
140  // Public Sets
141  void SetPlayerInfo(TV *tv, QWidget *widget, PlayerContext *ctx);
142  void SetLength(int len) { totalLength = len; }
143  void SetFramesPlayed(uint64_t played);
144  void SetVideoFilters(const QString &override);
145  void SetEof(EofState eof);
146  void SetPIPActive(bool is_active) { pip_active = is_active; }
147  void SetPIPVisible(bool is_visible) { pip_visible = is_visible; }
148 
149  void SetTranscoding(bool value);
150  void SetWatchingRecording(bool mode);
151  void SetWatched(bool forceWatched = false);
152  void SetKeyframeDistance(int keyframedistance);
153  void SetVideoParams(int w, int h, double fps,
155  void SetFileLength(int total, int frames);
156  void SetDuration(int duration);
157  void SetVideoResize(const QRect &videoRect);
158  void EnableFrameRateMonitor(bool enable = false);
159  void ForceDeinterlacer(const QString &override = QString());
160 
161  // Gets
162  QSize GetVideoBufferSize(void) const { return video_dim; }
163  QSize GetVideoSize(void) const { return video_disp_dim; }
164  float GetVideoAspect(void) const { return video_aspect; }
165  float GetFrameRate(void) const { return video_frame_rate; }
166  void GetPlaybackData(InfoMap &infoMap);
167  bool IsAudioNeeded(void)
168  { return !(FlagIsSet(kVideoIsNull)) && player_ctx->IsAudioNeeded(); }
169  uint GetVolume(void) { return audio.GetVolume(); }
170  int GetSecondsBehind(void) const;
171  int GetFreeVideoFrames(void) const;
172  AspectOverrideMode GetAspectOverride(void) const;
173  AdjustFillMode GetAdjustFill(void) const;
174  MuteState GetMuteState(void) { return audio.GetMuteState(); }
175 
176  int GetFFRewSkip(void) const { return ffrew_skip; }
177  float GetPlaySpeed(void) const { return play_speed; }
178  AudioPlayer* GetAudio(void) { return &audio; }
179  float GetAudioStretchFactor(void) { return audio.GetStretchFactor(); }
180  float GetNextPlaySpeed(void) const { return next_play_speed; }
181  int GetLength(void) const { return totalLength; }
182  uint64_t GetTotalFrameCount(void) const { return totalFrames; }
183  uint64_t GetCurrentFrameCount(void) const;
184  uint64_t GetFramesPlayed(void) const { return framesPlayed; }
185  virtual int64_t GetSecondsPlayed(bool honorCutList);
186  virtual int64_t GetTotalSeconds(void) const;
187  virtual uint64_t GetBookmark(void);
188  QString GetError(void) const;
189  bool IsErrorRecoverable(void) const
190  { return (errorType & kError_Switch_Renderer); }
191  bool IsDecoderErrored(void) const
192  { return (errorType & kError_Decode); }
193  QString GetEncodingType(void) const;
194  void GetCodecDescription(InfoMap &infoMap);
195  QString GetXDS(const QString &key) const;
196  PIPLocation GetNextPIPLocation(void) const;
197 
198  // Bool Gets
199  bool IsPaused(void) const { return allpaused; }
200  bool GetRawAudioState(void) const;
201  bool GetLimitKeyRepeat(void) const { return limitKeyRepeat; }
202  EofState GetEof(void) const;
203  bool IsErrored(void) const;
204  bool IsPlaying(uint wait_ms = 0, bool wait_for = true) const;
205  bool AtNormalSpeed(void) const { return next_normal_speed; }
206  bool IsReallyNearEnd(void) const;
207  bool IsNearEnd(void);
208  bool HasAudioOut(void) const { return audio.HasAudioOut(); }
209  bool IsPIPActive(void) const { return pip_active; }
210  bool IsPIPVisible(void) const { return pip_visible; }
211  bool IsMuted(void) { return audio.IsMuted(); }
212  bool PlayerControlsVolume(void) const { return audio.ControlsVolume(); }
213  bool UsingNullVideo(void) const { return FlagIsSet(kVideoIsNull); }
214  bool HasTVChainNext(void) const;
215  bool CanSupportDoubleRate(void);
216  bool GetScreenShot(int width = 0, int height = 0, QString filename = "");
217  bool IsWatchingInprogress(void) const;
218 
219  // Non-const gets
220  virtual char *GetScreenGrabAtFrame(uint64_t frameNum, bool absolute,
221  int &buflen, int &vw, int &vh, float &ar);
222  virtual char *GetScreenGrab(int secondsin, int &buflen,
223  int &vw, int &vh, float &ar);
224  InteractiveTV *GetInteractiveTV(void);
225 
226  // Title stuff
227  virtual bool SwitchTitle(int title) { return false; }
228  virtual bool NextTitle(void) { return false; }
229  virtual bool PrevTitle(void) { return false; }
230 
231  // Angle stuff
232  virtual bool SwitchAngle(int title) { return false; }
233  virtual bool NextAngle(void) { return false; }
234  virtual bool PrevAngle(void) { return false; }
235 
236  // Transcode stuff
237  void InitForTranscode(bool copyaudio, bool copyvideo);
238  bool TranscodeGetNextFrame(frm_dir_map_t::iterator &dm_iter,
239  int &did_ff, bool &is_key, bool honorCutList);
240  bool WriteStoredData(
241  RingBuffer *outRingBuffer, bool writevideo, long timecodeOffset);
242  long UpdateStoredFrameNum(long curFrameNum);
243  void SetCutList(const frm_dir_map_t &newCutList);
244 
245  // Decoder stuff..
246  VideoFrame *GetNextVideoFrame(void);
247  VideoFrame *GetRawVideoFrame(long long frameNumber = -1);
248  VideoFrame *GetCurrentFrame(int &w, int &h);
249  void DeLimboFrame(VideoFrame *frame);
250  virtual void ReleaseNextVideoFrame(VideoFrame *buffer, int64_t timecode,
251  bool wrap = true);
252  void ReleaseCurrentFrame(VideoFrame *frame);
253  void ClearDummyVideoFrame(VideoFrame *frame);
254  void DiscardVideoFrame(VideoFrame *buffer);
255  void DiscardVideoFrames(bool next_frame_keyframe);
256  void DrawSlice(VideoFrame *frame, int x, int y, int w, int h);
258  DecoderBase *GetDecoder(void) { return decoder; }
259  void *GetDecoderContext(unsigned char* buf, uint8_t*& id);
260  virtual bool HasReachedEof(void) const;
261 
262  // Preview Image stuff
263  void SaveScreenshot(void);
264 
265  // Reinit
266  void ReinitVideo(void);
267 
268  // Add data
269  virtual bool PrepareAudioSample(int64_t &timecode);
270 
271  // Public Closed caption and teletext stuff
272  uint GetCaptionMode(void) const { return textDisplayMode; }
273  virtual CC708Reader *GetCC708Reader(uint id=0) { return &cc708; }
274  virtual CC608Reader *GetCC608Reader(uint id=0) { return &cc608; }
275  virtual SubtitleReader *GetSubReader(uint id=0) { return &subReader; }
276  virtual TeletextReader *GetTeletextReader(uint id=0) { return &ttxReader; }
277 
278  // Public Audio/Subtitle/EIA-608/EIA-708 stream selection - thread safe
279  void TracksChanged(uint trackType);
280  void EnableSubtitles(bool enable);
281  void EnableForcedSubtitles(bool enable);
282  bool ForcedSubtitlesFavored(void) const {
283  return allowForcedSubtitles && !captionsEnabledbyDefault;
284  }
285  // How to handle forced Subtitles (i.e. when in a movie someone speaks
286  // in a different language than the rest of the movie, subtitles are
287  // forced on even if the user doesn't have them turned on.)
288  // These two functions are not thread-safe (UI thread use only).
289  void SetAllowForcedSubtitles(bool allow);
290  bool GetAllowForcedSubtitles(void) const { return allowForcedSubtitles; }
291 
292  // Public MHEG/MHI stream selection
293  bool SetAudioByComponentTag(int tag);
294  bool SetVideoByComponentTag(int tag);
295  bool SetStream(const QString &);
296  long GetStreamPos(); // mS
297  long GetStreamMaxPos(); // mS
298  long SetStreamPos(long); // mS
299  void StreamPlay(bool play = true);
300 
301  // LiveTV public stuff
302  void CheckTVChain();
303  void FileChangedCallback();
304 
305  // Chapter public stuff
306  virtual int GetNumChapters(void);
307  virtual int GetCurrentChapter(void);
308  virtual void GetChapterTimes(QList<long long> &times);
309 
310  // Title public stuff
311  virtual int GetNumTitles(void) const { return 0; }
312  virtual int GetCurrentTitle(void) const { return 0; }
313  virtual int GetTitleDuration(int title) const { return 0; }
314  virtual QString GetTitleName(int title) const { return QString(); }
315 
316  // Angle public stuff
317  virtual int GetNumAngles(void) const { return 0; }
318  virtual int GetCurrentAngle(void) const { return 0; }
319  virtual QString GetAngleName(int title) const { return QString(); }
320 
321  // DVD public stuff
322  virtual bool GoToMenu(QString str) { return false; }
323  virtual void GoToDVDProgram(bool direction) { (void) direction; }
324 
325  // Position Map Stuff
326  bool PosMapFromEnc(uint64_t start,
327  frm_pos_map_t &posMap,
328  frm_pos_map_t &durMap);
329 
330  // OSD locking for TV class
331  bool TryLockOSD(void) { return osdLock.tryLock(50); }
332  void LockOSD(void) { osdLock.lock(); }
333  void UnlockOSD(void) { osdLock.unlock(); }
334 
335  // Public picture controls
336  void ToggleStudioLevels(void);
337  void ToggleNightMode(void);
338 
339  // Visualisations
340  bool CanVisualise(void);
341  bool IsVisualising(void);
342  QString GetVisualiserName(void);
343  QStringList GetVisualiserList(void);
344  bool EnableVisualisation(bool enable, const QString &name = QString(""));
345 
346  void SaveTotalDuration(void);
347  void ResetTotalDuration(void);
348 
351  static const double kInaccuracyNone;
352  static const double kInaccuracyDefault;
353  static const double kInaccuracyEditor;
354  static const double kInaccuracyFull;
355 
356  void SaveTotalFrames(void);
357 
358  protected:
359  // Initialization
360  void OpenDummy(void);
361 
362  // Non-public sets
363  virtual void SetBookmark(bool clear = false);
364  bool AddPIPPlayer(MythPlayer *pip, PIPLocation loc, uint timeout);
365  bool RemovePIPPlayer(MythPlayer *pip, uint timeout);
366  void NextScanType(void)
367  { SetScanType((FrameScanType)(((int)m_scan + 1) & 0x3)); }
368  void SetScanType(FrameScanType);
369  FrameScanType GetScanType(void) const { return m_scan; }
370  bool IsScanTypeLocked(void) const { return m_scan_locked; }
371  void Zoom(ZoomDirection direction);
372 
373  // Windowing stuff
374  void EmbedInWidget(QRect rect);
375  void StopEmbedding(void);
376  void ExposeEvent(void);
377  bool IsEmbedding(void);
378  void WindowResized(const QSize &new_size);
379 
380  // Audio Sets
381  uint AdjustVolume(int change) { return audio.AdjustVolume(change); }
382  uint SetVolume(int newvolume) { return audio.SetVolume(newvolume); }
383  bool SetMuted(bool mute) { return audio.SetMuted(mute); }
384  MuteState SetMuteState(MuteState state) { return audio.SetMuteState(state); }
385  MuteState IncrMuteState(void) { return audio.IncrMuteState(); }
386 
387  // Non-const gets
388  VideoOutput *GetVideoOutput(void) { return videoOutput; }
389  OSD *GetOSD(void) { return osd; }
390  virtual void SeekForScreenGrab(uint64_t &number, uint64_t frameNum,
391  bool absolute);
392 
393  // Complicated gets
394  virtual long long CalcMaxFFTime(long long ff, bool setjump = true) const;
395  long long CalcRWTime(long long rw) const;
396  virtual void calcSliderPos(osdInfo &info, bool paddedFields = false);
397  uint64_t TranslatePositionFrameToMs(uint64_t position,
398  bool use_cutlist) const;
399  uint64_t TranslatePositionMsToFrame(uint64_t position,
400  bool use_cutlist) const {
401  return deleteMap.TranslatePositionMsToFrame(position,
402  GetFrameRate(),
403  use_cutlist);
404  }
405  // TranslatePositionAbsToRel and TranslatePositionRelToAbs are
406  // used for frame calculations when seeking relative to a number
407  // of frames rather than by time.
408  uint64_t TranslatePositionAbsToRel(uint64_t position) const {
409  return deleteMap.TranslatePositionAbsToRel(position);
410  }
411  uint64_t TranslatePositionRelToAbs(uint64_t position) const {
412  return deleteMap.TranslatePositionRelToAbs(position);
413  }
414  float ComputeSecs(uint64_t position, bool use_cutlist) const {
415  return TranslatePositionFrameToMs(position, use_cutlist) / 1000.0;
416  }
417  uint64_t FindFrame(float offset, bool use_cutlist) const;
418 
419  // Commercial stuff
420  void SetAutoCommercialSkip(CommSkipMode autoskip)
421  { commBreakMap.SetAutoCommercialSkip(autoskip, framesPlayed); }
422  void SkipCommercials(int direction)
423  { commBreakMap.SkipCommercials(direction); }
424  void SetCommBreakMap(frm_dir_map_t &newMap);
425  CommSkipMode GetAutoCommercialSkip(void)
426  { return commBreakMap.GetAutoCommercialSkip(); }
427 
428  // Toggle Sets
429  void ToggleAspectOverride(AspectOverrideMode aspectMode = kAspect_Toggle);
430  void ToggleAdjustFill(AdjustFillMode adjustfillMode = kAdjustFill_Toggle);
431 
432  // Start/Reset/Stop playing
433  virtual bool StartPlaying(void);
434  virtual void ResetPlaying(bool resetframes = true);
435  virtual void EndPlaying(void) { }
436  virtual void StopPlaying(void);
437 
438  // Pause stuff
439  bool PauseDecoder(void);
440  void UnpauseDecoder(void);
441  bool Pause(void);
442  bool Play(float speed = 1.0, bool normal = true, bool unpauseaudio = true);
443 
444  // Seek stuff
445  virtual bool FastForward(float seconds);
446  virtual bool Rewind(float seconds);
447  virtual bool JumpToFrame(uint64_t frame);
448 
449  // Chapter stuff
450  void JumpChapter(int chapter);
451 
452  // Playback
453  virtual bool PrebufferEnoughFrames(int min_buffers = 0);
454  void SetBuffering(bool new_buffering);
455  void RefreshPauseFrame(void);
456  void CheckAspectRatio(VideoFrame* frame);
457  virtual void DisplayPauseFrame(void);
458  virtual void DisplayNormalFrame(bool check_prebuffer = true);
459  virtual void PreProcessNormalFrame(void);
460  virtual void VideoStart(void);
461  virtual bool VideoLoop(void);
462  virtual void VideoEnd(void);
463  virtual void DecoderStart(bool start_paused);
464  virtual void DecoderLoop(bool pause);
465  virtual void DecoderEnd(void);
466  virtual void DecoderPauseCheck(void);
467  virtual void AudioEnd(void);
468  virtual void EventStart(void);
469  virtual void EventLoop(void);
470  virtual void InitialSeek(void);
471 
472  // Protected MHEG/MHI stuff
473  bool ITVHandleAction(const QString &action);
474  void ITVRestart(uint chanid, uint cardid, bool isLiveTV);
475 
476  // Edit mode stuff
477  bool EnableEdit(void);
478  bool HandleProgramEditorActions(QStringList &actions);
479  bool GetEditMode(void) const { return deleteMap.IsEditing(); }
480  void DisableEdit(int howToSave);
481  bool IsInDelete(uint64_t frame);
482  uint64_t GetNearestMark(uint64_t frame, bool right);
483  bool IsTemporaryMark(uint64_t frame);
484  bool HasTemporaryMark(void);
485  bool IsCutListSaved(void) { return deleteMap.IsSaved(); }
486  bool DeleteMapHasUndo(void) { return deleteMap.HasUndo(); }
487  bool DeleteMapHasRedo(void) { return deleteMap.HasRedo(); }
488  QString DeleteMapGetUndoMessage(void) { return deleteMap.GetUndoMessage(); }
489  QString DeleteMapGetRedoMessage(void) { return deleteMap.GetRedoMessage(); }
490 
491  // Reinit
492  void ReinitOSD(void);
493 
494  // OSD conveniences
495  void SetOSDMessage(const QString &msg, OSDTimeout timeout);
496  void SetOSDStatus(const QString &title, OSDTimeout timeout);
497 
498  // Closed caption and teletext stuff
499  void ResetCaptions(void);
500  bool ToggleCaptions(void);
501  bool ToggleCaptions(uint mode);
502  bool HasTextSubtitles(void) { return subReader.HasTextSubtitles(); }
503  void SetCaptionsEnabled(bool, bool osd_msg=true);
504  bool GetCaptionsEnabled(void);
505  virtual void DisableCaptions(uint mode, bool osd_msg=true);
506  virtual void EnableCaptions(uint mode, bool osd_msg=true);
507 
508  // Audio/Subtitle/EIA-608/EIA-708 stream selection
509  QStringList GetTracks(uint type);
510  uint GetTrackCount(uint type);
511  virtual int SetTrack(uint type, int trackNo);
512  int GetTrack(uint type);
513  int ChangeTrack(uint type, int dir);
514  void ChangeCaptionTrack(int dir);
515  bool HasCaptionTrack(int mode);
516  int NextCaptionTrack(int mode);
517  void DoDisableForcedSubtitles(void);
518  void DoEnableForcedSubtitles(void);
519 
520  // Teletext Menu and non-NUV teletext decoder
521  void EnableTeletext(int page = 0x100);
522  void DisableTeletext(void);
523  void ResetTeletext(void);
524  bool HandleTeletextAction(const QString &action);
525 
526  // Teletext NUV Captions
527  void SetTeletextPage(uint page);
528 
529  // Time Code adjustment stuff
530  int64_t AdjustAudioTimecodeOffset(int64_t v, int newsync = -9999);
531  int64_t GetAudioTimecodeOffset(void) const
532  { return tc_wrap[TC_AUDIO]; }
533 
534  // Playback (output) zoom automation
536 
537  protected:
538  // Private initialization stuff
539  void InitFilters(void);
540  FrameScanType detectInterlace(FrameScanType newScan, FrameScanType scan,
541  float fps, int video_height);
542  virtual void AutoDeint(VideoFrame* frame, bool allow_lock = true);
543 
544  // Private Sets
545  void SetPlayingInfo(const ProgramInfo &pginfo);
546  void SetPlaying(bool is_playing);
547  void SetErrored(const QString &reason) const;
548 
549  // Private Gets
550  int GetStatusbarPos(void) const;
551 
552  // Private pausing stuff
553  void PauseVideo(void);
554  void UnpauseVideo(void);
555  void PauseBuffer(void);
556  void UnpauseBuffer(void);
557 
558  // Private decoder stuff
559  virtual void CreateDecoder(char *testbuf, int testreadsize);
560  void SetDecoder(DecoderBase *dec);
562  const DecoderBase *GetDecoder(void) const { return decoder; }
563  bool DecodeFrame(struct rtframeheader *frameheader,
564  unsigned char *strm, unsigned char *outbuf);
565 
566  virtual bool DecoderGetFrameFFREW(void);
567  virtual bool DecoderGetFrameREW(void);
568  bool DecoderGetFrame(DecodeType, bool unsafe = false);
569 
570  // These actually execute commands requested by public members
571  bool UpdateFFRewSkip(void);
572  virtual void ChangeSpeed(void);
573  // The "inaccuracy" argument is generally one of the kInaccuracy* values.
574  bool DoFastForward(uint64_t frames, double inaccuracy);
575  bool DoRewind(uint64_t frames, double inaccuracy);
576  bool DoFastForwardSecs(float secs, double inaccuracy, bool use_cutlist);
577  bool DoRewindSecs(float secs, double inaccuracy, bool use_cutlist);
578  void DoJumpToFrame(uint64_t frame, double inaccuracy);
579 
580  // Private seeking stuff
581  void WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted);
582  void ClearAfterSeek(bool clearvideobuffers = true);
583 
584  // Private chapter stuff
585  virtual bool DoJumpChapter(int chapter);
586  virtual int64_t GetChapter(int chapter);
587 
588  // Private edit stuff
589  void HandleArbSeek(bool right);
590 
591  // Private A/V Sync Stuff
592  void WrapTimecode(int64_t &timecode, TCTypes tc_type);
593  void InitAVSync(void);
594  virtual void AVSync(VideoFrame *buffer, bool limit_delay = false);
595  void ResetAVSync(void);
596  int64_t AVSyncGetAudiotime(void);
597  void SetFrameInterval(FrameScanType scan, double speed);
598  void FallbackDeint(void);
599  void CheckExtraAudioDecode(void);
600 
601  // Private LiveTV stuff
602  void SwitchToProgram(void);
603  void JumpToProgram(void);
604  void JumpToStream(const QString&);
605 
606  protected:
609  mutable QMutex decoder_change_lock;
613  QThread *playerThread;
614 
615  // Window stuff
616  QWidget *parentWidget;
617  bool embedding;
618  QRect embedRect;
620 
621  // State
622  QWaitCondition decoderThreadPause;
623  QWaitCondition decoderThreadUnpause;
624  mutable QMutex decoderPauseLock;
625  mutable QMutex decoderSeekLock;
631  bool volatile killdecoder;
632  int64_t decoderSeek;
635  mutable QMutex bufferPauseLock;
636  mutable QMutex videoPauseLock;
637  mutable QMutex pauseLock;
640  bool allpaused;
641  bool playing;
642 
643  mutable QWaitCondition playingWaitCond;
644  mutable QMutex vidExitLock;
645  mutable QMutex playingLock;
649  bool livetv;
653  mutable bool limitKeyRepeat;
654  mutable QMutex errorLock;
655  mutable QString errorMsg;
656  mutable int errorType;
657 
658  // Chapter stuff
660 
661  // Bookmark stuff
662  uint64_t bookmarkseek;
665 
666  // Seek
669  long long fftime;
670 
671  // Playback misc.
674  uint64_t framesPlayed;
675  uint64_t totalFrames;
676  long long totalLength;
677  int64_t totalDuration;
678  long long rewindtime;
679 
680  // -- end state stuff --
681 
682  // Input Video Attributes
684  QSize video_dim;
686  float video_aspect;
700 
701  // Buffering
702  bool buffering;
705 
706  // General Caption/Teletext/Subtitle support
710 
711  // Support for analog captions and teletext
712  // (i.e. Vertical Blanking Interval (VBI) encoded data.)
714  int ttPageNum;
715 
716  // Support for captions, teletext, etc. decoded by libav
728 
729  // CC608/708
732 
733  // Support for MHEG/MHI
737  QMutex itvLock;
738  QString m_newStream; // Guarded by itvLock
739 
740  // OSD stuff
743  QMutex osdLock;
744 
745  // Audio stuff
747 
748  // Picture-in-Picture
750  volatile bool pip_active;
751  volatile bool pip_visible;
753 
754  // Filters
762 
763  // Commercial filtering
766  // Manual editing
771 
772  // Playback (output) speed control
774  QMutex decoder_lock;
777 
778  float play_speed;
782 
785 
786  // Audio and video synchronization stuff
794  bool lastsync;
797  int64_t disp_timecode;
799 
800  // Time Code stuff
801  int prevtc;
802  int prevrp;
803  int64_t tc_wrap[TCTYPESMAX];
804  int64_t tc_lastval[TCTYPESMAX];
805 
806  // LiveTV
808  bool isDummy;
809 
810  // Debugging variables
812 
813  private:
814  void syncWithAudioStretch();
815 };
816 
817 #endif
818 
819 /* vim: set expandtab tabstop=4 shiftwidth=4: */