MythTV  master
mythplayeravsync.h
Go to the documentation of this file.
1 #ifndef MYTHPLAYERAVSYNC_H
2 #define MYTHPLAYERAVSYNC_H
3 
4 // Qt
5 #include <QElapsedTimer>
6 
7 // MythTV
9 #include "libmythtv/mythframe.h"
10 
11 class AudioPlayer;
12 
14 {
18 };
19 
21 {
22  public:
24 
25  public:
26  void InitAVSync ();
27  std::chrono::microseconds AVSync (AudioPlayer* Audio, MythVideoFrame* Frame,
28  std::chrono::microseconds FrameInterval,
29  float PlaySpeed, bool HaveVideo, bool Force);
30  void WaitForFrame (std::chrono::microseconds FrameDue);
31  std::chrono::milliseconds& DisplayTimecode()
32  { return m_dispTimecode; }
34  { m_rtcBase = 0us; }
35  void GetAVSyncData (InfoMap& Map) const;
37  { return m_avsyncAudioPaused; }
39  { m_avsyncAudioPaused = Pause; }
40  void ResetAVSyncForLiveTV(AudioPlayer* Audio);
41  void SetAVSyncMusicChoice(AudioPlayer* Audio); // remove
42  void SetRefreshInterval(std::chrono::microseconds interval)
43  { m_refreshInterval = interval; }
44 
45  private:
46  QElapsedTimer m_avTimer;
48  int m_avsyncAvg { 0 };
49  std::chrono::milliseconds m_dispTimecode { 0ms };
50  std::chrono::microseconds m_rtcBase { 0us }; // real time clock base for presentation time
51  std::chrono::milliseconds m_maxTcVal { 0ms }; // maximum to date video tc
52  std::chrono::milliseconds m_priorAudioTimecode { 0ms }; // time code from prior frame
53  std::chrono::milliseconds m_priorVideoTimecode { 0ms }; // time code from prior frame
54  int m_maxTcFrames { 0 }; // number of frames seen since max to date tc
55  int m_numDroppedFrames { 0 }; // number of consecutive dropped frames.
56  float m_lastFix { 0.0F }; //last sync adjustment to prior frame]
57  std::chrono::microseconds m_refreshInterval { 0us };
58  std::chrono::microseconds m_shortFrameDeltas { 0us };
59 };
60 
61 #endif
MythPlayerAVSync::m_priorVideoTimecode
std::chrono::milliseconds m_priorVideoTimecode
Definition: mythplayeravsync.h:53
MythPlayerAVSync
Definition: mythplayeravsync.h:20
AudioPlayer
Definition: audioplayer.h:22
AVSyncAudioPausedType
AVSyncAudioPausedType
Definition: mythplayeravsync.h:13
Frame
Definition: zmdefines.h:93
MythPlayerAVSync::SetAVSyncAudioPause
void SetAVSyncAudioPause(AVSyncAudioPausedType Pause)
Definition: mythplayeravsync.h:38
MythPlayerAVSync::m_priorAudioTimecode
std::chrono::milliseconds m_priorAudioTimecode
Definition: mythplayeravsync.h:52
MythPlayerAVSync::GetAVSyncAudioPause
AVSyncAudioPausedType GetAVSyncAudioPause() const
Definition: mythplayeravsync.h:36
mythframe.h
kAVSyncAudioPausedLiveTV
@ kAVSyncAudioPausedLiveTV
Definition: mythplayeravsync.h:17
kAVSyncAudioPaused
@ kAVSyncAudioPaused
Definition: mythplayeravsync.h:16
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythPlayerAVSync::MythPlayerAVSync
MythPlayerAVSync()
Definition: mythplayeravsync.cpp:11
MythPlayerAVSync::m_numDroppedFrames
int m_numDroppedFrames
Definition: mythplayeravsync.h:55
MythPlayerAVSync::ResetAVSyncForLiveTV
void ResetAVSyncForLiveTV(AudioPlayer *Audio)
Definition: mythplayeravsync.cpp:36
mythtypes.h
MythPlayerAVSync::m_maxTcVal
std::chrono::milliseconds m_maxTcVal
Definition: mythplayeravsync.h:51
MythPlayerAVSync::m_rtcBase
std::chrono::microseconds m_rtcBase
Definition: mythplayeravsync.h:50
MythPlayerAVSync::SetAVSyncMusicChoice
void SetAVSyncMusicChoice(AudioPlayer *Audio)
Definition: mythplayeravsync.cpp:43
MythPlayerAVSync::WaitForFrame
void WaitForFrame(std::chrono::microseconds FrameDue)
Definition: mythplayeravsync.cpp:28
MythPlayerAVSync::GetAVSyncData
void GetAVSyncData(InfoMap &Map) const
Definition: mythplayeravsync.cpp:49
MythPlayerAVSync::SetRefreshInterval
void SetRefreshInterval(std::chrono::microseconds interval)
Definition: mythplayeravsync.h:42
MythPlayerAVSync::ResetAVSyncClockBase
void ResetAVSyncClockBase()
Definition: mythplayeravsync.h:33
MythPlayerAVSync::InitAVSync
void InitAVSync()
Definition: mythplayeravsync.cpp:17
MythPlayerAVSync::m_avsyncAvg
int m_avsyncAvg
Definition: mythplayeravsync.h:48
MythPlayerAVSync::DisplayTimecode
std::chrono::milliseconds & DisplayTimecode()
Definition: mythplayeravsync.h:31
MythPlayerAVSync::m_dispTimecode
std::chrono::milliseconds m_dispTimecode
Definition: mythplayeravsync.h:49
kAVSyncAudioNotPaused
@ kAVSyncAudioNotPaused
Definition: mythplayeravsync.h:15
MythPlayerAVSync::m_maxTcFrames
int m_maxTcFrames
Definition: mythplayeravsync.h:54
MythPlayerAVSync::m_shortFrameDeltas
std::chrono::microseconds m_shortFrameDeltas
Definition: mythplayeravsync.h:58
MythVideoFrame
Definition: mythframe.h:88
MythPlayerAVSync::AVSync
std::chrono::microseconds AVSync(AudioPlayer *Audio, MythVideoFrame *Frame, std::chrono::microseconds FrameInterval, float PlaySpeed, bool HaveVideo, bool Force)
Definition: mythplayeravsync.cpp:55
MythPlayerAVSync::m_refreshInterval
std::chrono::microseconds m_refreshInterval
Definition: mythplayeravsync.h:57
MythPlayerAVSync::m_avsyncAudioPaused
AVSyncAudioPausedType m_avsyncAudioPaused
Definition: mythplayeravsync.h:47
MythPlayerAVSync::m_lastFix
float m_lastFix
Definition: mythplayeravsync.h:56
MythPlayerAVSync::m_avTimer
QElapsedTimer m_avTimer
Definition: mythplayeravsync.h:46