MythTV  master
remoteencoder.h
Go to the documentation of this file.
1 #ifndef REMOTEENCODER_H_
2 #define REMOTEENCODER_H_
3 
4 #include <cstdint>
5 #include <utility>
6 
7 // Qt headers
8 #include <QHash>
9 #include <QMap>
10 #include <QMutex>
11 #include <QString>
12 
13 // MythTV headers
14 #include "mythtvexp.h"
15 #include "videoouttypes.h"
16 #include "tv.h"
17 #include "mythtypes.h"
18 #include "programtypes.h"
19 #include "mythtimer.h"
20 
21 class ProgramInfo;
22 class MythSocket;
23 
25 {
26  public:
27  RemoteEncoder(int num, QString host, short port)
28  : m_recordernum(num), m_remotehost(std::move(host)), m_remoteport(port) {}
29  ~RemoteEncoder(void);
30 
31  bool Setup(void);
32  bool IsValidRecorder(void) const;
33  int GetRecorderNumber(void) const;
34 
35  ProgramInfo *GetRecording(void);
36  bool IsRecording(bool *ok = nullptr);
37  float GetFrameRate(void);
38  long long GetFramesWritten(void);
40  long long GetCachedFramesWritten(void) const { return m_cachedFramesWritten; }
41  long long GetFilePosition(void);
42  long long GetFreeDiskSpace();
43  long long GetMaxBitrate();
44  int64_t GetKeyframePosition(uint64_t desired);
45  void FillPositionMap(int64_t start, int64_t end,
46  frm_pos_map_t &positionMap);
47  void FillDurationMap(int64_t start, int64_t end,
48  frm_pos_map_t &durationMap);
49  void StopPlaying(void);
50  void SpawnLiveTV(const QString& chainid, bool pip, const QString& startchan);
51  void StopLiveTV(void);
52  void PauseRecorder(void);
53  void FinishRecording(void);
54  void FrontendReady(void);
55  void CancelNextRecording(bool cancel);
56 
57  void SetLiveRecording(bool recording);
58  QString GetInput(void);
59  QString SetInput(const QString &input);
60  int GetPictureAttribute(PictureAttribute attr);
61  int ChangePictureAttribute(
62  PictureAdjustType type, PictureAttribute attr, bool up);
63  void ChangeChannel(int channeldirection);
64  void ChangeDeinterlacer(int deint_mode);
65  void ToggleChannelFavorite(const QString &changroupname);
66  void SetChannel(const QString& channel);
67  std::chrono::milliseconds SetSignalMonitoringRate(std::chrono::milliseconds rate, int notifyFrontend = 1);
68  uint GetSignalLockTimeout(const QString& input);
69  bool CheckChannel(const QString& channel);
70  bool ShouldSwitchToAnotherCard(const QString& channelid);
71  bool CheckChannelPrefix(const QString &prefix, uint &complete_valid_channel_on_rec,
72  bool &is_extra_char_useful, QString &needed_spacer);
73  void GetNextProgram(int direction,
74  QString &title, QString &subtitle, QString &desc,
75  QString &category, QString &starttime, QString &endtime,
76  QString &callsign, QString &iconpath,
77  QString &channelname, QString &chanid,
78  QString &seriesid, QString &programid);
79  void GetChannelInfo(InfoMap &infoMap, uint chanid = 0);
80  bool SetChannelInfo(const InfoMap &infoMap);
81  bool GetErrorStatus(void) { bool v = m_backendError; m_backendError = false;
82  return v; }
83 
84  private:
85  bool SendReceiveStringList(QStringList &strlist, uint min_reply_length = 0);
86 
88 
89  MythSocket *m_controlSock {nullptr};
90  QMutex m_lock;
91 
92  QString m_remotehost;
93  short m_remoteport;
94 
95  QString m_lastchannel;
96  QString m_lastinput;
97 
98  bool m_backendError {false};
99  long long m_cachedFramesWritten {0};
100  QMap<QString,uint> m_cachedTimeout;
102 };
103 
104 #endif
105 
RemoteEncoder::RemoteEncoder
RemoteEncoder(int num, QString host, short port)
Definition: remoteencoder.h:27
tv.h
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:13
PictureAdjustType
PictureAdjustType
Definition: tv.h:120
RemoteEncoder::GetErrorStatus
bool GetErrorStatus(void)
Definition: remoteencoder.h:81
mythtvexp.h
RemoteEncoder::m_cachedTimeout
QMap< QString, uint > m_cachedTimeout
Definition: remoteencoder.h:100
hardwareprofile.distros.mythtv_data.data_mythtv.prefix
string prefix
Definition: data_mythtv.py:40
RemoteEncoder
Definition: remoteencoder.h:24
programtypes.h
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythSocket
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:26
RemoteEncoder::GetCachedFramesWritten
long long GetCachedFramesWritten(void) const
Return value last returned by GetFramesWritten().
Definition: remoteencoder.h:40
videoouttypes.h
RemoteEncoder::m_lock
QMutex m_lock
Definition: remoteencoder.h:90
mythtypes.h
RemoteEncoder::m_remotehost
QString m_remotehost
Definition: remoteencoder.h:92
uint
unsigned int uint
Definition: compat.h:140
frm_pos_map_t
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
Definition: programtypes.h:46
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:103
RemoteEncoder::m_remoteport
short m_remoteport
Definition: remoteencoder.h:93
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
RemoteEncoder::m_lastchannel
QString m_lastchannel
Definition: remoteencoder.h:95
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
std
Definition: mythchrono.h:23
mythtimer.h
RemoteEncoder::m_lastinput
QString m_lastinput
Definition: remoteencoder.h:96
RemoteEncoder::m_lastTimeCheck
MythTimer m_lastTimeCheck
Definition: remoteencoder.h:101
RemoteEncoder::m_recordernum
int m_recordernum
Definition: remoteencoder.h:87