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