MythTV  master
remoteencoder.cpp
Go to the documentation of this file.
1 #include <unistd.h>
2 
3 #include <QStringList>
4 
5 #include "remoteencoder.h"
6 #include "programinfo.h"
7 #include "mythdate.h"
8 #include "mythcorecontext.h"
9 #include "signalmonitor.h"
10 #include "mythdb.h"
11 #include "mythsocket.h"
12 #include "mythlogging.h"
13 
14 #define LOC QString("RemoteEncoder(%1): ").arg(m_recordernum)
15 
16 #define MAX_SIZE_CHECK 500 // in ms
17 
19 {
20  if (m_controlSock)
21  {
23  m_controlSock = nullptr;
24  }
25 }
26 
28 {
29  if (!m_controlSock)
30  {
31  LOG(VB_NETWORK, LOG_DEBUG, "RemoteEncoder::Setup(): Connecting...");
32 
33  QString ann = QString("ANN Playback %1 %2")
34  .arg(gCoreContext->GetHostName()).arg(static_cast<int>(false));
35 
38 
39  if (m_controlSock)
40  {
41  LOG(VB_NETWORK, LOG_DEBUG, "RemoteEncoder::Setup(): Connected");
42  }
43  else
44  {
45  LOG(VB_GENERAL, LOG_ERR,
46  "RemoteEncoder::Setup(): Failed to connect to backend");
47  }
48  }
49  else
50  {
51  LOG(VB_NETWORK, LOG_DEBUG, "RemoteEncoder::Setup(): Already connected");
52  }
53  return m_controlSock;
54 }
55 
57 {
58  return (m_recordernum >= 0);
59 }
60 
62 {
63  return m_recordernum;
64 }
65 
67  QStringList &strlist, uint min_reply_length)
68 {
69  QMutexLocker locker(&m_lock);
70  if (!m_controlSock)
71  Setup();
72 
73  m_backendError = false;
74 
75  if (!m_controlSock)
76  {
77  LOG(VB_GENERAL, LOG_ERR, "RemoteEncoder::SendReceiveStringList(): "
78  "Failed to reconnect with backend.");
79  m_backendError = true;
80  return false;
81  }
82 
83  if (!m_controlSock->WriteStringList(strlist))
84  {
85  LOG(VB_GENERAL, LOG_ERR, "RemoteEncoder::SendReceiveStringList(): "
86  "Failed to write data.");
87  m_backendError = true;
88  }
89 
90  if (!m_backendError &&
92  {
93  LOG(VB_GENERAL, LOG_ERR,
94  "RemoteEncoder::SendReceiveStringList(): No response.");
95  m_backendError = true;
96  }
97 
98  if (!m_backendError &&
99  min_reply_length && ((uint)strlist.size() < min_reply_length))
100  {
101  LOG(VB_GENERAL, LOG_ERR,
102  "RemoteEncoder::SendReceiveStringList(): Response too short");
103  m_backendError = true;
104  }
105 
106  if (m_backendError)
107  {
109  m_controlSock = nullptr;
110  return false;
111  }
112 
113  return true;
114 }
115 
117 {
118  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
119  strlist << "IS_RECORDING";
120 
121  bool ret = SendReceiveStringList(strlist, 1);
122  if (!ret)
123  {
124  if (ok)
125  *ok = false;
126 
127  return false;
128  }
129 
130  if (ok)
131  *ok = true;
132 
133  return strlist[0].toInt() != 0;
134 }
135 
137 {
138  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
139  strlist << "GET_RECORDING";
140 
141  if (SendReceiveStringList(strlist))
142  {
143  auto *proginfo = new ProgramInfo(strlist);
144  if (proginfo->GetChanID())
145  return proginfo;
146  delete proginfo;
147  }
148 
149  return nullptr;
150 }
151 
159 {
160  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
161  strlist << "GET_FRAMERATE";
162 
163  bool ok = false;
164  float retval = 30.0F;
165 
166  if (SendReceiveStringList(strlist, 1))
167  {
168  retval = strlist[0].toFloat(&ok);
169 
170  if (!ok)
171  {
172  LOG(VB_GENERAL, LOG_ERR, LOC +
173  QString("GetFrameRate() failed to parse response '%1'")
174  .arg(strlist[0]));
175  }
176  }
177  else
178  {
179  LOG(VB_GENERAL, LOG_ERR, LOC +
180  "GetFrameRate(): SendReceiveStringList() failed");
181  }
182 
183  return (ok) ? retval : 30.0F;
184 }
185 
194 {
196  {
197  return m_cachedFramesWritten;
198  }
199 
200  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
201  strlist << "GET_FRAMES_WRITTEN";
202 
203  if (!SendReceiveStringList(strlist, 1))
204  {
205  LOG(VB_GENERAL, LOG_ERR, LOC + "GetFramesWritten() -- network error");
206  }
207  else
208  {
209  m_cachedFramesWritten = strlist[0].toLongLong();
211  }
212 
213  return m_cachedFramesWritten;
214 }
215 
223 {
224  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
225  strlist << "GET_FILE_POSITION";
226 
227  if (SendReceiveStringList(strlist, 1))
228  return strlist[0].toLongLong();
229 
230  return -1;
231 }
232 
238 {
239  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
240  strlist << "GET_MAX_BITRATE";
241 
242  if (SendReceiveStringList(strlist, 1))
243  return strlist[0].toLongLong();
244 
245  return 20200000LL; // Peek bit rate for HD-PVR
246 }
247 
255 int64_t RemoteEncoder::GetKeyframePosition(uint64_t desired)
256 {
257  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
258  strlist << "GET_KEYFRAME_POS";
259  strlist << QString::number(desired);
260 
261  if (SendReceiveStringList(strlist, 1))
262  return strlist[0].toLongLong();
263 
264  return -1;
265 }
266 
267 void RemoteEncoder::FillPositionMap(int64_t start, int64_t end,
268  frm_pos_map_t &positionMap)
269 {
270  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
271  strlist << "FILL_POSITION_MAP";
272  strlist << QString::number(start);
273  strlist << QString::number(end);
274 
275  if (!SendReceiveStringList(strlist))
276  return;
277 
278  for (auto it = strlist.cbegin(); it != strlist.cend(); ++it)
279  {
280  bool ok = false;
281  uint64_t index = (*it).toLongLong(&ok);
282  if (++it == strlist.cend() || !ok)
283  break;
284 
285  uint64_t pos = (*it).toLongLong(&ok);
286  if (!ok)
287  break;
288 
289  positionMap[index] = pos;
290  }
291 }
292 
293 void RemoteEncoder::FillDurationMap(int64_t start, int64_t end,
294  frm_pos_map_t &durationMap)
295 {
296  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
297  strlist << "FILL_DURATION_MAP";
298  strlist << QString::number(start);
299  strlist << QString::number(end);
300 
301  if (!SendReceiveStringList(strlist))
302  return;
303 
304  for (auto it = strlist.cbegin(); it != strlist.cend(); ++it)
305  {
306  bool ok = false;
307  uint64_t index = (*it).toLongLong(&ok);
308  if (++it == strlist.cend() || !ok)
309  break;
310 
311  uint64_t pos = (*it).toLongLong(&ok);
312  if (!ok)
313  break;
314 
315  durationMap[index] = pos;
316  }
317 }
318 
320 {
321  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
322  strlist << "CANCEL_NEXT_RECORDING";
323  strlist << QString::number((cancel) ? 1 : 0);
324 
325  SendReceiveStringList(strlist);
326 }
327 
329 {
330  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
331  strlist << "FRONTEND_READY";
332 
333  SendReceiveStringList(strlist);
334 }
335 
341 {
342  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
343  strlist << "STOP_PLAYING";
344 
345  SendReceiveStringList(strlist);
346 }
347 
353 void RemoteEncoder::SpawnLiveTV(const QString& chainId, bool pip, const QString& startchan)
354 {
355  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
356  strlist << "SPAWN_LIVETV";
357  strlist << chainId;
358  strlist << QString::number((int)pip);
359  strlist << startchan;
360 
361  SendReceiveStringList(strlist);
362 }
363 
370 {
371  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
372  strlist << "STOP_LIVETV";
373 
374  SendReceiveStringList(strlist);
375 }
376 
383 {
384  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
385  strlist << "PAUSE";
386 
387  if (SendReceiveStringList(strlist))
388  m_lastinput = "";
389 }
390 
392 {
393  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
394  strlist << "FINISH_RECORDING";
395 
396  SendReceiveStringList(strlist);
397 }
398 
400 {
401  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
402  strlist << "SET_LIVE_RECORDING";
403  strlist << QString::number(static_cast<int>(recording));
404 
405  SendReceiveStringList(strlist);
406 }
407 
409 {
410  if (!m_lastinput.isEmpty())
411  return m_lastinput;
412 
413  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
414  strlist << "GET_INPUT";
415 
416  if (SendReceiveStringList(strlist, 1))
417  {
418  m_lastinput = strlist[0];
419  return m_lastinput;
420  }
421 
422  return "Error";
423 }
424 
425 QString RemoteEncoder::SetInput(const QString& input)
426 {
427  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
428  strlist << "SET_INPUT";
429  strlist << input;
430 
431  if (SendReceiveStringList(strlist, 1))
432  {
433  m_lastchannel = "";
434  m_lastinput = "";
435  return strlist[0];
436  }
437 
438  return (m_lastinput.isEmpty()) ? "Error" : m_lastinput;
439 }
440 
441 void RemoteEncoder::ToggleChannelFavorite(const QString& changroupname)
442 {
443  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
444  strlist << "TOGGLE_CHANNEL_FAVORITE";
445  strlist << changroupname;
446 
447  SendReceiveStringList(strlist);
448 }
449 
450 void RemoteEncoder::ChangeChannel(int channeldirection)
451 {
452  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
453  strlist << "CHANGE_CHANNEL";
454  strlist << QString::number(channeldirection);
455 
456  if (!SendReceiveStringList(strlist))
457  return;
458 
459  m_lastchannel = "";
460  m_lastinput = "";
461 }
462 
463 void RemoteEncoder::SetChannel(const QString& channel)
464 {
465  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
466  strlist << "SET_CHANNEL";
467  strlist << channel;
468 
469  if (!SendReceiveStringList(strlist))
470  return;
471 
472  m_lastchannel = "";
473  m_lastinput = "";
474 }
475 
492 int RemoteEncoder::SetSignalMonitoringRate(int rate, bool notifyFrontend)
493 {
494  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
495  strlist << "SET_SIGNAL_MONITORING_RATE";
496  strlist << QString::number(rate);
497  strlist << QString::number((int)notifyFrontend);
498 
499  if (SendReceiveStringList(strlist, 1))
500  return strlist[0].toInt();
501 
502  return 0;
503 }
504 
506 {
507  QMutexLocker locker(&m_lock);
508 
509  QMap<QString,uint>::const_iterator it = m_cachedTimeout.constFind(input);
510  if (it != m_cachedTimeout.constEnd())
511  return *it;
512 
513  uint cardid = m_recordernum;
514  uint timeout = 0xffffffff;
516  query.prepare(
517  "SELECT channel_timeout, cardtype "
518  "FROM capturecard "
519  "WHERE capturecard.inputname = :INNAME AND "
520  " capturecard.cardid = :CARDID");
521  query.bindValue(":INNAME", input);
522  query.bindValue(":CARDID", cardid);
523  if (!query.exec() || !query.isActive())
524  MythDB::DBError("Getting timeout", query);
525  else if (query.next() &&
526  SignalMonitor::IsRequired(query.value(1).toString()))
527  timeout = std::max(query.value(0).toInt(), 500);
528 
529 #if 0
530  LOG(VB_PLAYBACK, LOG_DEBUG, "RemoteEncoder: " +
531  QString("GetSignalLockTimeout(%1): Set lock timeout to %2 ms")
532  .arg(cardid).arg(timeout));
533 #endif
534  m_cachedTimeout[input] = timeout;
535  return timeout;
536 }
537 
538 
540 {
541  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
542 
543  if (kPictureAttribute_Contrast == attr)
544  strlist << "GET_CONTRAST";
545  else if (kPictureAttribute_Brightness == attr)
546  strlist << "GET_BRIGHTNESS";
547  else if (kPictureAttribute_Colour == attr)
548  strlist << "GET_COLOUR";
549  else if (kPictureAttribute_Hue == attr)
550  strlist << "GET_HUE";
551  else
552  return -1;
553 
554  if (SendReceiveStringList(strlist, 1))
555  return strlist[0].toInt();
556 
557  return -1;
558 }
559 
568  PictureAdjustType type, PictureAttribute attr, bool up)
569 {
570  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
571 
572  if (kPictureAttribute_Contrast == attr)
573  strlist << "CHANGE_CONTRAST";
574  else if (kPictureAttribute_Brightness == attr)
575  strlist << "CHANGE_BRIGHTNESS";
576  else if (kPictureAttribute_Colour == attr)
577  strlist << "CHANGE_COLOUR";
578  else if (kPictureAttribute_Hue == attr)
579  strlist << "CHANGE_HUE";
580  else
581  return -1;
582 
583  strlist << QString::number(type);
584  strlist << QString::number((int)up);
585 
586  if (SendReceiveStringList(strlist, 1))
587  return strlist[0].toInt();
588 
589  return -1;
590 }
591 
593 {
594  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
595  strlist << "CHANGE_DEINTERLACER";
596  strlist << QString::number(deint_mode);
597 
598  SendReceiveStringList(strlist);
599 }
600 
611 {
612  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
613  strlist << "CHECK_CHANNEL";
614  strlist << channel;
615 
616  if (SendReceiveStringList(strlist, 1))
617  return strlist[0].toInt() != 0;
618 
619  return false;
620 }
621 
631 bool RemoteEncoder::ShouldSwitchToAnotherCard(const QString& channelid)
632 {
633  // this function returns true if the channelid is not a valid
634  // channel on the current recorder. It queries to server in order
635  // to determine this.
636  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
637  strlist << "SHOULD_SWITCH_CARD";
638  strlist << channelid;
639 
640  if (SendReceiveStringList(strlist, 1))
641  return strlist[0].toInt() != 0;
642 
643  return false;
644 }
645 
653  const QString &prefix,
654  uint &complete_valid_channel_on_rec,
655  bool &is_extra_char_useful,
656  QString &needed_spacer)
657 {
658  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
659  strlist << "CHECK_CHANNEL_PREFIX";
660  strlist << prefix;
661 
662  if (!SendReceiveStringList(strlist, 4))
663  return false;
664 
665  complete_valid_channel_on_rec = strlist[1].toInt();
666  is_extra_char_useful = (strlist[2].toInt() != 0);
667  needed_spacer = (strlist[3] == "X") ? "" : strlist[3];
668 
669  return strlist[0].toInt() != 0;
670 }
671 
672 static QString cleanup(const QString &str)
673 {
674  if (str == " ")
675  return "";
676  return str;
677 }
678 
679 static QString make_safe(const QString &str)
680 {
681  if (str.isEmpty())
682  return " ";
683  return str;
684 }
685 
692 void RemoteEncoder::GetNextProgram(int direction,
693  QString &title, QString &subtitle,
694  QString &desc, QString &category,
695  QString &starttime, QString &endtime,
696  QString &callsign, QString &iconpath,
697  QString &channelname, QString &chanid,
698  QString &seriesid, QString &programid)
699 {
700  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum) );
701  strlist << "GET_NEXT_PROGRAM_INFO";
702  strlist << channelname;
703  strlist << chanid;
704  strlist << QString::number(direction);
705  strlist << starttime;
706 
707  if (!SendReceiveStringList(strlist, 12))
708  return;
709 
710  title = cleanup(strlist[0]);
711  subtitle = cleanup(strlist[1]);
712  desc = cleanup(strlist[2]);
713  category = cleanup(strlist[3]);
714  starttime = cleanup(strlist[4]);
715  endtime = cleanup(strlist[5]);
716  callsign = cleanup(strlist[6]);
717  iconpath = cleanup(strlist[7]);
718  channelname = cleanup(strlist[8]);
719  chanid = cleanup(strlist[9]);
720  seriesid = cleanup(strlist[10]);
721  programid = cleanup(strlist[11]);
722 }
723 
725 {
726  QStringList strlist( QString("QUERY_RECORDER %1").arg(m_recordernum));
727  strlist << "GET_CHANNEL_INFO";
728  strlist << QString::number(chanid);
729 
730  if (!SendReceiveStringList(strlist, 6))
731  return;
732 
733  infoMap["chanid"] = cleanup(strlist[0]);
734  infoMap["sourceid"] = cleanup(strlist[1]);
735  infoMap["callsign"] = cleanup(strlist[2]);
736  infoMap["channum"] = cleanup(strlist[3]);
737  infoMap["channame"] = cleanup(strlist[4]);
738  infoMap["XMLTV"] = cleanup(strlist[5]);
739 
740  infoMap["oldchannum"] = infoMap["channum"];
741 }
742 
744 {
745  QStringList strlist( "SET_CHANNEL_INFO" );
746  strlist << make_safe(infoMap["chanid"]);
747  strlist << make_safe(infoMap["sourceid"]);
748  strlist << make_safe(infoMap["oldchannum"]);
749  strlist << make_safe(infoMap["callsign"]);
750  strlist << make_safe(infoMap["channum"]);
751  strlist << make_safe(infoMap["channame"]);
752  strlist << make_safe(infoMap["XMLTV"]);
753 
754  if (SendReceiveStringList(strlist, 1))
755  return strlist[0].toInt() != 0;
756 
757  return false;
758 }
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:204
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:783
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:126
RemoteEncoder::FinishRecording
void FinishRecording(void)
Definition: remoteencoder.cpp:391
channel
QDomElement channel
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:501
RemoteEncoder::SetChannelInfo
bool SetChannelInfo(const InfoMap &infoMap)
Definition: remoteencoder.cpp:743
hardwareprofile.smolt.timeout
float timeout
Definition: smolt.py:103
RemoteEncoder::GetRecording
ProgramInfo * GetRecording(void)
Definition: remoteencoder.cpp:136
RemoteEncoder::GetRecorderNumber
int GetRecorderNumber(void) const
Definition: remoteencoder.cpp:61
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
mythdb.h
RemoteEncoder::ToggleChannelFavorite
void ToggleChannelFavorite(const QString &changroupname)
Definition: remoteencoder.cpp:441
PictureAdjustType
PictureAdjustType
Definition: tv.h:121
RemoteEncoder::FillDurationMap
void FillDurationMap(int64_t start, int64_t end, frm_pos_map_t &durationMap)
Definition: remoteencoder.cpp:293
title
QString title
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:636
RemoteEncoder::FrontendReady
void FrontendReady(void)
Definition: remoteencoder.cpp:328
RemoteEncoder::m_controlSock
MythSocket * m_controlSock
Definition: remoteencoder.h:90
MAX_SIZE_CHECK
#define MAX_SIZE_CHECK
Definition: remoteencoder.cpp:16
RemoteEncoder::CancelNextRecording
void CancelNextRecording(bool cancel)
Definition: remoteencoder.cpp:319
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:198
arg
arg(title).arg(filename).arg(doDelete))
MythTimer::isRunning
bool isRunning(void) const
Returns true if start() or restart() has been called at least once since construction and since any c...
Definition: mythtimer.cpp:134
kPictureAttribute_Contrast
@ kPictureAttribute_Contrast
Definition: videoouttypes.h:108
signalmonitor.h
RemoteEncoder::GetNextProgram
void GetNextProgram(int direction, QString &title, QString &subtitle, QString &desc, QString &category, QString &starttime, QString &endtime, QString &callsign, QString &iconpath, QString &channelname, QString &chanid, QString &seriesid, QString &programid)
Returns information about the program that would be seen if we changed the channel using ChangeChanne...
Definition: remoteencoder.cpp:692
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
category
QString category
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1422
RemoteEncoder::GetFramesWritten
long long GetFramesWritten(void)
Returns number of frames written to disk by TVRec's RecorderBase instance.
Definition: remoteencoder.cpp:193
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
RemoteEncoder::m_cachedTimeout
QMap< QString, uint > m_cachedTimeout
Definition: remoteencoder.h:101
RemoteEncoder::IsValidRecorder
bool IsValidRecorder(void) const
Definition: remoteencoder.cpp:56
RemoteEncoder::ChangePictureAttribute
int ChangePictureAttribute(PictureAdjustType type, PictureAttribute attr, bool up)
Changes brightness/contrast/colour/hue of a recording.
Definition: remoteencoder.cpp:567
RemoteEncoder::SetSignalMonitoringRate
int SetSignalMonitoringRate(int rate, bool notifyFrontend=true)
Sets the signal monitoring rate.
Definition: remoteencoder.cpp:492
RemoteEncoder::m_backendError
bool m_backendError
Definition: remoteencoder.h:99
RemoteEncoder::ShouldSwitchToAnotherCard
bool ShouldSwitchToAnotherCard(const QString &channelid)
Checks if named channel exists on current tuner, or another tuner.
Definition: remoteencoder.cpp:631
hardwareprofile.distros.mythtv_data.data_mythtv.prefix
string prefix
Definition: data_mythtv.py:40
RemoteEncoder::Setup
bool Setup(void)
Definition: remoteencoder.cpp:27
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
SignalMonitor::IsRequired
static bool IsRequired(const QString &cardtype)
Returns true iff the card type supports signal monitoring.
Definition: signalmonitor.h:311
RemoteEncoder::IsRecording
bool IsRecording(bool *ok=nullptr)
Definition: remoteencoder.cpp:116
mythdate.h
programinfo.h
mythlogging.h
RemoteEncoder::GetMaxBitrate
long long GetMaxBitrate()
Returns the maximum bits per second this recorder can produce.
Definition: remoteencoder.cpp:237
MythSocket::WriteStringList
bool WriteStringList(const QStringList &list)
Definition: mythsocket.cpp:317
MythSocket::kShortTimeout
static const uint kShortTimeout
Definition: mythsocket.h:71
RemoteEncoder::GetFrameRate
float GetFrameRate(void)
Returns recordering frame rate set by nvr.
Definition: remoteencoder.cpp:158
RemoteEncoder::SpawnLiveTV
void SpawnLiveTV(const QString &chainid, bool pip, const QString &startchan)
Tells TVRec to Spawn a "Live TV" recorder.
Definition: remoteencoder.cpp:353
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
RemoteEncoder::GetInput
QString GetInput(void)
Definition: remoteencoder.cpp:408
RemoteEncoder::m_lock
QMutex m_lock
Definition: remoteencoder.h:91
RemoteEncoder::SendReceiveStringList
bool SendReceiveStringList(QStringList &strlist, uint min_reply_length=0)
Definition: remoteencoder.cpp:66
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:178
RemoteEncoder::ChangeChannel
void ChangeChannel(int channeldirection)
Definition: remoteencoder.cpp:450
RemoteEncoder::SetLiveRecording
void SetLiveRecording(bool recording)
Definition: remoteencoder.cpp:399
RemoteEncoder::m_cachedFramesWritten
long long m_cachedFramesWritten
Definition: remoteencoder.h:100
RemoteEncoder::GetSignalLockTimeout
uint GetSignalLockTimeout(const QString &input)
Definition: remoteencoder.cpp:505
kPictureAttribute_Brightness
@ kPictureAttribute_Brightness
Definition: videoouttypes.h:107
RemoteEncoder::m_remotehost
QString m_remotehost
Definition: remoteencoder.h:93
uint
unsigned int uint
Definition: compat.h:141
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
cleanup
static QString cleanup(const QString &str)
Definition: remoteencoder.cpp:672
RemoteEncoder::CheckChannelPrefix
bool CheckChannelPrefix(const QString &prefix, uint &complete_valid_channel_on_rec, bool &is_extra_char_useful, QString &needed_spacer)
Checks a prefix against the channels in the DB.
Definition: remoteencoder.cpp:652
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:104
RemoteEncoder::m_remoteport
short m_remoteport
Definition: remoteencoder.h:94
LOC
#define LOC
Definition: remoteencoder.cpp:14
MythTimer::elapsed
int elapsed(void)
Returns milliseconds elapsed since last start() or restart()
Definition: mythtimer.cpp:90
RemoteEncoder::m_lastchannel
QString m_lastchannel
Definition: remoteencoder.h:96
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:68
MythCoreContext::ConnectCommandSocket
MythSocket * ConnectCommandSocket(const QString &hostname, int port, const QString &announcement, bool *proto_mismatch=nullptr, int maxConnTry=-1, int setup_timeout=-1)
Definition: mythcorecontext.cpp:448
RemoteEncoder::SetChannel
void SetChannel(const QString &channel)
Definition: remoteencoder.cpp:463
mythcorecontext.h
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:864
RemoteEncoder::StopLiveTV
void StopLiveTV(void)
Tells TVRec to stop a "Live TV" recorder.
Definition: remoteencoder.cpp:369
RemoteEncoder::GetChannelInfo
void GetChannelInfo(InfoMap &infoMap, uint chanid=0)
Definition: remoteencoder.cpp:724
RemoteEncoder::FillPositionMap
void FillPositionMap(int64_t start, int64_t end, frm_pos_map_t &positionMap)
Definition: remoteencoder.cpp:267
make_safe
static QString make_safe(const QString &str)
Definition: remoteencoder.cpp:679
remoteencoder.h
RemoteEncoder::SetInput
QString SetInput(const QString &input)
Definition: remoteencoder.cpp:425
RemoteEncoder::CheckChannel
bool CheckChannel(const QString &channel)
Checks if named channel exists on current tuner.
Definition: remoteencoder.cpp:610
RemoteEncoder::GetFilePosition
long long GetFilePosition(void)
Returns total number of bytes written by TVRec's RingBuffer.
Definition: remoteencoder.cpp:222
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:859
RemoteEncoder::GetPictureAttribute
int GetPictureAttribute(PictureAttribute attr)
Definition: remoteencoder.cpp:539
RemoteEncoder::m_lastinput
QString m_lastinput
Definition: remoteencoder.h:97
RemoteEncoder::m_lastTimeCheck
MythTimer m_lastTimeCheck
Definition: remoteencoder.h:102
MythSocket::ReadStringList
bool ReadStringList(QStringList &list, uint timeoutMS=kShortTimeout)
Definition: mythsocket.cpp:329
RemoteEncoder::PauseRecorder
void PauseRecorder(void)
Tells TVRec to pause a recorder, used for channel and input changes.
Definition: remoteencoder.cpp:382
mythsocket.h
query
MSqlQuery query(MSqlQuery::InitCon())
kPictureAttribute_Hue
@ kPictureAttribute_Hue
Definition: videoouttypes.h:110
RemoteEncoder::ChangeDeinterlacer
void ChangeDeinterlacer(int deint_mode)
Definition: remoteencoder.cpp:592
MythTimer::restart
int restart(void)
Returns milliseconds elapsed since last start() or restart() and resets the count.
Definition: mythtimer.cpp:62
RemoteEncoder::GetKeyframePosition
int64_t GetKeyframePosition(uint64_t desired)
Returns byte position in RingBuffer of a keyframe.
Definition: remoteencoder.cpp:255
RemoteEncoder::StopPlaying
void StopPlaying(void)
Tells TVRec to stop streaming a recording to the frontend.
Definition: remoteencoder.cpp:340
RemoteEncoder::~RemoteEncoder
~RemoteEncoder(void)
Definition: remoteencoder.cpp:18
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:808
kPictureAttribute_Colour
@ kPictureAttribute_Colour
Definition: videoouttypes.h:109
RemoteEncoder::m_recordernum
int m_recordernum
Definition: remoteencoder.h:88