MythTV  master
videosource.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 // Standard UNIX C headers
4 #include <unistd.h>
5 #include <fcntl.h>
6 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(_WIN32)
7 #include <sys/types.h>
8 #else
9 #include <sys/sysmacros.h>
10 #endif
11 #include <sys/stat.h>
12 
13 // C++ headers
14 #include <algorithm>
15 using namespace std;
16 
17 // Qt headers
18 #include <QCoreApplication>
19 #include <QCursor>
20 #include <QDateTime>
21 #include <QDir>
22 #include <QFile>
23 #include <QLayout>
24 #include <QMap>
25 #include <QStringList>
26 #include <QTextStream>
27 #include <utility>
28 
29 // MythTV headers
30 #include "mythconfig.h"
31 #include "mythcorecontext.h"
32 #include "videosource.h"
33 #include "scanwizard.h"
34 #include "cardutil.h"
35 #include "sourceutil.h"
36 #include "channelinfo.h"
37 #include "channelutil.h"
38 #include "frequencies.h"
39 #include "diseqcsettings.h"
40 #include "firewiredevice.h"
41 #include "compat.h"
42 #include "mythdb.h"
43 #include "mythdirs.h"
44 #include "mythlogging.h"
45 #include "libmythupnp/httprequest.h" // for TestMimeType()
46 #include "mythsystemlegacy.h"
47 #include "exitcodes.h"
48 #include "v4l2util.h"
49 #include "mythnotification.h"
50 #include "mythterminal.h"
51 
52 #ifdef USING_DVB
53 #include "dvbtypes.h"
54 #endif
55 
56 #ifdef USING_VBOX
57 #include "vboxutils.h"
58 #endif
59 
60 #ifdef USING_HDHOMERUN
61 #include HDHOMERUN_HEADERFILE
62 #endif
63 
65  QString _card_types,
66  bool _must_have_mplexid) :
67  m_initialSourceId(_initial_sourceid),
68  m_cardTypes(std::move(_card_types)),
69  m_mustHaveMplexId(_must_have_mplexid)
70 {
71  setLabel(tr("Video Source"));
73  QObject::tr(
74  "Select a video source that is connected to one "
75  "or more capture cards. Default is the video source "
76  "selected in the Channel Editor page."
77  ));
78 }
79 
81 {
83 
84  QString querystr =
85  "SELECT DISTINCT videosource.name, videosource.sourceid "
86  "FROM capturecard, videosource";
87 
88  querystr += (m_mustHaveMplexId) ? ", channel " : " ";
89 
90  querystr +=
91  "WHERE capturecard.sourceid = videosource.sourceid AND "
92  " capturecard.hostname = :HOSTNAME ";
93 
94  if (!m_cardTypes.isEmpty())
95  {
96  querystr += QString(" AND capturecard.cardtype in %1 ")
97  .arg(m_cardTypes);
98  }
99 
100  if (m_mustHaveMplexId)
101  {
102  querystr +=
103  " AND channel.sourceid = videosource.sourceid "
104  " AND channel.mplexid != 32767 "
105  " AND channel.mplexid != 0 ";
106  }
107 
108  query.prepare(querystr);
109  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
110 
111  if (!query.exec() || !query.isActive() || query.size() <= 0)
112  return;
113 
114  uint sel = 0;
115  uint cnt = 0;
116  for (; query.next(); cnt++)
117  {
118  addSelection(query.value(0).toString(),
119  query.value(1).toString());
120 
121  sel = (query.value(1).toUInt() == m_initialSourceId) ? cnt : sel;
122  }
123 
124  if (m_initialSourceId)
125  {
126  if (cnt)
127  setValue(sel);
128  }
129 
131 }
132 
134  m_initialSourceId(_initial_sourceid)
135 {
136  setLabel(tr("Video Source"));
137  setHelpText(
138  QObject::tr(
139  "The video source that is "
140  "selected in the Channel Editor page."
141  ));
142 }
143 
145 {
147 
148  QString querystr =
149  "SELECT DISTINCT videosource.name, videosource.sourceid "
150  "FROM capturecard, videosource "
151  "WHERE capturecard.sourceid = videosource.sourceid AND "
152  " capturecard.hostname = :HOSTNAME AND "
153  " videosource.sourceid = :SOURCEID ";
154 
155  query.prepare(querystr);
156  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
157  query.bindValue(":SOURCEID", m_initialSourceId);
158 
159  if (!query.exec() || !query.isActive())
160  {
161  MythDB::DBError("VideoSourceShow::Load", query);
162  return;
163  }
164 
165  if (query.next())
166  {
167  setValue(query.value(0).toString());
168  }
169 }
170 
172 {
173  public:
174  explicit InstanceCount(const CardInput &parent) :
175  MythUISpinBoxSetting(new CardInputDBStorage(this, parent, "reclimit"),
176  1, 10, 1)
177  {
178  setLabel(QObject::tr("Max recordings"));
179  setValue(1);
180  setHelpText(
181  QObject::tr(
182  "Maximum number of simultaneous recordings MythTV will "
183  "attempt using this device. If set to a value other than "
184  "1, MythTV can sometimes record multiple programs on "
185  "the same multiplex or overlapping copies of the same "
186  "program on a single channel."
187  ));
188  };
189 };
190 
192 {
193  public:
194  explicit SchedGroup(const CardInput &parent) :
195  MythUICheckBoxSetting(new CardInputDBStorage(this, parent, "schedgroup"))
196  {
197  setLabel(QObject::tr("Schedule as group"));
198  setValue(true);
199  setHelpText(
200  QObject::tr(
201  "Schedule all virtual inputs on this device as a group. "
202  "This is more efficient than scheduling each input "
203  "individually. Additional, virtual inputs will be "
204  "automatically added as needed to fulfill the recording "
205  "load."
206  ));
207  };
208 };
209 
211 {
212  QString sourceidTag(":WHERESOURCEID");
213 
214  QString query("sourceid = " + sourceidTag);
215 
216  bindings.insert(sourceidTag, m_parent.getSourceID());
217 
218  return query;
219 }
220 
222 {
223  QString sourceidTag(":SETSOURCEID");
224  QString colTag(":SET" + GetColumnName().toUpper());
225 
226  QString query("sourceid = " + sourceidTag + ", " +
227  GetColumnName() + " = " + colTag);
228 
229  bindings.insert(sourceidTag, m_parent.getSourceID());
230  bindings.insert(colTag, m_user->GetDBValue());
231 
232  return query;
233 }
234 
236 {
237  QString cardidTag(":WHERECARDID");
238 
239  QString query("cardid = " + cardidTag);
240 
241  bindings.insert(cardidTag, m_parent.getCardID());
242 
243  return query;
244 }
245 
247 {
248  QString cardidTag(":SETCARDID");
249  QString colTag(":SET" + GetColumnName().toUpper());
250 
251  QString query("cardid = " + cardidTag + ", " +
252  GetColumnName() + " = " + colTag);
253 
254  bindings.insert(cardidTag, m_parent.getCardID());
255  bindings.insert(colTag, m_user->GetDBValue());
256 
257  return query;
258 }
259 
261 {
262  public:
263  explicit XMLTVGrabber(const VideoSource &parent) :
265  "xmltvgrabber")),
266  m_parent(parent)
267  {
268  setLabel(QObject::tr("Listings grabber"));
269  };
270 
271  void Load(void) override // StandardSetting
272  {
273  addTargetedChild("eitonly", new EITOnly_config(m_parent, this));
274  addTargetedChild("/bin/true", new NoGrabber_config(m_parent));
275 
276  addSelection(
277  QObject::tr("Transmitted guide only (EIT)"), "eitonly");
278 
279  addSelection(QObject::tr("No grabber"), "/bin/true");
280 
281  QString gname;
282  QString d1;
283  QString d2;
284  QString d3;
286 
287 #ifdef _MSC_VER
288 #pragma message( "tv_find_grabbers is not supported yet on windows." )
289  //-=>TODO:Screen doesn't show up if the call to MythSysemLegacy is executed
290 #else
291 
292  QString loc = "XMLTVGrabber::Load: ";
293  QString loc_err = "XMLTVGrabber::Load, Error: ";
294 
295  QStringList name_list;
296  QStringList prog_list;
297 
298  QStringList args;
299  args += "baseline";
300 
301  MythSystemLegacy find_grabber_proc("tv_find_grabbers", args,
303  find_grabber_proc.Run(25);
304  LOG(VB_GENERAL, LOG_INFO,
305  loc + "Running 'tv_find_grabbers " + args.join(" ") + "'.");
306  uint status = find_grabber_proc.Wait();
307 
308  if (status == GENERIC_EXIT_OK)
309  {
310  QTextStream ostream(find_grabber_proc.ReadAll());
311  while (!ostream.atEnd())
312  {
313  QString grabber_list(ostream.readLine());
314 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
315  QStringList grabber_split =
316  grabber_list.split("|", QString::SkipEmptyParts);
317 #else
318  QStringList grabber_split =
319  grabber_list.split("|", Qt::SkipEmptyParts);
320 #endif
321  QString grabber_name = grabber_split[1] + " (xmltv)";
322  QFileInfo grabber_file(grabber_split[0]);
323 
324  name_list.push_back(grabber_name);
325  prog_list.push_back(grabber_file.fileName());
326  LOG(VB_GENERAL, LOG_DEBUG, "Found " + grabber_split[0]);
327  }
328  LOG(VB_GENERAL, LOG_INFO, loc + "Finished running tv_find_grabbers");
329  }
330  else
331  LOG(VB_GENERAL, LOG_ERR, loc + "Failed to run tv_find_grabbers");
332 
333  LoadXMLTVGrabbers(name_list, prog_list);
334 
336 #endif
337  }
338 
339  void Save(void) override // StandardSetting
340  {
342 
344  query.prepare(
345  "UPDATE videosource "
346  "SET userid=NULL, password=NULL "
347  "WHERE xmltvgrabber NOT IN ( 'technovera' )");
348  if (!query.exec())
349  MythDB::DBError("XMLTVGrabber::Save", query);
350  }
351 
352  void LoadXMLTVGrabbers(QStringList name_list, QStringList prog_list)
353  {
354  if (name_list.size() != prog_list.size())
355  return;
356 
357  QString selValue = getValue();
358  int selIndex = getValueIndex(selValue);
359  setValue(0);
360 
361  for (uint i = 0; i < (uint) name_list.size(); i++)
362  {
363  addTargetedChild(prog_list[i],
364  new XMLTV_generic_config(m_parent, prog_list[i],
365  this));
366  addSelection(name_list[i], prog_list[i]);
367  }
368 
369  if (!selValue.isEmpty())
370  selIndex = getValueIndex(selValue);
371  if (selIndex >= 0)
372  setValue(selIndex);
373  }
374 private:
376 };
377 
379 {
380  public:
382  uint min_val, uint max_val, uint step,
383  const QString &setting) :
384  MythUISpinBoxSetting(new CaptureCardDBStorage(this, parent, setting),
385  min_val, max_val, step)
386  {
387  }
388 };
389 
391 {
392  public:
394  const QString &setting) :
395  MythUITextEditSetting(new CaptureCardDBStorage(this, parent, setting))
396  {
397  }
398 };
399 
401 {
402  public:
403  explicit ScanFrequency(const VideoSource &parent) :
404  MythUITextEditSetting(new VideoSourceDBStorage(this, parent, "scanfrequency"))
405  {
406  setLabel(QObject::tr("Scan Frequency"));
407  setHelpText(QObject::tr("The frequency to start scanning this video source. "
408  "This is then default for 'Full Scan (Tuned)' channel scanning. "
409  "Frequency value in Hz for DVB-T/T2/C, in kHz for DVB-S/S2. "
410  "Leave at 0 if not known. "));
411  };
412 };
413 
415 {
416  public:
417  DVBNetID(const VideoSource &parent, signed int value, signed int min_val) :
418  MythUISpinBoxSetting(new VideoSourceDBStorage(this, parent, "dvb_nit_id"),
419  min_val, 0xffff, 1)
420  {
421  setLabel(QObject::tr("Network ID"));
422  //: Network_ID is the name of an identifier in the DVB's Service
423  //: Information standard specification.
424  setHelpText(QObject::tr("If your provider has asked you to configure a "
425  "specific network identifier (Network_ID), "
426  "enter it here. Leave it at -1 otherwise."));
427  setValue(value);
428  };
429 };
430 
432 {
433  public:
434  BouquetID(const VideoSource &parent, signed int value, signed int min_val) :
435  MythUISpinBoxSetting(new VideoSourceDBStorage(this, parent, "bouquet_id"),
436  min_val, 0xffff, 1)
437  {
438  setLabel(QObject::tr("Bouquet ID"));
439  setHelpText(QObject::tr("Bouquet ID for Freesat or Sky on satellite Astra-2 28.2E. "
440  "Leave this at 0 if you do not receive this satellite. "
441  "This is needed to get the Freesat and Sky channel numbers. "
442  "Value 272 selects Freesat bouquet 'England HD'. "
443  "See the MythTV Wiki https://www.mythtv.org/wiki/DVB_UK."));
444  setValue(value);
445  };
446 };
447 
449 {
450  public:
451  RegionID(const VideoSource &parent, signed int value, signed int min_val) :
452  MythUISpinBoxSetting(new VideoSourceDBStorage(this, parent, "region_id"),
453  min_val, 100, 1)
454  {
455  setLabel(QObject::tr("Region ID"));
456  setHelpText(QObject::tr("Region ID for Freesat or Sky on satellite Astra-2 28.2E. "
457  "Leave this at 0 you do not receive this satellite. "
458  "This is needed to get the Freesat and Sky channel numbers. "
459  "Value 1 selects region London. "
460  "See the MythTV Wiki https://www.mythtv.org/wiki/DVB_UK."));
461  setValue(value);
462  };
463 };
464 
466  MythUIComboBoxSetting(new VideoSourceDBStorage(this, parent, "freqtable"))
467 {
468  setLabel(QObject::tr("Channel frequency table"));
469  addSelection("default");
470 
471  for (const auto & chanlist : gChanLists)
472  addSelection(chanlist.name);
473 
474  setHelpText(QObject::tr("Use default unless this source uses a "
475  "different frequency table than the system wide table "
476  "defined in the General settings."));
477 }
478 
480  m_sourceId(_sourceid)
481 {
482  setLabel(QObject::tr("Channel frequency table"));
483 
484  for (const auto & chanlist : gChanLists)
485  addSelection(chanlist.name);
486 }
487 
489 {
490  int idx1 = getValueIndex(gCoreContext->GetSetting("FreqTable"));
491  if (idx1 >= 0)
492  setValue(idx1);
493 
494  if (!m_sourceId)
495  return;
496 
498  query.prepare(
499  "SELECT freqtable "
500  "FROM videosource "
501  "WHERE sourceid = :SOURCEID");
502  query.bindValue(":SOURCEID", m_sourceId);
503 
504  if (!query.exec() || !query.isActive())
505  {
506  MythDB::DBError("TransFreqTableSelector::load", query);
507  return;
508  }
509 
510  m_loadedFreqTable.clear();
511 
512  if (query.next())
513  {
514  m_loadedFreqTable = query.value(0).toString();
515  if (!m_loadedFreqTable.isEmpty() &&
516  (m_loadedFreqTable.toLower() != "default"))
517  {
518  int idx2 = getValueIndex(m_loadedFreqTable);
519  if (idx2 >= 0)
520  setValue(idx2);
521  }
522  }
523 }
524 
526 {
527  LOG(VB_GENERAL, LOG_INFO, "TransFreqTableSelector::Save(void)");
528 
529  if ((m_loadedFreqTable == getValue()) ||
530  ((m_loadedFreqTable.toLower() == "default") &&
531  (getValue() == gCoreContext->GetSetting("FreqTable"))))
532  {
533  return;
534  }
535 
537  query.prepare(
538  "UPDATE videosource "
539  "SET freqtable = :FREQTABLE "
540  "WHERE sourceid = :SOURCEID");
541 
542  query.bindValue(":FREQTABLE", getValue());
543  query.bindValue(":SOURCEID", m_sourceId);
544 
545  if (!query.exec() || !query.isActive())
546  {
547  MythDB::DBError("TransFreqTableSelector::load", query);
548  return;
549  }
550 }
551 
553 {
554  m_sourceId = _sourceid;
555  Load();
556 }
557 
559 {
560  public:
561  explicit UseEIT(const VideoSource &parent) :
562  MythUICheckBoxSetting(new VideoSourceDBStorage(this, parent, "useeit"))
563  {
564  setLabel(QObject::tr("Perform EIT scan"));
565  setHelpText(QObject::tr(
566  "If enabled, program guide data for channels on this "
567  "source will be updated with data provided by the "
568  "channels themselves 'Over-the-Air'."));
569  }
570 };
571 
573  const QString& _grabber,
574  StandardSetting *_setting) :
575  m_parent(_parent), m_grabber(_grabber)
576 {
577  setVisible(false);
578 
579  QString filename = QString("%1/%2.xmltv")
580  .arg(GetConfDir()).arg(m_parent.getSourceName());
581 
582  m_grabberArgs.push_back("--config-file");
583  m_grabberArgs.push_back(filename);
584  m_grabberArgs.push_back("--configure");
585 
586  _setting->addTargetedChild(_grabber, new UseEIT(m_parent));
587 
588  auto *config = new ButtonStandardSetting(tr("Configure"));
589  config->setHelpText(tr("Run XMLTV configure command."));
590 
591  _setting->addTargetedChild(_grabber, config);
592 
593  connect(config, SIGNAL(clicked()), SLOT(RunConfig()));
594 }
595 
597 {
599 #if 0
600  QString err_msg = QObject::tr(
601  "You MUST run 'mythfilldatabase --manual' the first time,\n"
602  "instead of just 'mythfilldatabase'.\nYour grabber does not provide "
603  "channel numbers, so you have to set them manually.");
604 
606  {
607  LOG(VB_GENERAL, LOG_ERR, err_msg);
608  ShowOkPopup(err_msg);
609  }
610 #endif
611 }
612 
614 {
616  MythScreenType *ssd =
617  new MythTerminal(mainStack, m_grabber, m_grabberArgs);
618 
619  if (ssd->Create())
620  mainStack->AddScreen(ssd);
621  else
622  delete ssd;
623 }
624 
626 {
627  setVisible(false);
628 
629  m_useEit = new UseEIT(_parent);
630  m_useEit->setValue(true);
631  m_useEit->setVisible(false);
633 
634  auto *label=new TransTextEditSetting();
635  label->setValue(QObject::tr("Use only the transmitted guide data."));
636  label->setHelpText(
637  QObject::tr("This will usually only work with ATSC or DVB channels, "
638  "and generally provides data only for the next few days."));
639  _setting->addTargetedChild("eitonly", label);
640 }
641 
643 {
644  // Force this value on
645  m_useEit->setValue(true);
646  m_useEit->Save();
647 }
648 
650 {
651  m_useEit = new UseEIT(_parent);
652  m_useEit->setValue(false);
653  m_useEit->setVisible(false);
655 
656  auto *label = new TransTextEditSetting();
657  label->setValue(QObject::tr("Do not configure a grabber"));
658  addTargetedChild("/bin/true", label);
659 }
660 
662 {
663  m_useEit->setValue(false);
664  m_useEit->Save();
665 }
666 
668 {
669  // must be first
670  m_id = new ID();
671  addChild(m_id = new ID());
672 
673  setLabel(QObject::tr("Video Source Setup"));
674  addChild(m_name = new Name(*this));
675  addChild(new XMLTVGrabber(*this));
676  addChild(new FreqTableSelector(*this));
677  addChild(new ScanFrequency(*this));
678  addChild(new DVBNetID(*this, -1, -1));
679  addChild(new BouquetID(*this, 0, 0));
680  addChild(new RegionID(*this, 0, 0));
681 }
682 
684 {
685  return true;
686 }
687 
689 {
691 }
692 
693 bool VideoSourceEditor::cardTypesInclude(const int &sourceID,
694  const QString &thecardtype)
695 {
697  query.prepare("SELECT count(cardtype)"
698  " FROM capturecard "
699  " WHERE capturecard.sourceid = :SOURCEID "
700  " AND capturecard.cardtype = :CARDTYPE ;");
701  query.bindValue(":SOURCEID", sourceID);
702  query.bindValue(":CARDTYPE", thecardtype);
703 
704  if (query.exec() && query.next())
705  {
706  int count = query.value(0).toInt();
707 
708  if (count > 0)
709  return true;
710  }
711 
712  return false;
713 }
714 
716 {
717  MSqlQuery result(MSqlQuery::InitCon());
718  result.prepare("SELECT name, sourceid FROM videosource;");
719 
720  if (result.exec() && result.isActive() && result.size() > 0)
721  {
722  while (result.next())
723  {
724  auto* source = new VideoSource();
725  source->setLabel(result.value(0).toString());
726  source->loadByID(result.value(1).toInt());
727  setting->addChild(source);
728  }
729  }
730 }
731 
733 {
734  MSqlQuery result(MSqlQuery::InitCon());
735  result.prepare("SELECT name, sourceid FROM videosource;");
736 
737  if (result.exec() && result.isActive() && result.size() > 0)
738  {
739  while (result.next())
740  {
741  setting->addSelection(result.value(0).toString(),
742  result.value(1).toString());
743  }
744  }
745 }
746 
747 void VideoSource::loadByID(int sourceid)
748 {
749  m_id->setValue(sourceid);
750 }
751 
753 {
754  public:
755  explicit VideoDevice(const CaptureCard &parent,
756  uint minor_min = 0,
757  uint minor_max = UINT_MAX,
758  const QString& card = QString(),
759  const QString& driver = QString()) :
760  CaptureCardComboBoxSetting(parent, true, "videodevice")
761  {
762  setLabel(QObject::tr("Video device"));
763 
764  // /dev/v4l/video*
765  QDir dev("/dev/v4l", "video*", QDir::Name, QDir::System);
766  fillSelectionsFromDir(dev, minor_min, minor_max,
767  card, driver, false);
768 
769  // /dev/video*
770  dev.setPath("/dev");
771  fillSelectionsFromDir(dev, minor_min, minor_max,
772  card, driver, false);
773 
774  // /dev/dtv/video*
775  dev.setPath("/dev/dtv");
776  fillSelectionsFromDir(dev, minor_min, minor_max,
777  card, driver, false);
778 
779  // /dev/dtv*
780  dev.setPath("/dev");
781  dev.setNameFilters(QStringList("dtv*"));
782  fillSelectionsFromDir(dev, minor_min, minor_max,
783  card, driver, false);
784  };
785 
790  void fillSelectionsFromDir(const QDir &dir, bool absPath = true)
791  {
792  // Needed to make both compiler and doxygen happy.
793  (void) absPath;
794 
795  fillSelectionsFromDir(dir, 0, 255, QString(), QString(), false);
796  }
797 
799  uint minor_min, uint minor_max,
800  const QString& card, const QString& driver,
801  bool allow_duplicates)
802  {
803  uint cnt = 0;
804  QRegExp *driverExp = nullptr;
805  if (!driver.isEmpty())
806  driverExp = new QRegExp(driver);
807 
808  for (const auto & fi : dir.entryInfoList())
809  {
810  struct stat st {};
811  QString filepath = fi.absoluteFilePath();
812  int err = lstat(filepath.toLocal8Bit().constData(), &st);
813 
814  if (err)
815  {
816  LOG(VB_GENERAL, LOG_ERR,
817  QString("Could not stat file: %1").arg(filepath));
818  continue;
819  }
820 
821  // is this is a character device?
822  if (!S_ISCHR(st.st_mode))
823  continue;
824 
825  // is this device is in our minor range?
826  uint minor_num = minor(st.st_rdev);
827  if (minor_min > minor_num || minor_max < minor_num)
828  continue;
829 
830  // ignore duplicates if allow_duplicates not set
831  if (!allow_duplicates && m_minorList[minor_num])
832  continue;
833 
834  // if the driver returns any info add this device to our list
835  QByteArray tmp = filepath.toLatin1();
836  int videofd = open(tmp.constData(), O_RDWR);
837  if (videofd >= 0)
838  {
839  QString card_name;
840  QString driver_name;
841  if (CardUtil::GetV4LInfo(videofd, card_name, driver_name) &&
842  (!driverExp || (driverExp->exactMatch(driver_name))) &&
843  (card.isEmpty() || (card_name == card)))
844  {
845  addSelection(filepath);
846  cnt++;
847  }
848  close(videofd);
849  }
850 
851  // add to list of minors discovered to avoid duplicates
852  m_minorList[minor_num] = 1;
853  }
854  delete driverExp;
855 
856  return cnt;
857  }
858 
859  QString Driver(void) const { return m_driverName; }
860  QString Card(void) const { return m_cardName; }
861 
862  private:
863  QMap<uint, uint> m_minorList;
864  QString m_cardName;
865  QString m_driverName;
866 };
867 
869 {
870  public:
871  explicit VBIDevice(const CaptureCard &parent) :
872  CaptureCardComboBoxSetting(parent, true /*, mustexist true */,
873  "vbidevice")
874  {
875  setLabel(QObject::tr("VBI device"));
876  setFilter(QString(), QString());
877  setHelpText(QObject::tr("Device to read VBI (captions) from."));
878  };
879 
880  uint setFilter(const QString &card, const QString &driver)
881  {
882  uint count = 0;
883  clearSelections();
884  QDir dev("/dev/v4l", "vbi*", QDir::Name, QDir::System);
885  if (!(count = fillSelectionsFromDir(dev, card, driver)))
886  {
887  dev.setPath("/dev");
888  if (((count = fillSelectionsFromDir(dev, card, driver)) == 0U) &&
889  !getValue().isEmpty())
890  {
891  addSelection(getValue(),getValue(),true);
892  }
893  }
894 
895  return count;
896  }
897 
902  void fillSelectionsFromDir(const QDir &dir, bool absPath = true)
903  {
904  // Needed to make both compiler and doxygen happy.
905  (void) absPath;
906 
907  fillSelectionsFromDir(dir, QString(), QString());
908  }
909 
910  uint fillSelectionsFromDir(const QDir &dir, const QString &card,
911  const QString &driver)
912  {
913  QStringList devices;
914  for (const auto & fi : dir.entryInfoList())
915  {
916  QString device = fi.absoluteFilePath();
917  QByteArray adevice = device.toLatin1();
918  int vbifd = open(adevice.constData(), O_RDWR);
919  if (vbifd < 0)
920  continue;
921 
922  QString cn;
923  QString dn;
924  if (CardUtil::GetV4LInfo(vbifd, cn, dn) &&
925  (driver.isEmpty() || (dn == driver)) &&
926  (card.isEmpty() || (cn == card)))
927  {
928  devices.push_back(device);
929  }
930 
931  close(vbifd);
932  }
933 
934  QString sel = getValue();
935  for (uint i = 0; i < (uint) devices.size(); i++)
936  addSelection(devices[i], devices[i], devices[i] == sel);
937 
938  return (uint) devices.size();
939  }
940 };
941 
943 {
944  public:
945  explicit CommandPath(const CaptureCard &parent) :
947  "videodevice"))
948  {
949  setLabel(QObject::tr(""));
950  setValue("");
951  setHelpText(QObject::tr("Specify the command to run, with any "
952  "needed arguments."));
953  };
954 };
955 
957 {
958  public:
959  explicit FileDevice(const CaptureCard &parent) :
961  new CaptureCardDBStorage(this, parent, "videodevice")
962  /* mustexist, false */)
963  {
964  setLabel(QObject::tr("File path"));
965  };
966 };
967 
969 {
970  public:
971  explicit AudioDevice(const CaptureCard &parent) :
972  CaptureCardComboBoxSetting(parent, true /* mustexist false */,
973  "audiodevice")
974  {
975  setLabel(QObject::tr("Audio device"));
976 #if USING_OSS
977  QDir dev("/dev", "dsp*", QDir::Name, QDir::System);
979  dev.setPath("/dev/sound");
981 #endif
982 #if USING_ALSA
983  addSelection("ALSA:default", "ALSA:default");
984 #endif
985  addSelection(QObject::tr("(None)"), "NULL");
986  setHelpText(QObject::tr("Device to read audio from, "
987  "if audio is separate from the video."));
988  };
989 };
990 
992 {
993  public:
994  SignalTimeout(const CaptureCard &parent, uint value, uint min_val) :
995  CaptureCardSpinBoxSetting(parent, min_val, 60000, 250, "signal_timeout")
996  {
997  setLabel(QObject::tr("Signal timeout (ms)"));
998  setValue(QString::number(value));
999  setHelpText(QObject::tr(
1000  "Maximum time (in milliseconds) MythTV waits for "
1001  "a signal when scanning for channels."));
1002  };
1003 };
1004 
1006 {
1007  public:
1008  ChannelTimeout(const CaptureCard &parent, uint value, uint min_val) :
1009  CaptureCardSpinBoxSetting(parent, min_val, 65000, 250,
1010  "channel_timeout")
1011  {
1012  setLabel(QObject::tr("Tuning timeout (ms)"));
1013  setValue(value);
1014  setHelpText(QObject::tr(
1015  "Maximum time (in milliseconds) MythTV waits for "
1016  "a channel lock. For recordings, if this time is "
1017  "exceeded, the recording will be marked as failed."));
1018  };
1019 };
1020 
1022 {
1023  public:
1024  explicit AudioRateLimit(const CaptureCard &parent) :
1025  CaptureCardComboBoxSetting(parent, false, "audioratelimit")
1026  {
1027  setLabel(QObject::tr("Force audio sampling rate"));
1028  setHelpText(
1029  QObject::tr("If non-zero, override the audio sampling "
1030  "rate in the recording profile when this card is "
1031  "used. Use this if your capture card does not "
1032  "support all of the standard rates."));
1033  addSelection(QObject::tr("(None)"), "0");
1034  addSelection("32000");
1035  addSelection("44100");
1036  addSelection("48000");
1037  };
1038 };
1039 
1041 {
1042  public:
1043  explicit SkipBtAudio(const CaptureCard &parent) :
1045  "skipbtaudio"))
1046  {
1047  setLabel(QObject::tr("Do not adjust volume"));
1048  setHelpText(
1049  QObject::tr("Enable this option for budget BT878 based "
1050  "DVB-T cards such as the AverTV DVB-T which "
1051  "require the audio volume to be left alone."));
1052  };
1053 };
1054 
1056 {
1057  public:
1058  explicit DVBCardNum(const CaptureCard &parent) :
1059  CaptureCardComboBoxSetting(parent, true, "videodevice")
1060  {
1061  setLabel(QObject::tr("DVB device"));
1062  setHelpText(
1063  QObject::tr("When you change this setting, the text below "
1064  "should change to the name and type of your card. "
1065  "If the card cannot be opened, an error message "
1066  "will be displayed."));
1067  fillSelections(QString());
1068  };
1069 
1073  void fillSelections(const QString &current)
1074  {
1075  clearSelections();
1076 
1077  // Get devices from filesystem
1078  QStringList sdevs = CardUtil::ProbeVideoDevices("DVB");
1079 
1080  // Add current if needed
1081  if (!current.isEmpty() &&
1082  (find(sdevs.begin(), sdevs.end(), current) == sdevs.end()))
1083  {
1084  stable_sort(sdevs.begin(), sdevs.end());
1085  }
1086 
1087  QStringList db = CardUtil::GetVideoDevices("DVB");
1088 
1089  QMap<QString,bool> in_use;
1090  QString sel = current;
1091  for (uint i = 0; i < (uint)sdevs.size(); i++)
1092  {
1093  const QString dev = sdevs[i];
1094  in_use[sdevs[i]] = find(db.begin(), db.end(), dev) != db.end();
1095  if (sel.isEmpty() && !in_use[sdevs[i]])
1096  sel = dev;
1097  }
1098 
1099  if (sel.isEmpty() && !sdevs.empty())
1100  sel = sdevs[0];
1101 
1102  QString usestr = QString(" -- ");
1103  usestr += QObject::tr("Warning: already in use");
1104 
1105  for (uint i = 0; i < (uint)sdevs.size(); i++)
1106  {
1107  const QString dev = sdevs[i];
1108  QString desc = dev + (in_use[sdevs[i]] ? usestr : "");
1109  desc = (current == sdevs[i]) ? dev : desc;
1110  addSelection(desc, dev, dev == sel);
1111  }
1112  }
1113 
1114  void Load(void) override // StandardSetting
1115  {
1116  clearSelections();
1117  addSelection(QString());
1118 
1120 
1122  fillSelections(dev);
1123  }
1124 };
1125 
1126 // Use capturecard/inputname to store the delivery system selection of the card
1128 {
1129  public:
1130  explicit DVBCardType(const CaptureCard &parent) :
1131  CaptureCardComboBoxSetting(parent, false, "inputname")
1132  {
1133  setLabel(QObject::tr("Delivery system"));
1134  setHelpText(
1135  QObject::tr("If your card supports more than one delivery system "
1136  "then you can select here the one that you want to use."));
1137  };
1138 };
1139 
1141 {
1142  public:
1144  {
1145  setLabel(QObject::tr("Frontend ID"));
1146  setHelpText(
1147  QObject::tr("Identification string reported by the card. "
1148  "If the message \"Could not get card info...\" appears "
1149  "the card can be in use by another program."));
1150  };
1151 };
1152 
1154 {
1155  public:
1156  explicit DVBNoSeqStart(const CaptureCard &parent) :
1158  new CaptureCardDBStorage(this, parent, "dvb_wait_for_seqstart"))
1159  {
1160  setLabel(QObject::tr("Wait for SEQ start header"));
1161  setValue(true);
1162  setHelpText(
1163  QObject::tr("If enabled, drop packets from the start of a DVB "
1164  "recording until a sequence start header is seen."));
1165  };
1166 };
1167 
1169 {
1170  public:
1171  explicit DVBOnDemand(const CaptureCard &parent) :
1173  new CaptureCardDBStorage(this, parent, "dvb_on_demand"))
1174  {
1175  setLabel(QObject::tr("Open DVB card on demand"));
1176  setValue(true);
1177  setHelpText(
1178  QObject::tr("If enabled, only open the DVB card when required, "
1179  "leaving it free for other programs at other times."));
1180  };
1181 };
1182 
1184 {
1185  public:
1186  explicit DVBEITScan(const CaptureCard &parent) :
1188  new CaptureCardDBStorage(this, parent, "dvb_eitscan"))
1189  {
1190  setLabel(QObject::tr("Use DVB card for active EIT scan"));
1191  setValue(true);
1192  setHelpText(
1193  QObject::tr("If enabled, activate active scanning for "
1194  "program data (EIT). When this option is enabled "
1195  "the DVB card is constantly in-use."));
1196  };
1197 };
1198 
1200 {
1201  public:
1202  explicit DVBTuningDelay(const CaptureCard &parent) :
1203  CaptureCardSpinBoxSetting(parent, 0, 2000, 25, "dvb_tuning_delay")
1204  {
1205  setValue("0");
1206  setLabel(QObject::tr("DVB tuning delay (ms)"));
1207  setValue(static_cast<int>(true));
1208  setHelpText(
1209  QObject::tr("Some Linux DVB drivers, in particular for the "
1210  "Hauppauge Nova-T, require that we slow down "
1211  "the tuning process by specifying a delay "
1212  "(in milliseconds)."));
1213  };
1214 };
1215 
1217 {
1218  public:
1219  explicit FirewireGUID(const CaptureCard &parent) :
1220  CaptureCardComboBoxSetting(parent, false, "videodevice")
1221  {
1222  setLabel(QObject::tr("GUID"));
1223 #ifdef USING_FIREWIRE
1224  vector<AVCInfo> list = FirewireDevice::GetSTBList();
1225  for (auto & i : list)
1226  {
1227  QString guid = i.GetGUIDString();
1228  m_guidToAvcInfo[guid] = i;
1229  addSelection(guid);
1230  }
1231 #endif // USING_FIREWIRE
1232  }
1233 
1234  AVCInfo GetAVCInfo(const QString &guid) const
1235  { return m_guidToAvcInfo[guid]; }
1236 
1237  private:
1238  QMap<QString,AVCInfo> m_guidToAvcInfo;
1239 };
1240 
1242  const FirewireGUID *_guid) :
1243  CaptureCardComboBoxSetting(parent, false, "firewire_model"),
1244  m_guid(_guid)
1245 {
1246  setLabel(QObject::tr("Cable box model"));
1247  addSelection(QObject::tr("Motorola Generic"), "MOTO GENERIC");
1248  addSelection(QObject::tr("SA/Cisco Generic"), "SA GENERIC");
1249  addSelection("DCH-3200");
1250  addSelection("DCX-3200");
1251  addSelection("DCT-3412");
1252  addSelection("DCT-3416");
1253  addSelection("DCT-6200");
1254  addSelection("DCT-6212");
1255  addSelection("DCT-6216");
1256  addSelection("QIP-6200");
1257  addSelection("QIP-7100");
1258  addSelection("PACE-550");
1259  addSelection("PACE-779");
1260  addSelection("SA3250HD");
1261  addSelection("SA4200HD");
1262  addSelection("SA4250HDC");
1263  addSelection("SA8300HD");
1264  QString help = QObject::tr(
1265  "Choose the model that most closely resembles your set top box. "
1266  "Depending on firmware revision SA4200HD may work better for a "
1267  "SA3250HD box.");
1268  setHelpText(help);
1269 }
1270 
1271 void FirewireModel::SetGUID(const QString &_guid)
1272 {
1273  (void) _guid;
1274 
1275 #ifdef USING_FIREWIRE
1276  AVCInfo info = m_guid->GetAVCInfo(_guid);
1277  QString model = FirewireDevice::GetModelName(info.m_vendorid, info.m_modelid);
1278  setValue(max(getValueIndex(model), 0));
1279 #endif // USING_FIREWIRE
1280 }
1281 
1282 void FirewireDesc::SetGUID(const QString &_guid)
1283 {
1284  (void) _guid;
1285 
1286  setLabel(tr("Description"));
1287 
1288 #ifdef USING_FIREWIRE
1289  QString name = m_guid->GetAVCInfo(_guid).m_product_name;
1290  name.replace("Scientific-Atlanta", "SA");
1291  name.replace(", Inc.", "");
1292  name.replace("Explorer(R)", "");
1293  name = name.simplified();
1294  setValue((name.isEmpty()) ? "" : name);
1295 #endif // USING_FIREWIRE
1296 }
1297 
1299 {
1300  public:
1301  explicit FirewireConnection(const CaptureCard &parent) :
1303  "firewire_connection"))
1304  {
1305  setLabel(QObject::tr("Connection Type"));
1306  addSelection(QObject::tr("Point to Point"),"0");
1307  addSelection(QObject::tr("Broadcast"),"1");
1308  }
1309 };
1310 
1312 {
1313  public:
1314  explicit FirewireSpeed(const CaptureCard &parent) :
1316  "firewire_speed"))
1317  {
1318  setLabel(QObject::tr("Speed"));
1319  addSelection(QObject::tr("100Mbps"),"0");
1320  addSelection(QObject::tr("200Mbps"),"1");
1321  addSelection(QObject::tr("400Mbps"),"2");
1322  addSelection(QObject::tr("800Mbps"),"3");
1323  }
1324 };
1325 
1326 #ifdef USING_FIREWIRE
1327 static void FirewireConfigurationGroup(CaptureCard& parent, CardType& cardtype)
1328 {
1329  auto *dev(new FirewireGUID(parent));
1330  auto *desc(new FirewireDesc(dev));
1331  auto *model(new FirewireModel(parent, dev));
1332  cardtype.addTargetedChild("FIREWIRE", dev);
1333  cardtype.addTargetedChild("FIREWIRE", new EmptyAudioDevice(parent));
1334  cardtype.addTargetedChild("FIREWIRE", new EmptyVBIDevice(parent));
1335  cardtype.addTargetedChild("FIREWIRE", desc);
1336  cardtype.addTargetedChild("FIREWIRE", model);
1337 
1338 #ifdef USING_LINUX_FIREWIRE
1339  cardtype.addTargetedChild("FIREWIRE", new FirewireConnection(parent));
1340  cardtype.addTargetedChild("FIREWIRE", new FirewireSpeed(parent));
1341 #endif // USING_LINUX_FIREWIRE
1342 
1343  cardtype.addTargetedChild("FIREWIRE", new SignalTimeout(parent, 2000, 1000));
1344  cardtype.addTargetedChild("FIREWIRE", new ChannelTimeout(parent, 9000, 1750));
1345 
1346  model->SetGUID(dev->getValue());
1347  desc->SetGUID(dev->getValue());
1348  QObject::connect(dev, SIGNAL(valueChanged(const QString&)),
1349  model, SLOT( SetGUID( const QString&)));
1350  QObject::connect(dev, SIGNAL(valueChanged(const QString&)),
1351  desc, SLOT( SetGUID( const QString&)));
1352 }
1353 #endif
1354 
1355 #if USING_HDHOMERUN
1356 
1357 // -----------------------
1358 // HDHomeRun Configuration
1359 // -----------------------
1360 
1362  HDHomeRunConfigurationGroup &_group) :
1364  new CaptureCardDBStorage(this, parent, "videodevice")),
1365  m_group(_group)
1366 {
1367  setVisible(false);
1368 };
1369 
1371 {
1374 }
1375 
1377 {
1380 }
1381 
1383 {
1384  public:
1385  explicit HDHomeRunEITScan(const CaptureCard &parent) :
1387  new CaptureCardDBStorage(this, parent, "dvb_eitscan"))
1388  {
1389  setLabel(QObject::tr("Use HD HomeRun for active EIT scan"));
1390  setValue(true);
1391  setHelpText(
1392  QObject::tr("If enabled, activate active scanning for "
1393  "program data (EIT). When this option is enabled "
1394  "the HD HomeRun is constantly in-use."));
1395  };
1396 };
1397 
1398 
1400 {
1401  public:
1402  explicit UseHDHomeRunDevice(QString &deviceid, QString &model,
1403  QString &ipaddr)
1404  {
1405  setLabel(QObject::tr("Use HDHomeRun %1 (%2 %3)")
1406  .arg(deviceid).arg(model).arg(ipaddr));
1407  setValue(false);
1408  setHelpText(
1409  QObject::tr("If enabled, use tuners from this HDHomeRun "
1410  "device."));
1411  };
1412 };
1413 
1415  (CaptureCard& a_parent, CardType &a_cardtype) :
1416  m_parent(a_parent)
1417 {
1418  setVisible(false);
1419 
1420  // Fill Device list
1421  FillDeviceList();
1422 
1423  m_deviceId = new HDHomeRunDeviceID(m_parent, *this);
1424 
1425  QMap<QString, HDHomeRunDevice>::iterator dit;
1426  for (dit = m_deviceList.begin(); dit != m_deviceList.end(); ++dit)
1427  {
1428  HDHomeRunDevice &dev = *dit;
1429  dev.m_checkbox = new UseHDHomeRunDevice(
1430  dev.m_deviceId, dev.m_model, dev.m_cardIp);
1431  a_cardtype.addTargetedChild("HDHOMERUN", dev.m_checkbox);
1432  }
1433  a_cardtype.addTargetedChild("HDHOMERUN", new EmptyAudioDevice(m_parent));
1434  a_cardtype.addTargetedChild("HDHOMERUN", new EmptyVBIDevice(m_parent));
1435  a_cardtype.addTargetedChild("HDHOMERUN", m_deviceId);
1436 
1437  auto *buttonRecOpt = new GroupSetting();
1438  buttonRecOpt->setLabel(tr("Recording Options"));
1439  buttonRecOpt->addChild(new SignalTimeout(m_parent, 3000, 250));
1440  buttonRecOpt->addChild(new ChannelTimeout(m_parent, 6000, 1750));
1441  buttonRecOpt->addChild(new HDHomeRunEITScan(m_parent));
1442  a_cardtype.addTargetedChild("HDHOMERUN", buttonRecOpt);
1443 };
1444 
1446 {
1447  m_deviceList.clear();
1448 
1449  // Find physical devices first
1450  // ProbeVideoDevices returns "deviceid ip" pairs
1451  QStringList devs = CardUtil::ProbeVideoDevices("HDHOMERUN");
1452 
1453  QStringList::const_iterator it;
1454 
1455  for (it = devs.begin(); it != devs.end(); ++it)
1456  {
1457  QString dev = *it;
1458  QStringList devinfo = dev.split(" ");
1459  const QString& devid = devinfo.at(0);
1460  const QString& devip = devinfo.at(1);
1461  const QString& model = devinfo.at(2);
1462 
1463  HDHomeRunDevice tmpdevice;
1464  tmpdevice.m_model = model;
1465  tmpdevice.m_cardIp = devip;
1466  tmpdevice.m_deviceId = devid;
1467  // Fully specify object. Checkboxes will be added later when
1468  // the configuration group is created.
1469  tmpdevice.m_checkbox = nullptr;
1470  m_deviceList[tmpdevice.m_deviceId] = tmpdevice;
1471  }
1472 
1473 #if 0
1474  // Debug dump of cards
1475  QMap<QString, HDHomeRunDevice>::iterator debugit;
1476  for (debugit = m_deviceList.begin(); debugit != m_deviceList.end(); ++debugit)
1477  {
1478  LOG(VB_GENERAL, LOG_DEBUG, QString("%1: %2 %3")
1479  .arg(debugit.key()).arg((*debugit).model)
1480  .arg((*debugit).cardip));
1481  }
1482 #endif
1483 }
1484 
1486 {
1487  QStringList devstrs = devices.split(",");
1488  for (int i = 0; i < devstrs.size(); ++i)
1489  {
1490  // Get the HDHomeRun device ID using libhdhomerun. We need to
1491  // do it this way because legacy configurations could use an
1492  // IP address and a tuner nubmer.
1493  QByteArray ba = devstrs[i].toUtf8();
1494  hdhomerun_device_t *device = hdhomerun_device_create_from_str(
1495  ba.data(), nullptr);
1496  if (!device)
1497  continue;
1498  QString devid = QString("%1").arg(
1499  hdhomerun_device_get_device_id(device), 8, 16).toUpper();
1500  hdhomerun_device_destroy(device);
1501 
1502  // If we know about this device, set its checkbox to on.
1503  QMap<QString, HDHomeRunDevice>::iterator dit;
1504  dit = m_deviceList.find(devid);
1505  if (dit != m_deviceList.end())
1506  (*dit).m_checkbox->setValue(true);
1507  }
1508 }
1509 
1511 {
1512  // Return a string listing each HDHomeRun device with its checbox
1513  // turned on.
1514  QStringList devstrs;
1515  QMap<QString, HDHomeRunDevice>::iterator dit;
1516  for (dit = m_deviceList.begin(); dit != m_deviceList.end(); ++dit)
1517  {
1518  if ((*dit).m_checkbox->boolValue())
1519  devstrs << (*dit).m_deviceId;
1520  }
1521  QString devices = devstrs.join(",");
1522  return devices;
1523 }
1524 
1525 #endif
1526 
1527 // -----------------------
1528 // VBOX Configuration
1529 // -----------------------
1530 
1532 {
1533  setLabel(QObject::tr("IP Address"));
1534  setHelpText(QObject::tr("Device IP or ID of a VBox device. eg. '192.168.1.100' or 'vbox_3718'"));
1535  VBoxIP::setEnabled(false);
1536  connect(this, SIGNAL(valueChanged(const QString&)),
1537  this, SLOT(UpdateDevices(const QString&)));
1538 };
1539 
1541 {
1543  if (e)
1544  {
1545  if (!m_oldValue.isEmpty())
1547  emit NewIP(getValue());
1548  }
1549  else
1550  {
1551  m_oldValue = getValue();
1552  }
1553 }
1554 
1555 void VBoxIP::UpdateDevices(const QString &v)
1556 {
1557  if (isEnabled())
1558  emit NewIP(v);
1559 }
1560 
1562 {
1563  setLabel(QObject::tr("Tuner"));
1564  setHelpText(QObject::tr("Number and type of the tuner to use. eg '1-DVBT/T2'."));
1566  connect(this, SIGNAL(valueChanged(const QString&)),
1567  this, SLOT(UpdateDevices(const QString&)));
1568 };
1569 
1571 {
1573  if (e) {
1574  if (!m_oldValue.isEmpty())
1576  emit NewTuner(getValue());
1577  }
1578  else
1579  {
1580  m_oldValue = getValue();
1581  }
1582 }
1583 
1584 void VBoxTunerIndex::UpdateDevices(const QString &v)
1585 {
1586  if (isEnabled())
1587  emit NewTuner(v);
1588 }
1589 
1591  MythUITextEditSetting(new CaptureCardDBStorage(this, parent, "videodevice"))
1592 {
1593  setLabel(tr("Device ID"));
1594  setHelpText(tr("Device ID of VBox device"));
1595  setEnabled(false);
1596 }
1597 
1598 void VBoxDeviceID::SetIP(const QString &ip)
1599 {
1600  m_ip = ip;
1601  setValue(QString("%1-%2").arg(m_ip).arg(m_tuner));
1602 }
1603 
1604 void VBoxDeviceID::SetTuner(const QString &tuner)
1605 {
1606  m_tuner = tuner;
1607  setValue(QString("%1-%2").arg(m_ip).arg(m_tuner));
1608 }
1609 
1610 void VBoxDeviceID::SetOverrideDeviceID(const QString &deviceid)
1611 {
1612  m_overrideDeviceId = deviceid;
1613  setValue(deviceid);
1614 }
1615 
1617 {
1618  GetStorage()->Load();
1619  if (!m_overrideDeviceId.isEmpty())
1620  {
1622  m_overrideDeviceId.clear();
1623  }
1624 }
1625 
1627  VBoxDeviceID *deviceid,
1628  StandardSetting *desc,
1629  VBoxIP *cardip,
1630  VBoxTunerIndex *cardtuner,
1631  VBoxDeviceList *devicelist,
1632  const CaptureCard &parent) :
1633  m_deviceId(deviceid),
1634  m_desc(desc),
1635  m_cardIp(cardip),
1636  m_cardTuner(cardtuner),
1637  m_deviceList(devicelist),
1638  m_parent(parent)
1639 {
1640  setLabel(QObject::tr("Available devices"));
1641  setHelpText(
1642  QObject::tr(
1643  "Device IP or ID, tuner number and tuner type of available VBox devices."));
1644 
1645  connect(this, SIGNAL(valueChanged(const QString&)),
1646  this, SLOT(UpdateDevices(const QString&)));
1647 };
1648 
1650 void VBoxDeviceIDList::fillSelections(const QString &cur)
1651 {
1652  clearSelections();
1653 
1654  vector<QString> devs;
1655  QMap<QString, bool> in_use;
1656 
1657  const QString& current = cur;
1658 
1659  for (auto it = m_deviceList->begin(); it != m_deviceList->end(); ++it)
1660  {
1661  devs.push_back(it.key());
1662  in_use[it.key()] = (*it).m_inUse;
1663  }
1664 
1665  QString man_addr = VBoxDeviceIDList::tr("Manually Enter IP Address");
1666  QString sel = man_addr;
1667  devs.push_back(sel);
1668 
1669  for (const auto & dev : devs)
1670  sel = (current == dev) ? dev : sel;
1671 
1672  QString usestr = QString(" -- ");
1673  usestr += QObject::tr("Warning: already in use");
1674 
1675  for (const auto & dev : devs)
1676  {
1677  QString desc = dev + (in_use[dev] ? usestr : "");
1678  addSelection(desc, dev, dev == sel);
1679  }
1680 
1681  if (current != cur)
1682  {
1684  }
1685  else if (sel == man_addr && !current.isEmpty())
1686  {
1687  // Populate the proper values for IP address and tuner
1688  QStringList selection = current.split("-");
1689 
1690  m_cardIp->SetOldValue(selection.first());
1691  m_cardTuner->SetOldValue(selection.last());
1692 
1693  m_cardIp->setValue(selection.first());
1694  m_cardTuner->setValue(selection.last());
1695  }
1696 }
1697 
1699 {
1700  clearSelections();
1701 
1702  int cardid = m_parent.getCardID();
1703  QString device = CardUtil::GetVideoDevice(cardid);
1704  fillSelections(device);
1705 }
1706 
1707 void VBoxDeviceIDList::UpdateDevices(const QString &v)
1708 {
1709  if (v == VBoxDeviceIDList::tr("Manually Enter IP Address"))
1710  {
1711  m_cardIp->setEnabled(true);
1712  m_cardTuner->setEnabled(true);
1713  }
1714  else if (!v.isEmpty())
1715  {
1716  if (m_oldValue == VBoxDeviceIDList::tr("Manually Enter IP Address"))
1717  {
1718  m_cardIp->setEnabled(false);
1719  m_cardTuner->setEnabled(false);
1720  }
1721  m_deviceId->setValue(v);
1722 
1723  // Update _cardip and _cardtuner
1725  m_cardTuner->setValue(QString("%1").arg((*m_deviceList)[v].m_tunerNo));
1727  }
1728  m_oldValue = v;
1729 };
1730 
1731 // -----------------------
1732 // IPTV Configuration
1733 // -----------------------
1734 
1736 {
1737  public:
1738  explicit IPTVHost(const CaptureCard &parent) :
1739  CaptureCardTextEditSetting(parent, "videodevice")
1740  {
1741  setValue("http://mafreebox.freebox.fr/freeboxtv/playlist.m3u");
1742  setLabel(QObject::tr("M3U URL"));
1743  setHelpText(
1744  QObject::tr("URL of M3U containing RTSP/RTP/UDP channel URLs."));
1745  }
1746 };
1747 
1748 static void IPTVConfigurationGroup(CaptureCard& parent, CardType& cardType)
1749 {
1750  cardType.addTargetedChild("FREEBOX", new IPTVHost(parent));
1751  cardType.addTargetedChild("FREEBOX", new ChannelTimeout(parent, 30000, 1750));
1752  cardType.addTargetedChild("FREEBOX", new EmptyAudioDevice(parent));
1753  cardType.addTargetedChild("FREEBOX", new EmptyVBIDevice(parent));
1754 }
1755 
1757 {
1758  public:
1759  explicit ASIDevice(const CaptureCard &parent) :
1760  CaptureCardComboBoxSetting(parent, true, "videodevice")
1761  {
1762  setLabel(QObject::tr("ASI device"));
1763  fillSelections(QString());
1764  };
1765 
1769  void fillSelections(const QString &current)
1770  {
1771  clearSelections();
1772 
1773  // Get devices from filesystem
1774  QStringList sdevs = CardUtil::ProbeVideoDevices("ASI");
1775 
1776  // Add current if needed
1777  if (!current.isEmpty() &&
1778  (find(sdevs.begin(), sdevs.end(), current) == sdevs.end()))
1779  {
1780  stable_sort(sdevs.begin(), sdevs.end());
1781  }
1782 
1783  // Get devices from DB
1784  QStringList db = CardUtil::GetVideoDevices("ASI");
1785 
1786  // Figure out which physical devices are already in use
1787  // by another card defined in the DB, and select a device
1788  // for new configs (preferring non-conflicing devices).
1789  QMap<QString,bool> in_use;
1790  QString sel = current;
1791  for (uint i = 0; i < (uint)sdevs.size(); ++i)
1792  {
1793  const QString dev = sdevs[i];
1794  in_use[sdevs[i]] = find(db.begin(), db.end(), dev) != db.end();
1795  if (sel.isEmpty() && !in_use[sdevs[i]])
1796  sel = dev;
1797  }
1798 
1799  // Unfortunately all devices are conflicted, select first device.
1800  if (sel.isEmpty() && !sdevs.empty())
1801  sel = sdevs[0];
1802 
1803  QString usestr = QString(" -- ");
1804  usestr += QObject::tr("Warning: already in use");
1805 
1806  // Add the devices to the UI
1807  bool found = false;
1808  for (uint i = 0; i < (uint)sdevs.size(); ++i)
1809  {
1810  const QString dev = sdevs[i];
1811  QString desc = dev + (in_use[sdevs[i]] ? usestr : "");
1812  desc = (current == sdevs[i]) ? dev : desc;
1813  addSelection(desc, dev, dev == sel);
1814  found |= (dev == sel);
1815  }
1816 
1817  // If a configured device isn't on the list, add it with warning
1818  if (!found && !current.isEmpty())
1819  {
1820  QString desc = current + " -- " +
1821  QObject::tr("Warning: unable to open");
1822  addSelection(desc, current, true);
1823  }
1824  }
1825 
1826  void Load(void) override // StandardSetting
1827  {
1828  clearSelections();
1829  addSelection(QString());
1830  GetStorage()->Load();
1832  }
1833 };
1834 
1836  CardType &cardType):
1837  m_parent(a_parent),
1838  m_device(new ASIDevice(m_parent)),
1839  m_cardInfo(new TransTextEditSetting())
1840 {
1841  setVisible(false);
1842  m_cardInfo->setLabel(tr("Status"));
1843  m_cardInfo->setEnabled(false);
1844 
1845  cardType.addTargetedChild("ASI", m_device);
1846  cardType.addTargetedChild("ASI", new EmptyAudioDevice(m_parent));
1847  cardType.addTargetedChild("ASI", new EmptyVBIDevice(m_parent));
1848  cardType.addTargetedChild("ASI", m_cardInfo);
1849 
1850  connect(m_device, SIGNAL(valueChanged(const QString&)),
1851  this, SLOT( probeCard( const QString&)));
1852 
1854 };
1855 
1856 void ASIConfigurationGroup::probeCard(const QString &device)
1857 {
1858 #ifdef USING_ASI
1859  if (device.isEmpty())
1860  {
1861  m_cardInfo->setValue("");
1862  return;
1863  }
1864 
1865  if ((m_parent.getCardID() != 0) && m_parent.GetRawCardType() != "ASI")
1866  {
1867  m_cardInfo->setValue("");
1868  return;
1869  }
1870 
1871  QString error;
1872  int device_num = CardUtil::GetASIDeviceNumber(device, &error);
1873  if (device_num < 0)
1874  {
1875  m_cardInfo->setValue(tr("Not a valid DVEO ASI card"));
1876  LOG(VB_GENERAL, LOG_WARNING,
1877  "ASIConfigurationGroup::probeCard(), Warning: " + error);
1878  return;
1879  }
1880  m_cardInfo->setValue(tr("Valid DVEO ASI card"));
1881 #else
1882  Q_UNUSED(device);
1883  m_cardInfo->setValue(QString("Not compiled with ASI support"));
1884 #endif
1885 }
1886 
1888  CardType& a_cardtype):
1889  m_parent(a_parent),
1890  m_info(new GroupSetting()), m_size(new GroupSetting())
1891 {
1892  setVisible(false);
1893  auto *device = new FileDevice(m_parent);
1894  device->setHelpText(tr("A local file used to simulate a recording."
1895  " Leave empty to use MythEvents to trigger an"
1896  " external program to import recording files."));
1897  a_cardtype.addTargetedChild("IMPORT", device);
1898 
1899  a_cardtype.addTargetedChild("IMPORT", new EmptyAudioDevice(m_parent));
1900  a_cardtype.addTargetedChild("IMPORT", new EmptyVBIDevice(m_parent));
1901 
1902  m_info->setLabel(tr("File info"));
1903  a_cardtype.addTargetedChild("IMPORT", m_info);
1904 
1905  m_size->setLabel(tr("File size"));
1906  a_cardtype.addTargetedChild("IMPORT", m_size);
1907 
1908  connect(device, SIGNAL(valueChanged(const QString&)),
1909  this, SLOT( probeCard( const QString&)));
1910 
1911  probeCard(device->getValue());
1912 };
1913 
1914 void ImportConfigurationGroup::probeCard(const QString &device)
1915 {
1916  QString ci;
1917  QString cs;
1918  QFileInfo fileInfo(device);
1919 
1920  // For convenience, ImportRecorder allows both formats:
1921  if (device.toLower().startsWith("file:"))
1922  fileInfo.setFile(device.mid(5));
1923 
1924  if (fileInfo.exists())
1925  {
1926  if (fileInfo.isReadable() && (fileInfo.isFile()))
1927  {
1928  ci = HTTPRequest::TestMimeType(fileInfo.absoluteFilePath());
1929  cs = tr("%1 MB").arg(fileInfo.size() / 1024 / 1024);
1930  }
1931  else
1932  ci = tr("File not readable");
1933  }
1934  else
1935  {
1936  ci = tr("File %1 does not exist").arg(device);
1937  }
1938 
1939  m_info->setValue(ci);
1940  m_size->setValue(cs);
1941 }
1942 
1943 // -----------------------
1944 // VBox Configuration
1945 // -----------------------
1946 
1948  (CaptureCard& a_parent, CardType& a_cardtype) :
1949  m_parent(a_parent)
1950 {
1951  setVisible(false);
1952 
1953  // Fill Device list
1954  FillDeviceList();
1955 
1956  m_deviceId = new VBoxDeviceID(m_parent);
1957  m_desc = new GroupSetting();
1958  m_desc->setLabel(tr("Description"));
1959  m_cardIp = new VBoxIP();
1960  m_cardTuner = new VBoxTunerIndex();
1961  m_deviceIdList = new VBoxDeviceIDList(
1962  m_deviceId, m_desc, m_cardIp, m_cardTuner, &m_deviceList, m_parent);
1963 
1964  a_cardtype.addTargetedChild("VBOX", m_deviceIdList);
1965  a_cardtype.addTargetedChild("VBOX", new EmptyAudioDevice(m_parent));
1966  a_cardtype.addTargetedChild("VBOX", new EmptyVBIDevice(m_parent));
1967  a_cardtype.addTargetedChild("VBOX", m_deviceId);
1968  a_cardtype.addTargetedChild("VBOX", m_desc);
1969  a_cardtype.addTargetedChild("VBOX", m_cardIp);
1970  a_cardtype.addTargetedChild("VBOX", m_cardTuner);
1971  a_cardtype.addTargetedChild("VBOX", new SignalTimeout(m_parent, 7000, 1000));
1972  a_cardtype.addTargetedChild("VBOX", new ChannelTimeout(m_parent, 10000, 1750));
1973 // TransButtonSetting *buttonRecOpt = new TransButtonSetting();
1974 // buttonRecOpt->setLabel(tr("Recording Options"));
1975 // addChild(buttonRecOpt);
1976 
1977 // connect(buttonRecOpt, SIGNAL(pressed()),
1978 // this, SLOT( VBoxExtraPanel()));
1979 
1980  connect(m_cardIp, SIGNAL(NewIP(const QString&)),
1981  m_deviceId, SLOT( SetIP(const QString&)));
1982  connect(m_cardTuner, SIGNAL(NewTuner(const QString&)),
1983  m_deviceId, SLOT( SetTuner(const QString&)));
1984 };
1985 
1987 {
1988  m_deviceList.clear();
1989 
1990  // Find physical devices first
1991  // ProbeVideoDevices returns "deviceid ip tunerno tunertype"
1992  QStringList devs = CardUtil::ProbeVideoDevices("VBOX");
1993 
1994  QStringList::const_iterator it;
1995 
1996  for (it = devs.begin(); it != devs.end(); ++it)
1997  {
1998  QString dev = *it;
1999  QStringList devinfo = dev.split(" ");
2000  const QString& id = devinfo.at(0);
2001  const QString& ip = devinfo.at(1);
2002  const QString& tunerNo = devinfo.at(2);
2003  const QString& tunerType = devinfo.at(3);
2004 
2005  VBoxDevice tmpdevice;
2006  tmpdevice.m_deviceId = id;
2007  tmpdevice.m_desc = CardUtil::GetVBoxdesc(id, ip, tunerNo, tunerType);
2008  tmpdevice.m_cardIp = ip;
2009  tmpdevice.m_inUse = false;
2010  tmpdevice.m_discovered = true;
2011  tmpdevice.m_tunerNo = tunerNo;
2012  tmpdevice.m_tunerType = tunerType;
2013  tmpdevice.m_mythDeviceId = id + "-" + tunerNo + "-" + tunerType;
2014  m_deviceList[tmpdevice.m_mythDeviceId] = tmpdevice;
2015  }
2016 
2017  // Now find configured devices
2018 
2019  // returns "ip.ip.ip.ip-n-type" or deviceid-n-type values
2020  QStringList db = CardUtil::GetVideoDevices("VBOX");
2021 
2022  for (it = db.begin(); it != db.end(); ++it)
2023  {
2024  QMap<QString, VBoxDevice>::iterator dit;
2025  dit = m_deviceList.find(*it);
2026 
2027  if (dit != m_deviceList.end())
2028  (*dit).m_inUse = true;
2029  }
2030 }
2031 
2032 // -----------------------
2033 // Ceton Configuration
2034 // -----------------------
2035 
2036 CetonSetting::CetonSetting(const char* label, const char* helptext)
2037 {
2038  setLabel(QObject::tr(label));
2039  setHelpText(tr(helptext));
2040  connect(this, SIGNAL(valueChanged( const QString&)),
2041  this, SLOT( UpdateDevices(const QString&)));
2042 }
2043 
2044 void CetonSetting::UpdateDevices(const QString &v)
2045 {
2046  if (isEnabled())
2047  emit NewValue(v);
2048 }
2049 
2050 void CetonSetting::LoadValue(const QString &value)
2051 {
2052  setValue(value);
2053 }
2054 
2056  MythUITextEditSetting(new CaptureCardDBStorage(this, parent, "videodevice")),
2057  m_parent(parent)
2058 {
2059  setLabel(tr("Device ID"));
2060  setHelpText(tr("Device ID of Ceton device"));
2061 }
2062 
2063 void CetonDeviceID::SetIP(const QString &ip)
2064 {
2065  QString regexp = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){4}$";
2066  if (QRegExp(regexp).exactMatch(ip + "."))
2067  {
2068  m_ip = ip;
2069  setValue(QString("%1-RTP.%3").arg(m_ip).arg(m_tuner));
2070  }
2071 }
2072 
2073 void CetonDeviceID::SetTuner(const QString &tuner)
2074 {
2075  if (QRegExp("^\\d$").exactMatch(tuner))
2076  {
2077  m_tuner = tuner;
2078  setValue(QString("%1-RTP.%2").arg(m_ip).arg(m_tuner));
2079  }
2080 }
2081 
2083 {
2084  GetStorage()->Load();
2085  UpdateValues();
2086 }
2087 
2089 {
2090  QRegExp newstyle(R"(^([0-9.]+)-(\d|RTP)\.(\d)$)");
2091  if (newstyle.exactMatch(getValue()))
2092  {
2093  emit LoadedIP(newstyle.cap(1));
2094  emit LoadedTuner(newstyle.cap(3));
2095  }
2096 }
2097 
2098 #ifdef USING_CETON
2099 static void CetonConfigurationGroup(CaptureCard& parent, CardType& cardtype)
2100 {
2101  auto *deviceid = new CetonDeviceID(parent);
2102  auto *desc = new GroupSetting();
2103  desc->setLabel(QCoreApplication::translate("CetonConfigurationGroup",
2104  "Description"));
2105  auto *ip = new CetonSetting("IP Address",
2106  "IP Address of the Ceton device (192.168.200.1 by default)");
2107  auto *tuner = new CetonSetting("Tuner",
2108  "Number of the tuner on the Ceton device (first tuner is number 0)");
2109 
2110  cardtype.addTargetedChild("CETON", ip);
2111  cardtype.addTargetedChild("CETON", tuner);
2112  cardtype.addTargetedChild("CETON", deviceid);
2113  cardtype.addTargetedChild("CETON", desc);
2114  cardtype.addTargetedChild("CETON", new SignalTimeout(parent, 1000, 250));
2115  cardtype.addTargetedChild("CETON", new ChannelTimeout(parent, 3000, 1750));
2116 
2117  QObject::connect(ip, SIGNAL(NewValue(const QString&)),
2118  deviceid, SLOT( SetIP(const QString&)));
2119  QObject::connect(tuner, SIGNAL(NewValue(const QString&)),
2120  deviceid, SLOT( SetTuner(const QString&)));
2121 
2122  QObject::connect(deviceid, SIGNAL(LoadedIP(const QString&)),
2123  ip, SLOT( LoadValue(const QString&)));
2124  QObject::connect(deviceid, SIGNAL(LoadedTuner(const QString&)),
2125  tuner, SLOT( LoadValue(const QString&)));
2126 }
2127 #endif
2128 
2130  CardType& a_cardtype) :
2131  m_parent(a_parent),
2132  m_cardInfo(new TransTextEditSetting()), m_vbiDev(new VBIDevice(m_parent))
2133 {
2134  setVisible(false);
2135  QString drv = "(?!ivtv|hdpvr|(saa7164(.*))).*";
2136  auto *device = new VideoDevice(m_parent, 0, 15, QString(), drv);
2137 
2138  m_cardInfo->setLabel(tr("Probed info"));
2139  m_cardInfo->setEnabled(false);
2140 
2141  a_cardtype.addTargetedChild("V4L", device);
2142  a_cardtype.addTargetedChild("V4L", m_cardInfo);
2143  a_cardtype.addTargetedChild("V4L", m_vbiDev);
2144  a_cardtype.addTargetedChild("V4L", new AudioDevice(m_parent));
2145  a_cardtype.addTargetedChild("V4L", new AudioRateLimit(m_parent));
2146  a_cardtype.addTargetedChild("V4L", new SkipBtAudio(m_parent));
2147 
2148  connect(device, SIGNAL(valueChanged(const QString&)),
2149  this, SLOT( probeCard( const QString&)));
2150 
2151  probeCard(device->getValue());
2152 };
2153 
2154 void V4LConfigurationGroup::probeCard(const QString &device)
2155 {
2156  QString cn = tr("Failed to open");
2157  QString ci = cn;
2158  QString dn;
2159 
2160  QByteArray adevice = device.toLatin1();
2161  int videofd = open(adevice.constData(), O_RDWR);
2162  if (videofd >= 0)
2163  {
2164  if (!CardUtil::GetV4LInfo(videofd, cn, dn))
2165  ci = cn = tr("Failed to probe");
2166  else if (!dn.isEmpty())
2167  ci = cn + " [" + dn + "]";
2168  close(videofd);
2169  }
2170 
2171  m_cardInfo->setValue(ci);
2172  m_vbiDev->setFilter(cn, dn);
2173 }
2174 
2176  CardType &a_cardtype) :
2177  m_parent(a_parent),
2178  m_cardInfo(new TransTextEditSetting())
2179 {
2180  setVisible(false);
2181  QString drv = "ivtv|(saa7164(.*))";
2182  m_device = new VideoDevice(m_parent, 0, 15, QString(), drv);
2184  m_vbiDevice->setVisible(false);
2185 
2186  m_cardInfo->setLabel(tr("Probed info"));
2187  m_cardInfo->setEnabled(false);
2188 
2189  a_cardtype.addTargetedChild("MPEG", m_device);
2190  a_cardtype.addTargetedChild("MPEG", m_vbiDevice);
2191  a_cardtype.addTargetedChild("MPEG", m_cardInfo);
2192  a_cardtype.addTargetedChild("MPEG", new ChannelTimeout(m_parent, 12000, 2000));
2193 
2194  connect(m_device, SIGNAL(valueChanged(const QString&)),
2195  this, SLOT( probeCard( const QString&)));
2196 
2198 }
2199 
2200 void MPEGConfigurationGroup::probeCard(const QString &device)
2201 {
2202  QString cn = tr("Failed to open");
2203  QString ci = cn;
2204  QString dn;
2205 
2206  QByteArray adevice = device.toLatin1();
2207  int videofd = open(adevice.constData(), O_RDWR);
2208  if (videofd >= 0)
2209  {
2210  if (!CardUtil::GetV4LInfo(videofd, cn, dn))
2211  ci = cn = tr("Failed to probe");
2212  else if (!dn.isEmpty())
2213  ci = cn + " [" + dn + "]";
2214  close(videofd);
2215  }
2216 
2217  m_cardInfo->setValue(ci);
2218  m_vbiDevice->setVisible(dn!="ivtv");
2219  m_vbiDevice->setFilter(cn, dn);
2220 }
2221 
2223  CardType &a_cardtype) :
2224  m_parent(a_parent),
2225  m_info(new GroupSetting()), m_size(new GroupSetting())
2226 {
2227  setVisible(false);
2228  auto *device = new FileDevice(m_parent);
2229  device->setHelpText(tr("A local MPEG file used to simulate a recording."));
2230 
2231  a_cardtype.addTargetedChild("DEMO", device);
2232 
2233  a_cardtype.addTargetedChild("DEMO", new EmptyAudioDevice(m_parent));
2234  a_cardtype.addTargetedChild("DEMO", new EmptyVBIDevice(m_parent));
2235 
2236  m_info->setLabel(tr("File info"));
2237  a_cardtype.addTargetedChild("DEMO", m_info);
2238 
2239  m_size->setLabel(tr("File size"));
2240  a_cardtype.addTargetedChild("DEMO", m_size);
2241 
2242  connect(device, SIGNAL(valueChanged(const QString&)),
2243  this, SLOT( probeCard( const QString&)));
2244 
2245  probeCard(device->getValue());
2246 }
2247 
2248 void DemoConfigurationGroup::probeCard(const QString &device)
2249 {
2250  QString ci;
2251  QString cs;
2252  QFileInfo fileInfo(device);
2253  if (fileInfo.exists())
2254  {
2255  if (fileInfo.isReadable() && (fileInfo.isFile()))
2256  {
2257  ci = HTTPRequest::TestMimeType(fileInfo.absoluteFilePath());
2258  cs = tr("%1 MB").arg(fileInfo.size() / 1024 / 1024);
2259  }
2260  else
2261  ci = tr("File not readable");
2262  }
2263  else
2264  {
2265  ci = tr("File does not exist");
2266  }
2267 
2268  m_info->setValue(ci);
2269  m_size->setValue(cs);
2270 }
2271 
2272 #if !defined( USING_MINGW ) && !defined( _MSC_VER )
2273 ExternalConfigurationGroup::ExternalConfigurationGroup(CaptureCard &a_parent,
2274  CardType &a_cardtype) :
2275  m_parent(a_parent),
2276  m_info(new GroupSetting())
2277 {
2278  setVisible(false);
2279  auto *device = new CommandPath(m_parent);
2280  device->setLabel(tr("Command path"));
2281  device->setHelpText(tr("A 'black box' application controlled via stdin, status on "
2282  "stderr and TransportStream read from stdout.\n"
2283  "Use absolute path or path relative to the current directory."));
2284  a_cardtype.addTargetedChild("EXTERNAL", device);
2285 
2286  m_info->setLabel(tr("File info"));
2287  a_cardtype.addTargetedChild("EXTERNAL", m_info);
2288 
2289  a_cardtype.addTargetedChild("EXTERNAL",
2290  new ChannelTimeout(m_parent, 20000, 1750));
2291 
2292  connect(device, SIGNAL(valueChanged(const QString&)),
2293  this, SLOT( probeApp( const QString&)));
2294 
2295  probeApp(device->getValue());
2296 }
2297 
2298 void ExternalConfigurationGroup::probeApp(const QString & path)
2299 {
2300  int idx1 = path.toLower().startsWith("file:") ? 5 : 0;
2301  int idx2 = path.indexOf(' ', idx1);
2302 
2303  QString ci;
2304  QString cs;
2305  QFileInfo fileInfo(path.mid(idx1, idx2 - idx1));
2306 
2307  if (fileInfo.exists())
2308  {
2309  ci = tr("File '%1' is valid.").arg(fileInfo.absoluteFilePath());
2310  if (!fileInfo.isReadable() || !fileInfo.isFile())
2311  ci = tr("WARNING: File '%1' is not readable.")
2312  .arg(fileInfo.absoluteFilePath());
2313  if (!fileInfo.isExecutable())
2314  ci = tr("WARNING: File '%1' is not executable.")
2315  .arg(fileInfo.absoluteFilePath());
2316  }
2317  else
2318  {
2319  ci = tr("WARNING: File '%1' does not exist.")
2320  .arg(fileInfo.absoluteFilePath());
2321  }
2322 
2323  m_info->setValue(ci);
2324  m_info->setHelpText(ci);
2325 }
2326 #endif // !defined( USING_MINGW ) && !defined( _MSC_VER )
2327 
2329  CardType &a_cardtype) :
2330  m_parent(a_parent), m_cardInfo(new GroupSetting()),
2331  m_audioInput(new TunerCardAudioInput(m_parent, QString(), "HDPVR"))
2332 {
2333  setVisible(false);
2334 
2335  auto *device = new VideoDevice(m_parent, 0, 15, QString(), "hdpvr");
2336 
2337  m_cardInfo->setLabel(tr("Probed info"));
2338  m_cardInfo->setEnabled(false);
2339 
2340  a_cardtype.addTargetedChild("HDPVR", device);
2341  a_cardtype.addTargetedChild("HDPVR", new EmptyAudioDevice(m_parent));
2342  a_cardtype.addTargetedChild("HDPVR", new EmptyVBIDevice(m_parent));
2343  a_cardtype.addTargetedChild("HDPVR", m_cardInfo);
2344  a_cardtype.addTargetedChild("HDPVR", m_audioInput);
2345  a_cardtype.addTargetedChild("HDPVR", new ChannelTimeout(m_parent, 15000, 2000));
2346 
2347  connect(device, SIGNAL(valueChanged(const QString&)),
2348  this, SLOT( probeCard( const QString&)));
2349 
2350  probeCard(device->getValue());
2351 }
2352 
2353 void HDPVRConfigurationGroup::probeCard(const QString &device)
2354 {
2355  QString cn = tr("Failed to open");
2356  QString ci = cn;
2357  QString dn;
2358 
2359  int videofd = open(device.toLocal8Bit().constData(), O_RDWR);
2360  if (videofd >= 0)
2361  {
2362  if (!CardUtil::GetV4LInfo(videofd, cn, dn))
2363  ci = cn = tr("Failed to probe");
2364  else if (!dn.isEmpty())
2365  ci = cn + " [" + dn + "]";
2366  close(videofd);
2367  }
2368 
2369  m_cardInfo->setValue(ci);
2370  m_audioInput->fillSelections(device);
2371 }
2372 
2374  m_parent(parent),
2375  m_cardInfo(new TransTextEditSetting())
2376 {
2377  setLabel(QObject::tr("V4L2 encoder devices (multirec capable)"));
2378  m_device = new VideoDevice(m_parent, 0, 15);
2379 
2380  cardtype.addTargetedChild("V4L2ENC", m_device);
2381  m_cardInfo->setLabel(tr("Probed info"));
2382  cardtype.addTargetedChild("V4L2ENC", m_cardInfo);
2383 
2384  setVisible(false);
2385 
2386  connect(m_device, SIGNAL(valueChanged(const QString&)),
2387  this, SLOT( probeCard( const QString&)));
2388 
2389  const QString &device_name = m_device->getValue();
2390  if (!device_name.isEmpty())
2391  probeCard(device_name);
2392 }
2393 
2394 void V4L2encGroup::probeCard(const QString &device_name)
2395 {
2396 #ifdef USING_V4L2
2397  QString card_name = tr("Failed to open");
2398  QString card_info = card_name;
2399  V4L2util v4l2(device_name);
2400 
2401  if (!v4l2.IsOpen())
2402  {
2403  m_driverName = tr("Failed to probe");
2404  return;
2405  }
2406  m_driverName = v4l2.DriverName();
2407  card_name = v4l2.CardName();
2408 
2409  if (!m_driverName.isEmpty())
2410  card_info = card_name + " [" + m_driverName + "]";
2411 
2412  m_cardInfo->setValue(card_info);
2413 
2414  if (m_device->getSubSettings()->empty())
2415  {
2416  auto* audioinput = new TunerCardAudioInput(m_parent, QString(), "V4L2");
2417  if (audioinput->fillSelections(device_name) > 1)
2418  {
2419  audioinput->setName("AudioInput");
2420  m_device->addTargetedChild(m_driverName, audioinput);
2421  }
2422  else
2423  delete audioinput;
2424 
2425  if (v4l2.HasSlicedVBI())
2426  {
2427  auto* vbidev = new VBIDevice(m_parent);
2428  if (vbidev->setFilter(card_name, m_driverName) > 0)
2429  {
2430  vbidev->setName("VBIDevice");
2432  }
2433  else
2434  delete vbidev;
2435  }
2436 
2439  new ChannelTimeout(m_parent, 15000, 2000));
2440  }
2441 #else
2442  Q_UNUSED(device_name);
2443 #endif // USING_V4L2
2444 }
2445 
2447 {
2448  setLabel(QObject::tr("Capture Card Setup"));
2449 
2450  auto* cardtype = new CardType(parent);
2451  parent.addChild(cardtype);
2452 
2453 #ifdef USING_DVB
2454  cardtype->addTargetedChild("DVB",
2455  new DVBConfigurationGroup(parent, *cardtype));
2456 #endif // USING_DVB
2457 
2458 #ifdef USING_V4L2
2459 # ifdef USING_HDPVR
2460  cardtype->addTargetedChild("HDPVR",
2461  new HDPVRConfigurationGroup(parent, *cardtype));
2462 # endif // USING_HDPVR
2463 #endif // USING_V4L2
2464 
2465 #ifdef USING_HDHOMERUN
2466  cardtype->addTargetedChild("HDHOMERUN",
2467  new HDHomeRunConfigurationGroup(parent, *cardtype));
2468 #endif // USING_HDHOMERUN
2469 
2470 #ifdef USING_VBOX
2471  cardtype->addTargetedChild("VBOX",
2472  new VBoxConfigurationGroup(parent, *cardtype));
2473 #endif // USING_VBOX
2474 
2475 #ifdef USING_FIREWIRE
2476  FirewireConfigurationGroup(parent, *cardtype);
2477 #endif // USING_FIREWIRE
2478 
2479 #ifdef USING_CETON
2480  CetonConfigurationGroup(parent, *cardtype);
2481 #endif // USING_CETON
2482 
2483 #ifdef USING_IPTV
2484  IPTVConfigurationGroup(parent, *cardtype);
2485 #endif // USING_IPTV
2486 
2487 #ifdef USING_V4L2
2488  cardtype->addTargetedChild("V4L2ENC", new V4L2encGroup(parent, *cardtype));
2489  cardtype->addTargetedChild("V4L",
2490  new V4LConfigurationGroup(parent, *cardtype));
2491  cardtype->addTargetedChild("MJPEG",
2492  new V4LConfigurationGroup(parent, *cardtype));
2493  cardtype->addTargetedChild("GO7007",
2494  new V4LConfigurationGroup(parent, *cardtype));
2495 # ifdef USING_IVTV
2496  cardtype->addTargetedChild("MPEG",
2497  new MPEGConfigurationGroup(parent, *cardtype));
2498 # endif // USING_IVTV
2499 #endif // USING_V4L2
2500 
2501 #ifdef USING_ASI
2502  cardtype->addTargetedChild("ASI",
2503  new ASIConfigurationGroup(parent, *cardtype));
2504 #endif // USING_ASI
2505 
2506  // for testing without any actual tuner hardware:
2507  cardtype->addTargetedChild("IMPORT",
2508  new ImportConfigurationGroup(parent, *cardtype));
2509  cardtype->addTargetedChild("DEMO",
2510  new DemoConfigurationGroup(parent, *cardtype));
2511 #if !defined( USING_MINGW ) && !defined( _MSC_VER )
2512  cardtype->addTargetedChild("EXTERNAL",
2513  new ExternalConfigurationGroup(parent,
2514  *cardtype));
2515 #endif
2516 }
2517 
2518 CaptureCard::CaptureCard(bool use_card_group)
2519  : m_id(new ID)
2520 {
2521  addChild(m_id);
2522  if (use_card_group)
2523  CaptureCardGroup(*this);
2524  addChild(new Hostname(*this));
2525 }
2526 
2527 QString CaptureCard::GetRawCardType(void) const
2528 {
2529  int cardid = getCardID();
2530  if (cardid <= 0)
2531  return QString();
2532  return CardUtil::GetRawInputType(cardid);
2533 }
2534 
2536 {
2538  QString qstr =
2539  "SELECT cardid, videodevice, cardtype "
2540  "FROM capturecard "
2541  "WHERE hostname = :HOSTNAME AND parentid = 0 "
2542  "ORDER BY cardid";
2543 
2544  query.prepare(qstr);
2545  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
2546 
2547  if (!query.exec())
2548  {
2549  MythDB::DBError("CaptureCard::fillSelections", query);
2550  return;
2551  }
2552 
2554 
2555  while (query.next())
2556  {
2557  uint cardid = query.value(0).toUInt();
2558  QString videodevice = query.value(1).toString();
2559  QString cardtype = query.value(2).toString();
2560 
2561  QString label = CardUtil::GetDeviceLabel(cardtype, videodevice);
2562  auto *card = new CaptureCard();
2563  card->loadByID(cardid);
2564  card->setLabel(label);
2565  setting->addChild(card);
2566  }
2567 }
2568 
2569 void CaptureCard::loadByID(int cardid)
2570 {
2571  m_id->setValue(cardid);
2572  Load();
2573 }
2574 
2576 {
2577  return true;
2578 }
2579 
2581 {
2583 }
2584 
2585 
2587 {
2588  uint init_cardid = getCardID();
2589  QString init_dev = CardUtil::GetVideoDevice(init_cardid);
2590 
2592 
2594 
2596 
2597  uint cardid = getCardID();
2598  QString type = CardUtil::GetRawInputType(cardid);
2599  QString dev = CardUtil::GetVideoDevice(cardid);
2600 
2601  if (dev != init_dev)
2602  {
2603  if (!init_dev.isEmpty())
2604  {
2605  uint init_groupid = CardUtil::GetDeviceInputGroup(init_cardid);
2606  CardUtil::UnlinkInputGroup(init_cardid, init_groupid);
2607  }
2608  if (!dev.isEmpty())
2609  {
2610  uint groupid =
2612  gCoreContext->GetHostName(), dev);
2613  CardUtil::LinkInputGroup(cardid, groupid);
2614  CardUtil::UnlinkInputGroup(0, groupid);
2615  }
2616  }
2617 
2618  // Handle any cloning we may need to do
2620  {
2621  vector<uint> clones = CardUtil::GetChildInputIDs(cardid);
2622  for (uint clone : clones)
2623  CardUtil::CloneCard(cardid, clone);
2624  }
2625 }
2626 
2628 {
2629  if (getCardID() == 0)
2630  {
2631  Save();
2632  Load();
2633  }
2634 }
2635 
2637  CaptureCardComboBoxSetting(parent, false, "cardtype")
2638 {
2639  setLabel(QObject::tr("Card type"));
2640  setHelpText(QObject::tr("Change the cardtype to the appropriate type for "
2641  "the capture card you are configuring."));
2642  fillSelections(this);
2643 }
2644 
2646 {
2647 #ifdef USING_DVB
2648  setting->addSelection(
2649  QObject::tr("DVB-T/S/C, ATSC or ISDB-T tuner card"), "DVB");
2650 #endif // USING_DVB
2651 
2652 #ifdef USING_V4L2
2653  setting->addSelection(
2654  QObject::tr("V4L2 encoder"), "V4L2ENC");
2655 #ifdef USING_HDPVR
2656  setting->addSelection(
2657  QObject::tr("HD-PVR H.264 encoder"), "HDPVR");
2658 # endif // USING_HDPVR
2659 #endif // USING_V4L2
2660 
2661 #ifdef USING_HDHOMERUN
2662  setting->addSelection(
2663  QObject::tr("HDHomeRun networked tuner"), "HDHOMERUN");
2664 #endif // USING_HDHOMERUN
2665 
2666 #ifdef USING_VBOX
2667  setting->addSelection(
2668  QObject::tr("V@Box TV Gateway networked tuner"), "VBOX");
2669 #endif // USING_VBOX
2670 
2671 #ifdef USING_FIREWIRE
2672  setting->addSelection(
2673  QObject::tr("FireWire cable box"), "FIREWIRE");
2674 #endif // USING_FIREWIRE
2675 
2676 #ifdef USING_CETON
2677  setting->addSelection(
2678  QObject::tr("Ceton Cablecard tuner"), "CETON");
2679 #endif // USING_CETON
2680 
2681 #ifdef USING_IPTV
2682  setting->addSelection(QObject::tr("IPTV recorder"), "FREEBOX");
2683 #endif // USING_IPTV
2684 
2685 #ifdef USING_V4L2
2686 # ifdef USING_IVTV
2687  setting->addSelection(
2688  QObject::tr("Analog to MPEG-2 encoder card (PVR-150/250/350, etc)"), "MPEG");
2689 # endif // USING_IVTV
2690  setting->addSelection(
2691  QObject::tr("Analog to MJPEG encoder card (Matrox G200, DC10, etc)"), "MJPEG");
2692  setting->addSelection(
2693  QObject::tr("Analog to MPEG-4 encoder (Plextor ConvertX USB, etc)"),
2694  "GO7007");
2695  setting->addSelection(
2696  QObject::tr("Analog capture card"), "V4L");
2697 #endif // USING_V4L2
2698 
2699 #ifdef USING_ASI
2700  setting->addSelection(QObject::tr("DVEO ASI recorder"), "ASI");
2701 #endif
2702 
2703  setting->addSelection(QObject::tr("Import test recorder"), "IMPORT");
2704  setting->addSelection(QObject::tr("Demo test recorder"), "DEMO");
2705 #if !defined( USING_MINGW ) && !defined( _MSC_VER )
2706  setting->addSelection(QObject::tr("External (black box) recorder"),
2707  "EXTERNAL");
2708 #endif
2709 }
2710 
2712 {
2713  public:
2714  explicit InputName(const CardInput &parent) :
2715  MythUIComboBoxSetting(new CardInputDBStorage(this, parent, "inputname"))
2716  {
2717  setLabel(QObject::tr("Input name"));
2718  };
2719 
2720  void Load(void) override // StandardSetting
2721  {
2722  fillSelections();
2724  };
2725 
2727  clearSelections();
2728  addSelection(QObject::tr("(None)"), "None");
2729  auto *storage = dynamic_cast<CardInputDBStorage*>(GetStorage());
2730  if (storage == nullptr)
2731  return;
2732  uint cardid = storage->getInputID();
2733  QString type = CardUtil::GetRawInputType(cardid);
2734  QString device = CardUtil::GetVideoDevice(cardid);
2735  QStringList inputs;
2736  CardUtil::GetDeviceInputNames(device, type, inputs);
2737  while (!inputs.isEmpty())
2738  {
2739  addSelection(inputs.front());
2740  inputs.pop_front();
2741  }
2742  };
2743 };
2744 
2746 {
2747  public:
2749  {
2750  setLabel(QObject::tr("Delivery system"));
2751  setHelpText(QObject::tr(
2752  "This shows the delivery system (modulation), for instance DVB-T2, "
2753  "that you have selected when you configured the capture card. "
2754  "This must be the same as the modulation used by the video source. "));
2755  };
2756 };
2757 
2759 {
2760  public:
2761  explicit InputDisplayName(const CardInput &parent) :
2762  MythUITextEditSetting(new CardInputDBStorage(this, parent, "displayname")), m_parent(parent)
2763  {
2764  setLabel(QObject::tr("Display name"));
2765  setHelpText(QObject::tr(
2766  "This name is displayed on screen when Live TV begins "
2767  "and in various other places. Make sure the last two "
2768  "characters are unique for each input."));
2769  };
2770  void Load(void) override {
2772  if (getValue().isEmpty())
2773  setValue(tr("Input %1").arg(m_parent.getInputID()));
2774  }
2775  private:
2777 };
2778 
2780 {
2781  public:
2782  CardInputComboBoxSetting(const CardInput &parent, const QString &setting) :
2783  MythUIComboBoxSetting(new CardInputDBStorage(this, parent, setting))
2784  {
2785  }
2786 };
2787 
2789 {
2790  public:
2791  explicit SourceID(const CardInput &parent) :
2792  CardInputComboBoxSetting(parent, "sourceid")
2793  {
2794  setLabel(QObject::tr("Video source"));
2795  addSelection(QObject::tr("(None)"), "0");
2796  };
2797 
2798  void Load(void) override // StandardSetting
2799  {
2800  fillSelections();
2802  };
2803 
2805  clearSelections();
2806  addSelection(QObject::tr("(None)"), "0");
2808  };
2809 };
2810 
2812 {
2813  public:
2814  InputGroup(const CardInput &parent, uint group_num) :
2815  m_cardInput(parent),
2816  m_groupNum(group_num)
2817  {
2818  setLabel(QObject::tr("Input group") +
2819  QString(" %1").arg(m_groupNum + 1));
2820  setHelpText(QObject::tr(
2821  "Leave as 'Generic' unless this input is shared with "
2822  "another device. Only one of the inputs in an input "
2823  "group will be allowed to record at any given time."));
2824  }
2825 
2826  void Load(void) override; // StandardSetting
2827 
2828  void Save(void) override // StandardSetting
2829  {
2830  uint inputid = m_cardInput.getInputID();
2831  uint new_groupid = getValue().toUInt();
2832 
2833  if (m_groupId)
2835 
2836  if (new_groupid)
2837  {
2838  if (CardUtil::UnlinkInputGroup(inputid, new_groupid))
2839  CardUtil::LinkInputGroup(inputid, new_groupid);
2840  }
2841  }
2842 
2843  virtual void Save(const QString& /*destination*/) { Save(); }
2844 
2845  private:
2849 };
2850 
2852 {
2853 #if 0
2854  LOG(VB_GENERAL, LOG_DEBUG, QString("InputGroup::Load() %1 %2")
2856 #endif
2857 
2858  uint inputid = m_cardInput.getInputID();
2859  QMap<uint, uint> grpcnt;
2860  vector<QString> names;
2861  vector<uint> grpid;
2862  vector<uint> selected_groupids;
2863 
2864  names.push_back(QObject::tr("Generic"));
2865  grpid.push_back(0);
2866  grpcnt[0]++;
2867 
2869  query.prepare(
2870  "SELECT cardinputid, inputgroupid, inputgroupname "
2871  "FROM inputgroup "
2872  "WHERE inputgroupname LIKE 'user:%' "
2873  "ORDER BY inputgroupid, cardinputid, inputgroupname");
2874 
2875  if (!query.exec())
2876  {
2877  MythDB::DBError("InputGroup::Load()", query);
2878  }
2879  else
2880  {
2881  while (query.next())
2882  {
2883  uint groupid = query.value(1).toUInt();
2884  if ((inputid != 0U) && (query.value(0).toUInt() == inputid))
2885  selected_groupids.push_back(groupid);
2886 
2887  grpcnt[groupid]++;
2888 
2889  if (grpcnt[groupid] == 1)
2890  {
2891  names.push_back(query.value(2).toString().mid(5, -1));
2892  grpid.push_back(groupid);
2893  }
2894  }
2895  }
2896 
2897  // makes sure we select something
2898  m_groupId = 0;
2899  if (m_groupNum < selected_groupids.size())
2900  m_groupId = selected_groupids[m_groupNum];
2901 
2902 #if 0
2903  LOG(VB_GENERAL, LOG_DEBUG, QString("Group num: %1 id: %2")
2905  {
2906  QString msg;
2907  for (uint i = 0; i < selected_groupids.size(); i++)
2908  msg += QString("%1 ").arg(selected_groupids[i]);
2909  LOG(VB_GENERAL, LOG_DEBUG, msg);
2910  }
2911 #endif
2912 
2913  // add selections to combobox
2914  clearSelections();
2915  uint index = 0;
2916  for (size_t i = 0; i < names.size(); i++)
2917  {
2918  bool sel = (m_groupId == grpid[i]);
2919  index = (sel) ? i : index;
2920 
2921 #if 0
2922  LOG(VB_GENERAL, LOG_DEBUG, QString("grpid %1, name '%2', i %3, s %4")
2923  .arg(grpid[i]).arg(names[i]) .arg(index).arg(sel ? "T" : "F"));
2924 #endif
2925 
2926  addSelection(names[i], QString::number(grpid[i]), sel);
2927  }
2928 
2929 #if 0
2930  LOG(VB_GENERAL, LOG_DEBUG, QString("Group index: %1").arg(index));
2931 #endif
2932 
2933  if (!names.empty())
2934  setValue(index);
2935 
2937 }
2938 
2940 {
2941  public:
2942  explicit QuickTune(const CardInput &parent) :
2943  CardInputComboBoxSetting(parent, "quicktune")
2944  {
2945  setLabel(QObject::tr("Use quick tuning"));
2946  addSelection(QObject::tr("Never"), "0", true);
2947  addSelection(QObject::tr("Live TV only"), "1", false);
2948  addSelection(QObject::tr("Always"), "2", false);
2949  setHelpText(QObject::tr(
2950  "If enabled, MythTV will tune using only the "
2951  "MPEG program number. The program numbers "
2952  "change more often than DVB or ATSC tuning "
2953  "parameters, so this is slightly less reliable. "
2954  "This will also inhibit EIT gathering during "
2955  "Live TV and recording."));
2956  };
2957 };
2958 
2960 {
2961  public:
2962  explicit ExternalChannelCommand(const CardInput &parent) :
2963  MythUITextEditSetting(new CardInputDBStorage(this, parent, "externalcommand"))
2964  {
2965  setLabel(QObject::tr("External channel change command"));
2966  setValue("");
2967  setHelpText(QObject::tr("If specified, this command will be run to "
2968  "change the channel for inputs which have an external "
2969  "tuner device such as a cable box. The first argument "
2970  "will be the channel number."));
2971  };
2972 };
2973 
2975 {
2976  public:
2977  explicit PresetTuner(const CardInput &parent) :
2978  MythUITextEditSetting(new CardInputDBStorage(this, parent, "tunechan"))
2979  {
2980  setLabel(QObject::tr("Preset tuner to channel"));
2981  setValue("");
2982  setHelpText(QObject::tr("Leave this blank unless you have an external "
2983  "tuner that is connected to the tuner input of your card. "
2984  "If so, you will need to specify the preset channel for "
2985  "the signal (normally 3 or 4)."));
2986  };
2987 };
2988 
2989 void StartingChannel::SetSourceID(const QString &sourceid)
2990 {
2991  clearSelections();
2992  if (sourceid.isEmpty() || !sourceid.toUInt())
2993  return;
2994 
2995  // Get the existing starting channel
2996  auto *storage = dynamic_cast<CardInputDBStorage*>(GetStorage());
2997  if (storage == nullptr)
2998  return;
2999  int inputId = storage->getInputID();
3000  QString startChan = CardUtil::GetStartingChannel(inputId);
3001 
3002  ChannelInfoList channels = ChannelUtil::GetAllChannels(sourceid.toUInt());
3003 
3004  if (channels.empty())
3005  {
3006  addSelection(tr("Please add channels to this source"),
3007  startChan.isEmpty() ? "0" : startChan);
3008  return;
3009  }
3010 
3011  // If there are channels sort them, then add theme
3012  // (selecting the old start channel if it is there).
3013  QString order = gCoreContext->GetSetting("ChannelOrdering", "channum");
3014  ChannelUtil::SortChannels(channels, order);
3015  bool has_visible = false;
3016  for (size_t i = 0; i < channels.size() && !has_visible; i++)
3017  has_visible |= channels[i].m_visible;
3018 
3019  for (auto & channel : channels)
3020  {
3021  const QString channum = channel.m_chanNum;
3022  bool sel = channum == startChan;
3023  if (!has_visible || channel.m_visible || sel)
3024  {
3025  addSelection(channum, channum, sel);
3026  }
3027  }
3028 }
3029 
3031 {
3032  public:
3033  explicit InputPriority(const CardInput &parent) :
3034  MythUISpinBoxSetting(new CardInputDBStorage(this, parent, "recpriority"),
3035  -99, 99, 1)
3036  {
3037  setLabel(QObject::tr("Input priority"));
3038  setValue(0);
3039  setHelpText(QObject::tr("If the input priority is not equal for "
3040  "all inputs, the scheduler may choose to record a show "
3041  "at a later time so that it can record on an input with "
3042  "a higher value."));
3043  };
3044 };
3045 
3047 {
3048  public:
3049  ScheduleOrder(const CardInput &parent, int _value) :
3050  MythUISpinBoxSetting(new CardInputDBStorage(this, parent, "schedorder"),
3051  0, 99, 1)
3052  {
3053  setLabel(QObject::tr("Schedule order"));
3054  setValue(_value);
3055  setHelpText(QObject::tr("If priorities and other factors are equal "
3056  "the scheduler will choose the available "
3057  "input with the lowest, non-zero value. "
3058  "Setting this value to zero will make the "
3059  "input unavailable to the scheduler."));
3060  };
3061 };
3062 
3064 {
3065  public:
3066  LiveTVOrder(const CardInput &parent, int _value) :
3067  MythUISpinBoxSetting(new CardInputDBStorage(this, parent, "livetvorder"),
3068  0, 99, 1)
3069  {
3070  setLabel(QObject::tr("Live TV order"));
3071  setValue(_value);
3072  setHelpText(QObject::tr("When entering Live TV, the available, local "
3073  "input with the lowest, non-zero value will "
3074  "be used. If no local inputs are available, "
3075  "the available, remote input with the lowest, "
3076  "non-zero value will be used. "
3077  "Setting this value to zero will make the "
3078  "input unavailable to live TV."));
3079  };
3080 };
3081 
3083 {
3084  public:
3085  explicit DishNetEIT(const CardInput &parent) :
3086  MythUICheckBoxSetting(new CardInputDBStorage(this, parent,
3087  "dishnet_eit"))
3088  {
3089  setLabel(QObject::tr("Use DishNet long-term EIT data"));
3090  setValue(false);
3091  setHelpText(
3092  QObject::tr(
3093  "If you point your satellite dish toward DishNet's birds, "
3094  "you may wish to enable this feature. For best results, "
3095  "enable general EIT collection as well."));
3096  };
3097 };
3098 
3099 CardInput::CardInput(const QString & cardtype, const QString & device,
3100  int _cardid) :
3101  m_id(new ID()),
3102  m_inputName(new InputName(*this)),
3103  m_sourceId(new SourceID(*this)),
3104  m_startChan(new StartingChannel(*this)),
3105  m_scan(new ButtonStandardSetting(tr("Scan for channels"))),
3106  m_srcFetch(new ButtonStandardSetting(tr("Fetch channels from listings source"))),
3107  m_externalInputSettings(new DiSEqCDevSettings()),
3108  m_inputGrp0(new InputGroup(*this, 0)),
3109  m_inputGrp1(new InputGroup(*this, 1))
3110 {
3111  addChild(m_id);
3112 
3114  {
3116  _cardid, true));
3117  }
3118 
3119  // Delivery system for DVB, input name for other,
3120  // same field capturecard/inputname for both
3121  if ("DVB" == cardtype)
3122  {
3123  auto *ds = new DeliverySystem();
3124  ds->setValue(CardUtil::GetDeliverySystemFromDB(_cardid));
3125  addChild(ds);
3126  }
3127  else
3128  {
3130  }
3131  addChild(new InputDisplayName(*this));
3133 
3134  if (CardUtil::IsEncoder(cardtype) || CardUtil::IsUnscanable(cardtype))
3135  {
3136  addChild(new ExternalChannelCommand(*this));
3137  if (CardUtil::HasTuner(cardtype, device))
3138  addChild(new PresetTuner(*this));
3139  }
3140  else
3141  {
3142  addChild(new QuickTune(*this));
3143  if ("DVB" == cardtype)
3144  addChild(new DishNetEIT(*this));
3145  }
3146 
3148  tr("Use channel scanner to find channels for this input."));
3149 
3151  tr("This uses the listings data source to "
3152  "provide the channels for this input.") + " " +
3153  tr("This can take a long time to run."));
3154 
3155  addChild(m_scan);
3157 
3159 
3160  auto *interact = new GroupSetting();
3161 
3162  interact->setLabel(QObject::tr("Interactions between inputs"));
3163  if (CardUtil::IsTunerSharingCapable(cardtype))
3164  {
3165  m_instanceCount = new InstanceCount(*this);
3166  interact->addChild(m_instanceCount);
3167  m_schedGroup = new SchedGroup(*this);
3168  interact->addChild(m_schedGroup);
3169  }
3170  interact->addChild(new InputPriority(*this));
3171  interact->addChild(new ScheduleOrder(*this, _cardid));
3172  interact->addChild(new LiveTVOrder(*this, _cardid));
3173 
3174  auto *ingrpbtn =
3175  new ButtonStandardSetting(QObject::tr("Create a New Input Group"));
3176  ingrpbtn->setHelpText(
3177  QObject::tr("Input groups are only needed when two or more cards "
3178  "share the same resource such as a FireWire card and "
3179  "an analog card input controlling the same set top box."));
3180  interact->addChild(ingrpbtn);
3181  interact->addChild(m_inputGrp0);
3182  interact->addChild(m_inputGrp1);
3183 
3184  addChild(interact);
3185 
3186  setObjectName("CardInput");
3187  SetSourceID("-1");
3188 
3189  connect(m_scan, SIGNAL(clicked()), SLOT(channelScanner()));
3190  connect(m_srcFetch, SIGNAL(clicked()), SLOT(sourceFetch()));
3191  connect(m_sourceId, SIGNAL(valueChanged(const QString&)),
3192  m_startChan,SLOT( SetSourceID (const QString&)));
3193  connect(m_sourceId, SIGNAL(valueChanged(const QString&)),
3194  this, SLOT( SetSourceID (const QString&)));
3195  connect(ingrpbtn, SIGNAL(clicked()),
3196  this, SLOT( CreateNewInputGroup()));
3197 }
3198 
3200 {
3202  {
3203  delete m_externalInputSettings;
3204  m_externalInputSettings = nullptr;
3205  }
3206 }
3207 
3208 void CardInput::SetSourceID(const QString &sourceid)
3209 {
3210  uint cid = m_id->getValue().toUInt();
3211  QString raw_card_type = CardUtil::GetRawInputType(cid);
3212  bool enable = (sourceid.toInt() > 0);
3213  m_scan->setEnabled(enable && !raw_card_type.isEmpty() &&
3214  !CardUtil::IsUnscanable(raw_card_type));
3215  m_srcFetch->setEnabled(enable);
3216 }
3217 
3218 QString CardInput::getSourceName(void) const
3219 {
3220  return m_sourceId->getValueLabel();
3221 }
3222 
3224 {
3225  m_inputGrp0->Save();
3226  m_inputGrp1->Save();
3227 
3228  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
3229  auto *settingdialog =
3230  new MythTextInputDialog(popupStack, tr("Enter new group name"));
3231 
3232  if (settingdialog->Create())
3233  {
3234  connect(settingdialog, SIGNAL(haveResult(QString)),
3235  SLOT(CreateNewInputGroupSlot(const QString&)));
3236  popupStack->AddScreen(settingdialog);
3237  }
3238  else
3239  delete settingdialog;
3240 }
3241 
3242 void CardInput::CreateNewInputGroupSlot(const QString& name)
3243 {
3244  if (name.isEmpty())
3245  {
3246  ShowOkPopup(tr("Sorry, this Input Group name cannot be blank."));
3247  return;
3248  }
3249 
3250  QString new_name = QString("user:") + name;
3251 
3253  query.prepare("SELECT inputgroupname "
3254  "FROM inputgroup "
3255  "WHERE inputgroupname = :GROUPNAME");
3256  query.bindValue(":GROUPNAME", new_name);
3257 
3258  if (!query.exec())
3259  {
3260  MythDB::DBError("CreateNewInputGroup 1", query);
3261  return;
3262  }
3263 
3264  if (query.next())
3265  {
3266  ShowOkPopup(tr("Sorry, this Input Group name is already in use."));
3267  return;
3268  }
3269 
3270  uint inputgroupid = CardUtil::CreateInputGroup(new_name);
3271 
3272  m_inputGrp0->Load();
3273  m_inputGrp1->Load();
3274 
3275  if (m_inputGrp0->getValue().toUInt() == 0U)
3276  {
3278  m_inputGrp0->getValueIndex(QString::number(inputgroupid)));
3279  }
3280  else
3281  {
3283  m_inputGrp1->getValueIndex(QString::number(inputgroupid)));
3284  }
3285 }
3286 
3288 {
3289  uint srcid = m_sourceId->getValue().toUInt();
3290  uint crdid = m_id->getValue().toUInt();
3291  QString in = m_inputName->getValue();
3292 
3293 #ifdef USING_BACKEND
3294  uint num_channels_before = SourceUtil::GetChannelCount(srcid);
3295 
3296  Save(); // save info for scanner.
3297 
3298  QString cardtype = CardUtil::GetRawInputType(crdid);
3299  if (CardUtil::IsUnscanable(cardtype))
3300  {
3301  LOG(VB_GENERAL, LOG_ERR,
3302  QString("Sorry, %1 cards do not yet support scanning.")
3303  .arg(cardtype));
3304  return;
3305  }
3306 
3308  auto *ssd = new StandardSettingDialog(mainStack, "generalsettings",
3309  new ScanWizard(srcid, crdid, in));
3310 
3311  if (ssd->Create())
3312  {
3313  connect(ssd, &StandardSettingDialog::Exiting,
3314  [=]()
3315  {
3316  if (SourceUtil::GetChannelCount(srcid))
3317  m_startChan->SetSourceID(QString::number(srcid));
3318  if (num_channels_before)
3319  {
3320  m_startChan->Load();
3321  m_startChan->Save();
3322  }
3323  });
3324  mainStack->AddScreen(ssd);
3325  }
3326  else
3327  delete ssd;
3328 
3329 #else
3330  LOG(VB_GENERAL, LOG_ERR, "You must compile the backend "
3331  "to be able to scan for channels");
3332 #endif
3333 }
3334 
3336 {
3337  uint srcid = m_sourceId->getValue().toUInt();
3338  uint crdid = m_id->getValue().toUInt();
3339 
3340  uint num_channels_before = SourceUtil::GetChannelCount(srcid);
3341 
3342  if (crdid && srcid)
3343  {
3344  Save(); // save info for fetch..
3345 
3346  QString cardtype = CardUtil::GetRawInputType(crdid);
3347 
3348  if (!CardUtil::IsCableCardPresent(crdid, cardtype) &&
3349  !CardUtil::IsUnscanable(cardtype) &&
3350  !CardUtil::IsEncoder(cardtype) &&
3351  cardtype != "HDHOMERUN" &&
3352  !num_channels_before)
3353  {
3354  LOG(VB_GENERAL, LOG_ERR, "Skipping channel fetch, you need to "
3355  "scan for channels first.");
3356  return;
3357  }
3358 
3359  SourceUtil::UpdateChannelsFromListings(srcid, cardtype);
3360  }
3361 
3362  if (SourceUtil::GetChannelCount(srcid))
3363  m_startChan->SetSourceID(QString::number(srcid));
3364  if (num_channels_before)
3365  {
3366  m_startChan->Load();
3367  m_startChan->Save();
3368  }
3369 }
3370 
3372 {
3373  QString cardinputidTag(":WHERECARDID");
3374 
3375  QString query("cardid = " + cardinputidTag);
3376 
3377  bindings.insert(cardinputidTag, m_parent.getInputID());
3378 
3379  return query;
3380 }
3381 
3383 {
3384  QString cardinputidTag(":SETCARDID");
3385  QString colTag(":SET" + GetColumnName().toUpper());
3386 
3387  QString query("cardid = " + cardinputidTag + ", " +
3388  GetColumnName() + " = " + colTag);
3389 
3390  bindings.insert(cardinputidTag, m_parent.getInputID());
3391  bindings.insert(colTag, m_user->GetDBValue());
3392 
3393  return query;
3394 }
3395 
3396 void CardInput::loadByID(int inputid)
3397 {
3398  m_id->setValue(inputid);
3399  m_externalInputSettings->Load(inputid);
3401 }
3402 
3403 void CardInput::loadByInput(int _cardid, const QString& _inputname)
3404 {
3406  query.prepare("SELECT cardid FROM capturecard "
3407  "WHERE cardid = :CARDID AND inputname = :INPUTNAME");
3408  query.bindValue(":CARDID", _cardid);
3409  query.bindValue(":INPUTNAME", _inputname);
3410 
3411  if (query.exec() && query.isActive() && query.next())
3412  {
3413  loadByID(query.value(0).toInt());
3414  }
3415 }
3416 
3418 {
3419  uint cardid = m_id->getValue().toUInt();
3422 
3423  uint icount = 1;
3424  if (m_instanceCount)
3425  icount = m_instanceCount->getValue().toUInt();
3426  vector<uint> cardids = CardUtil::GetChildInputIDs(cardid);
3427 
3428  // Delete old clone cards as required.
3429  for (size_t i = cardids.size() + 1;
3430  (i > icount) && !cardids.empty(); --i)
3431  {
3432  CardUtil::DeleteInput(cardids.back());
3433  cardids.pop_back();
3434  }
3435 
3436  // Clone this config to existing clone cards.
3437  for (uint id : cardids)
3438  CardUtil::CloneCard(cardid, id);
3439 
3440  // Create new clone cards as required.
3441  for (size_t i = cardids.size() + 1; i < icount; i++)
3442  {
3443  CardUtil::CloneCard(cardid, 0);
3444  }
3445 
3446  // Delete any unused input groups
3448 }
3449 
3451 {
3452  return m_parent.getInputID();
3453 }
3454 
3456 {
3457  return m_parent.getCardID();
3458 }
3459 
3461 {
3462  emit Clicked(m_value);
3463 }
3464 
3465 void CaptureCardEditor::AddSelection(const QString &label, const char *slot)
3466 {
3467  auto *button = new ButtonStandardSetting(label);
3468  connect(button, SIGNAL(clicked()), slot);
3469  addChild(button);
3470 }
3471 
3473 {
3474  ShowOkPopup(
3475  tr("Are you sure you want to delete "
3476  "ALL capture cards on %1?").arg(gCoreContext->GetHostName()),
3477  this,
3478  SLOT(DeleteAllCaptureCardsOnHost(bool)),
3479  true);
3480 }
3481 
3483 {
3484  ShowOkPopup(
3485  tr("Are you sure you want to delete "
3486  "ALL capture cards?"),
3487  this,
3488  SLOT(DeleteAllCaptureCards(bool)),
3489  true);
3490 }
3491 
3493 {
3494  auto *card = new CaptureCard();
3495  card->setLabel(tr("New capture card"));
3496  card->Load();
3497  addChild(card);
3498  emit settingsChanged(this);
3499 }
3500 
3502 {
3503  if (!doDelete)
3504  return;
3505 
3507  Load();
3508  emit settingsChanged(this);
3509 }
3510 
3512 {
3513  if (!doDelete)
3514  return;
3515 
3516  MSqlQuery cards(MSqlQuery::InitCon());
3517 
3518  cards.prepare(
3519  "SELECT cardid "
3520  "FROM capturecard "
3521  "WHERE hostname = :HOSTNAME");
3522  cards.bindValue(":HOSTNAME", gCoreContext->GetHostName());
3523 
3524  if (!cards.exec() || !cards.isActive())
3525  {
3526  ShowOkPopup(
3527  tr("Error getting list of cards for this host. "
3528  "Unable to delete capturecards for %1")
3530 
3531  MythDB::DBError("Selecting cardids for deletion", cards);
3532  return;
3533  }
3534 
3535  while (cards.next())
3536  CardUtil::DeleteInput(cards.value(0).toUInt());
3537 
3538  Load();
3539  emit settingsChanged(this);
3540 }
3541 
3543 {
3544  setLabel(tr("Capture cards"));
3545 }
3546 
3548 {
3549  clearSettings();
3550  AddSelection(QObject::tr("(New capture card)"), SLOT(AddNewCard()));
3551  AddSelection(QObject::tr("(Delete all capture cards on %1)")
3554  AddSelection(QObject::tr("(Delete all capture cards)"),
3557 }
3558 
3560 {
3561  setLabel(tr("Video sources"));
3562 }
3563 
3565 {
3566  clearSettings();
3567  AddSelection(QObject::tr("(New video source)"), SLOT(NewSource()));
3568  AddSelection(QObject::tr("(Delete all video sources)"),
3569  SLOT(ShowDeleteAllSourcesDialog()));
3572 }
3573 
3574 void VideoSourceEditor::AddSelection(const QString &label, const char* slot)
3575 {
3576  auto *button = new ButtonStandardSetting(label);
3577  connect(button, SIGNAL(clicked()), slot);
3578  addChild(button);
3579 }
3580 
3582 {
3583  ShowOkPopup(
3584  tr("Are you sure you want to delete "
3585  "ALL video sources?"),
3586  this,
3587  SLOT(DeleteAllSources(bool)),
3588  true);
3589 }
3590 
3592 {
3593  if (!doDelete)
3594  return;
3595 
3597  Load();
3598  emit settingsChanged(this);
3599 }
3600 
3602 {
3603  auto *source = new VideoSource();
3604  source->setLabel(tr("New video source"));
3605  source->Load();
3606  addChild(source);
3607  emit settingsChanged(this);
3608 }
3609 
3611 {
3612  setLabel(tr("Input connections"));
3613 }
3614 
3616 {
3617  m_cardInputs.clear();
3618  clearSettings();
3619 
3620  // We do this manually because we want custom labels. If
3621  // SelectSetting provided a facility to edit the labels, we
3622  // could use CaptureCard::fillSelections
3623 
3625  query.prepare(
3626  "SELECT cardid, videodevice, cardtype, inputname "
3627  "FROM capturecard "
3628  "WHERE hostname = :HOSTNAME "
3629  " AND parentid = 0 "
3630  "ORDER BY cardid");
3631  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
3632 
3633  if (!query.exec())
3634  {
3635  MythDB::DBError("CardInputEditor::load", query);
3636  return;
3637  }
3638 
3639  while (query.next())
3640  {
3641  uint cardid = query.value(0).toUInt();
3642  QString videodevice = query.value(1).toString();
3643  QString cardtype = query.value(2).toString();
3644  QString inputname = query.value(3).toString();
3645 
3646  auto *cardinput = new CardInput(cardtype, videodevice, cardid);
3647  cardinput->loadByID(cardid);
3648  QString inputlabel = QString("%1 (%2) -> %3")
3649  .arg(CardUtil::GetDeviceLabel(cardtype, videodevice))
3650  .arg(inputname).arg(cardinput->getSourceName());
3651  m_cardInputs.push_back(cardinput);
3652  cardinput->setLabel(inputlabel);
3653  addChild(cardinput);
3654  }
3655 
3657 }
3658 
3659 #ifdef USING_DVB
3660 static QString remove_chaff(const QString &name)
3661 {
3662  // Trim off some of the chaff.
3663  QString short_name = name;
3664  if (short_name.startsWith("LG Electronics"))
3665  short_name = short_name.right(short_name.length() - 15);
3666  if (short_name.startsWith("Oren"))
3667  short_name = short_name.right(short_name.length() - 5);
3668  if (short_name.startsWith("Nextwave"))
3669  short_name = short_name.right(short_name.length() - 9);
3670  if (short_name.startsWith("frontend", Qt::CaseInsensitive))
3671  short_name = short_name.left(short_name.length() - 9);
3672  if (short_name.endsWith("VSB/QAM"))
3673  short_name = short_name.left(short_name.length() - 8);
3674  if (short_name.endsWith("VSB"))
3675  short_name = short_name.left(short_name.length() - 4);
3676  if (short_name.endsWith("DVB-T"))
3677  short_name = short_name.left(short_name.length() - 6);
3678 
3679  // It would be infinitely better if DVB allowed us to query
3680  // the vendor ID. But instead we have to guess based on the
3681  // demodulator name. This means cards like the Air2PC HD5000
3682  // and DViCO Fusion HDTV cards are not identified correctly.
3683  short_name = short_name.simplified();
3684  if (short_name.startsWith("or51211", Qt::CaseInsensitive))
3685  short_name = "pcHDTV HD-2000";
3686  else if (short_name.startsWith("or51132", Qt::CaseInsensitive))
3687  short_name = "pcHDTV HD-3000";
3688  else if (short_name.startsWith("bcm3510", Qt::CaseInsensitive))
3689  short_name = "Air2PC v1";
3690  else if (short_name.startsWith("nxt2002", Qt::CaseInsensitive) ||
3691  short_name.startsWith("nxt200x", Qt::CaseInsensitive))
3692  short_name = "Air2PC v2";
3693  else if (short_name.startsWith("lgdt3302", Qt::CaseInsensitive))
3694  short_name = "DViCO HDTV3";
3695  else if (short_name.startsWith("lgdt3303", Qt::CaseInsensitive))
3696  short_name = "DViCO v2 or Air2PC v3 or pcHDTV HD-5500";
3697 
3698  return short_name;
3699 }
3700 #endif // USING_DVB
3701 
3702 void DVBConfigurationGroup::reloadDiseqcTree(const QString &videodevice)
3703 {
3704  if (m_diseqcTree)
3705  m_diseqcTree->Load(videodevice);
3706 
3707  if (m_cardType->getValue() == "DVB-S" ||
3708  m_cardType->getValue() == "DVB-S2" )
3709  {
3710  m_diseqcBtn->setVisible(true);
3711  }
3712  else
3713  {
3714  m_diseqcBtn->setVisible(false);
3715  }
3716  emit getParent()->settingsChanged(this);
3717 }
3718 
3719 void DVBConfigurationGroup::probeCard(const QString &videodevice)
3720 {
3721  if (videodevice.isEmpty())
3722  {
3723  m_cardName->setValue("");
3724  m_cardType->setValue("");
3725  return;
3726  }
3727 
3728  if ((m_parent.getCardID() != 0) && m_parent.GetRawCardType() != "DVB")
3729  {
3730  m_cardName->setValue("");
3731  m_cardType->setValue("");
3732  return;
3733  }
3734 
3735 #ifdef USING_DVB
3736  QString frontend_name = CardUtil::ProbeDVBFrontendName(videodevice);
3737  QString subtype = CardUtil::ProbeDVBType(videodevice);
3738 
3739  QString err_open = tr("Could not open card %1").arg(videodevice);
3740  QString err_other = tr("Could not get card info for card %1").arg(videodevice);
3741 
3742  switch (CardUtil::toInputType(subtype))
3743  {
3744  case CardUtil::ERROR_OPEN:
3745  m_cardName->setValue(err_open);
3746  m_cardType->setValue(strerror(errno));
3747  break;
3749  m_cardName->setValue(err_other);
3750  m_cardType->setValue("Unknown error");
3751  break;
3752  case CardUtil::ERROR_PROBE:
3753  m_cardName->setValue(err_other);
3754  m_cardType->setValue(strerror(errno));
3755  break;
3756  case CardUtil::QPSK:
3757  m_cardType->setValue("DVB-S");
3758  m_cardName->setValue(frontend_name);
3759  m_signalTimeout->setValue(7000);
3760  m_channelTimeout->setValue(10000);
3761  break;
3762  case CardUtil::DVBS2:
3763  m_cardType->setValue("DVB-S2");
3764  m_cardName->setValue(frontend_name);
3765  m_signalTimeout->setValue(7000);
3766  m_channelTimeout->setValue(10000);
3767  break;
3768  case CardUtil::QAM:
3769  m_cardType->setValue("DVB-C");
3770  m_cardName->setValue(frontend_name);
3771  m_signalTimeout->setValue(3000);
3772  m_channelTimeout->setValue(6000);
3773  break;
3774  case CardUtil::DVBT2:
3775  m_cardType->setValue("DVB-T2");
3776  m_cardName->setValue(frontend_name);
3777  m_signalTimeout->setValue(3000);
3778  m_channelTimeout->setValue(6000);
3779  break;
3780  case CardUtil::OFDM:
3781  {
3782  m_cardType->setValue("DVB-T");
3783  m_cardName->setValue(frontend_name);
3784  m_signalTimeout->setValue(3000);
3785  m_channelTimeout->setValue(6000);
3786  if (frontend_name.toLower().indexOf("usb") >= 0)
3787  {
3788  m_signalTimeout->setValue(40000);
3789  m_channelTimeout->setValue(42500);
3790  }
3791 
3792  // slow down tuning for buggy drivers
3793  if ((frontend_name == "DiBcom 3000P/M-C DVB-T") ||
3794  (frontend_name ==
3795  "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"))
3796  {
3797  m_tuningDelay->setValue(200);
3798  }
3799 
3800 #if 0 // frontends on hybrid DVB-T/Analog cards
3801  QString short_name = remove_chaff(frontend_name);
3802  m_buttonAnalog->setVisible(
3803  short_name.startsWith("zarlink zl10353",
3804  Qt::CaseInsensitive) ||
3805  short_name.startsWith("wintv hvr 900 m/r: 65008/a1c0",
3806  Qt::CaseInsensitive) ||
3807  short_name.startsWith("philips tda10046h",
3808  Qt::CaseInsensitive));
3809 #endif
3810  }
3811  break;
3812  case CardUtil::ATSC:
3813  {
3814  QString short_name = remove_chaff(frontend_name);
3815  m_cardType->setValue("ATSC");
3816  m_cardName->setValue(short_name);
3817  m_signalTimeout->setValue(2000);
3818  m_channelTimeout->setValue(4000);
3819 
3820  // According to #1779 and #1935 the AverMedia 180 needs
3821  // a 3000 ms signal timeout, at least for QAM tuning.
3822  if (frontend_name == "Nextwave NXT200X VSB/QAM frontend")
3823  {
3824  m_signalTimeout->setValue(3000);
3825  m_channelTimeout->setValue(5500);
3826  }
3827 
3828 #if 0 // frontends on hybrid DVB-T/Analog cards
3829  if (frontend_name.toLower().indexOf("usb") < 0)
3830  {
3831  m_buttonAnalog->setVisible(
3832  short_name.startsWith("pchdtv", Qt::CaseInsensitive) ||
3833  short_name.startsWith("dvico", Qt::CaseInsensitive) ||
3834  short_name.startsWith("nextwave", Qt::CaseInsensitive));
3835  }
3836 #endif
3837  }
3838  break;
3839  default:
3840  break;
3841  }
3842 
3843  // Create selection list of all delivery systems of this card
3844  {
3846  QStringList delsyslist = CardUtil::ProbeDeliverySystems(videodevice);
3847  for (const auto & item : qAsConst(delsyslist))
3848  {
3849  LOG(VB_GENERAL, LOG_DEBUG, QString("DVBCardType: add deliverysystem:%1")
3850  .arg(item));
3851 
3852  m_cardType->addSelection(item, item);
3853  }
3854 
3855  // Default value, used if not already defined in capturecard/inputname
3856  QString delsys = CardUtil::ProbeDefaultDeliverySystem(videodevice);
3857  if (!delsys.isEmpty())
3858  {
3859  m_cardType->setValue(delsys);
3860  }
3861  }
3862 #
3863 #else
3864  m_cardType->setValue(QString("Recompile with DVB-Support!"));
3865 #endif
3866 }
3867 
3869  QString dev, QString type) :
3870  CaptureCardComboBoxSetting(parent, false, "audiodevice"),
3871  m_lastDevice(std::move(dev)), m_lastCardType(std::move(type))
3872 {
3873  setLabel(QObject::tr("Audio input"));
3874  setHelpText(QObject::tr("If there is more than one audio input, "
3875  "select which one to use."));
3876  int cardid = parent.getCardID();
3877  if (cardid <= 0)
3878  return;
3879 
3882 }
3883 
3884 int TunerCardAudioInput::fillSelections(const QString &device)
3885 {
3886  clearSelections();
3887 
3888  if (device.isEmpty())
3889  return 0;
3890 
3891  m_lastDevice = device;
3892  QStringList inputs =
3894 
3895  for (uint i = 0; i < (uint)inputs.size(); i++)
3896  {
3897  addSelection(inputs[i], QString::number(i),
3898  m_lastDevice == QString::number(i));
3899  }
3900  return inputs.size();
3901 }
3902 
3904  CardType& cardType) :
3905  m_parent(a_parent),
3906  m_diseqcTree(new DiSEqCDevTree())
3907 {
3908  setVisible(false);
3909 
3910  m_cardNum = new DVBCardNum(m_parent);
3911  m_cardName = new DVBCardName();
3913 
3914  m_signalTimeout = new SignalTimeout(m_parent, 500, 250);
3915  m_channelTimeout = new ChannelTimeout(m_parent, 3000, 1750);
3916 
3917  cardType.addTargetedChild("DVB", m_cardNum);
3918 
3919  cardType.addTargetedChild("DVB", m_cardName);
3920  cardType.addTargetedChild("DVB", m_cardType);
3921 
3922  cardType.addTargetedChild("DVB", m_signalTimeout);
3923  cardType.addTargetedChild("DVB", m_channelTimeout);
3924 
3925  cardType.addTargetedChild("DVB", new EmptyAudioDevice(m_parent));
3926  cardType.addTargetedChild("DVB", new EmptyVBIDevice(m_parent));
3927 
3928  cardType.addTargetedChild("DVB", new DVBNoSeqStart(m_parent));
3929  cardType.addTargetedChild("DVB", new DVBOnDemand(m_parent));
3930  cardType.addTargetedChild("DVB", new DVBEITScan(m_parent));
3931 
3933  m_diseqcBtn->setLabel(tr("DiSEqC (Switch, LNB and Rotor Configuration)"));
3934  m_diseqcBtn->setHelpText(tr("Input and satellite settings."));
3935 
3937  cardType.addTargetedChild("DVB", m_tuningDelay);
3938  cardType.addTargetedChild("DVB", m_diseqcBtn);
3939  m_tuningDelay->setVisible(false);
3940 
3941  connect(m_cardNum, SIGNAL(valueChanged(const QString&)),
3942  this, SLOT( probeCard (const QString&)));
3943  connect(m_cardNum, SIGNAL(valueChanged(const QString&)),
3944  this, SLOT( reloadDiseqcTree(const QString&)));
3945 }
3946 
3948 {
3949  if (m_diseqcTree)
3950  {
3951  delete m_diseqcTree;
3952  m_diseqcTree = nullptr;
3953  }
3954 }
3955 
3957 {
3959  m_diseqcBtn->Load();
3961  if (m_cardType->getValue() == "DVB-S" ||
3962  m_cardType->getValue() == "DVB-S2" ||
3964  {
3965  m_diseqcBtn->setVisible(true);
3966  }
3967 }
3968 
3970 {
3974 }
HDPVRConfigurationGroup
Definition: videosource.h:460
DVBConfigurationGroup::m_diseqcBtn
DeviceTree * m_diseqcBtn
Definition: videosource.h:598
NoGrabber_config::NoGrabber_config
NoGrabber_config(const VideoSource &_parent)
Definition: videosource.cpp:649
DeviceTree
Definition: diseqcsettings.h:130
VBoxTunerIndex
Definition: videosource.h:866
VideoSourceShow::VideoSourceShow
VideoSourceShow(uint _initial_sourceid)
Definition: videosource.cpp:133
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
ASIConfigurationGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:508
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:204
InputName
Definition: videosource.cpp:2711
HDHomeRunDeviceID::Save
void Save(void) override
Definition: videosource.cpp:1376
SourceID::fillSelections
void fillSelections()
Definition: videosource.cpp:2804
CardInput::m_inputName
InputName * m_inputName
Definition: videosource.h:829
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:783
CardInput::m_inputGrp1
InputGroup * m_inputGrp1
Definition: videosource.h:836
V4L2encGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:487
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
build_compdb.args
args
Definition: build_compdb.py:11
FirewireConfigurationGroup
static void FirewireConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:1327
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:304
MythUIComboBoxSetting::clearSelections
void clearSelections()
Definition: standardsettings.cpp:494
e
QDomElement e
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1417
channel
QDomElement channel
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:498
FirewireModel::SetGUID
void SetGUID(const QString &_guid)
Definition: videosource.cpp:1271
CardUtil::IsInNeedOfExternalInputConf
static bool IsInNeedOfExternalInputConf(uint inputid)
Definition: cardutil.cpp:2114
DVBConfigurationGroup::m_tuningDelay
DVBTuningDelay * m_tuningDelay
Definition: videosource.h:596
SchedGroup::SchedGroup
SchedGroup(const CardInput &parent)
Definition: videosource.cpp:194
HDHomeRunConfigurationGroup::HDHomeRunConfigurationGroup
HDHomeRunConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:1415
MSqlQuery::size
int size(void) const
Definition: mythdbcon.h:203
fileInfo
QFileInfo fileInfo(filename)
doDelete
bool doDelete
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:635
SourceUtil::DeleteSource
static bool DeleteSource(uint sourceid)
Definition: sourceutil.cpp:531
XMLTVGrabber::Save
void Save(void) override
Definition: videosource.cpp:339
FirewireModel::FirewireModel
FirewireModel(const CaptureCard &parent, const FirewireGUID *_guid)
Definition: videosource.cpp:1241
CardInputComboBoxSetting::CardInputComboBoxSetting
CardInputComboBoxSetting(const CardInput &parent, const QString &setting)
Definition: videosource.cpp:2782
SourceID::SourceID
SourceID(const CardInput &parent)
Definition: videosource.cpp:2791
GENERIC_EXIT_OK
#define GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:10
CetonSetting::UpdateDevices
void UpdateDevices(const QString &v)
Definition: videosource.cpp:2044
FreqTableSelector::FreqTableSelector
FreqTableSelector(const VideoSource &parent)
Definition: videosource.cpp:465
V4LConfigurationGroup::m_cardInfo
TransTextEditSetting * m_cardInfo
Definition: videosource.h:436
TransMythUICheckBoxSetting
Definition: standardsettings.h:408
remove_chaff
static QString remove_chaff(const QString &name)
Definition: videosource.cpp:3660
V4L2encGroup::m_driverName
QString m_driverName
Definition: videosource.h:491
TransFreqTableSelector::SetSourceID
void SetSourceID(uint _sourceid)
Definition: videosource.cpp:552
CetonDeviceID::m_tuner
QString m_tuner
Definition: videosource.h:974
DVBNetID
Definition: videosource.cpp:414
MythUIComboBoxSetting::fillSelectionsFromDir
void fillSelectionsFromDir(const QDir &dir, bool absPath=true)
Definition: standardsettings.cpp:586
HDHomeRunConfigurationGroup::GetDeviceCheckBoxes
QString GetDeviceCheckBoxes(void)
Definition: videosource.cpp:1510
CardUtil::GetDeviceInputNames
static void GetDeviceInputNames(const QString &device, const QString &inputtype, QStringList &inputs)
StandardSetting::setValue
virtual void setValue(const QString &newValue)
Definition: standardsettings.cpp:163
VideoSourceEditor::Load
void Load(void) override
Definition: videosource.cpp:3564
VBoxDeviceID::m_tuner
QString m_tuner
Definition: videosource.h:933
VBoxDevice::m_deviceId
QString m_deviceId
Definition: videosource.h:389
error
static void error(const char *str,...)
Definition: vbi.cpp:42
CardUtil::GetDeviceName
static QString GetDeviceName(dvb_dev_type_t type, const QString &device)
V4LConfigurationGroup
Definition: videosource.h:424
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:550
FirewireDesc::m_guid
const FirewireGUID * m_guid
Definition: videosource.h:628
CardInputEditor::CardInputEditor
CardInputEditor()
Definition: videosource.cpp:3610
HDHomeRunEITScan::HDHomeRunEITScan
HDHomeRunEITScan(const CaptureCard &parent)
Definition: videosource.cpp:1385
CardUtil::ProbeDeliverySystems
static QStringList ProbeDeliverySystems(const QString &device)
Definition: cardutil.cpp:571
QuickTune::QuickTune
QuickTune(const CardInput &parent)
Definition: videosource.cpp:2942
MPEGConfigurationGroup
Definition: videosource.h:443
mythdb.h
MythSystemLegacy
Definition: mythsystemlegacy.h:68
CardUtil::GetVideoDevices
static QStringList GetVideoDevices(const QString &rawtype, QString hostname=QString())
Returns the videodevices of the matching inputs, duplicates removed.
Definition: cardutil.cpp:409
CaptureCard::getCardID
int getCardID(void) const
Definition: videosource.h:644
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
CardType::CardType
CardType(const CaptureCard &parent)
Definition: videosource.cpp:2636
CardUtil::ClearVideoDeviceCache
static void ClearVideoDeviceCache()
Definition: cardutil.cpp:454
CetonDeviceID::UpdateValues
void UpdateValues()
Definition: videosource.cpp:2088
XMLTVGrabber
Definition: videosource.cpp:260
VBoxDeviceIDList::m_deviceList
VBoxDeviceList * m_deviceList
Definition: videosource.h:911
InputDisplayName::InputDisplayName
InputDisplayName(const CardInput &parent)
Definition: videosource.cpp:2761
VideoSource
Definition: videosource.h:177
SourceUtil::GetChannelCount
static uint GetChannelCount(uint sourceid)
Definition: sourceutil.cpp:135
CardUtil::toInputType
static enum INPUT_TYPES toInputType(const QString &name)
Definition: cardutil.h:72
DTVDeviceConfigGroup
Definition: diseqcsettings.h:164
DBStorage::m_user
StorageUser * m_user
Definition: mythstorage.h:50
CetonSetting::LoadValue
void LoadValue(const QString &value)
Definition: videosource.cpp:2050
FirewireModel::m_guid
const FirewireGUID * m_guid
Definition: videosource.h:613
CardUtil::ERROR_UNKNOWN
@ ERROR_UNKNOWN
Definition: cardutil.h:49
CardUtil::DVBT2
@ DVBT2
Definition: cardutil.h:68
TransMythUIComboBoxSetting
Definition: standardsettings.h:269
UseEIT
Definition: videosource.cpp:558
UseHDHomeRunDevice::UseHDHomeRunDevice
UseHDHomeRunDevice(QString &deviceid, QString &model, QString &ipaddr)
Definition: videosource.cpp:1402
TransTextEditSetting
Definition: standardsettings.h:158
DishNetEIT
Definition: videosource.cpp:3082
V4L2util::DriverName
QString DriverName(void) const
Definition: v4l2util.h:48
CommandPath
Definition: videosource.cpp:942
XMLTV_generic_config::m_grabber
QString m_grabber
Definition: videosource.h:135
VideoSource::canDelete
bool canDelete(void) override
Definition: videosource.cpp:683
ButtonStandardSetting
Definition: standardsettings.h:447
CetonDeviceID::SetTuner
void SetTuner(const QString &tuner)
Definition: videosource.cpp:2073
VideoSourceEditor::VideoSourceEditor
VideoSourceEditor()
Definition: videosource.cpp:3559
FirewireDevice::GetModelName
static QString GetModelName(uint vendor_id, uint model_id)
Definition: firewiredevice.cpp:351
FirewireDesc
Definition: videosource.h:616
VBoxDeviceIDList::m_parent
const CaptureCard & m_parent
Definition: videosource.h:912
DVBConfigurationGroup::m_signalTimeout
SignalTimeout * m_signalTimeout
Definition: videosource.h:591
EITOnly_config
Definition: videosource.h:139
CardInput::CreateNewInputGroup
void CreateNewInputGroup()
Definition: videosource.cpp:3223
VideoSourceShow::Load
void Load(void) override
Definition: videosource.cpp:144
VideoSourceDBStorage
Definition: videosource.h:41
HDHomeRunConfigurationGroup::SetDeviceCheckBoxes
void SetDeviceCheckBoxes(const QString &devices)
Definition: videosource.cpp:1485
DVBConfigurationGroup::m_diseqcTree
DiSEqCDevTree * m_diseqcTree
Definition: videosource.h:597
XMLTVGrabber::LoadXMLTVGrabbers
void LoadXMLTVGrabbers(QStringList name_list, QStringList prog_list)
Definition: videosource.cpp:352
HDHomeRunConfigurationGroup::m_deviceList
HDHomeRunDeviceList m_deviceList
Definition: videosource.h:366
XMLTV_generic_config::Save
void Save(void) override
Definition: videosource.cpp:596
frequencies.h
CaptureCardDBStorage::GetSetClause
QString GetSetClause(MSqlBindings &bindings) const override
Definition: videosource.cpp:246
ExternalChannelCommand::ExternalChannelCommand
ExternalChannelCommand(const CardInput &parent)
Definition: videosource.cpp:2962
VBoxDeviceID
Definition: videosource.h:917
DVBCardName::DVBCardName
DVBCardName()
Definition: videosource.cpp:1143
VideoDevice
Definition: videosource.cpp:752
VBoxDeviceIDList
Definition: videosource.h:887
DeviceTree::Load
void Load(void) override
Definition: diseqcsettings.cpp:1011
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:198
MythScreenStack
Definition: mythscreenstack.h:15
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:282
arg
arg(title).arg(filename).arg(doDelete))
DVBConfigurationGroup::DVBConfigurationGroup
DVBConfigurationGroup(CaptureCard &a_parent, CardType &cardType)
Definition: videosource.cpp:3903
InstanceCount
Definition: videosource.cpp:171
VBIDevice
Definition: videosource.cpp:868
VBoxDevice::m_tunerType
QString m_tunerType
Definition: videosource.h:393
VideoSourceSelector::VideoSourceSelector
VideoSourceSelector(uint _initial_sourceid, QString _card_types, bool _must_have_mplexid)
Definition: videosource.cpp:64
CaptureCard::m_id
ID * m_id
Definition: videosource.h:682
TransFreqTableSelector::m_loadedFreqTable
QString m_loadedFreqTable
Definition: videosource.h:116
VBoxDevice::m_cardIp
QString m_cardIp
Definition: videosource.h:391
ASIDevice::fillSelections
void fillSelections(const QString &current)
Adds all available cards to list If current is >= 0 it will be considered available even if no device...
Definition: videosource.cpp:1769
DBStorage::GetColumnName
QString GetColumnName(void) const
Definition: mythstorage.h:47
XMLTV_generic_config::XMLTV_generic_config
XMLTV_generic_config(const VideoSource &_parent, const QString &_grabber, StandardSetting *_setting)
Definition: videosource.cpp:572
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
MPEGConfigurationGroup::m_cardInfo
TransTextEditSetting * m_cardInfo
Definition: videosource.h:457
XMLTV_generic_config::m_grabberArgs
QStringList m_grabberArgs
Definition: videosource.h:136
StartingChannel::SetSourceID
void SetSourceID(const QString &sourceid)
Definition: videosource.cpp:2989
StandardSetting::clearSettings
virtual void clearSettings()
Definition: standardsettings.cpp:153
DVBCardType::DVBCardType
DVBCardType(const CaptureCard &parent)
Definition: videosource.cpp:1130
VBoxDeviceID::Load
void Load(void) override
Definition: videosource.cpp:1616
StorageUser::GetDBValue
virtual QString GetDBValue(void) const =0
InputDisplayName::Load
void Load(void) override
Definition: videosource.cpp:2770
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
ASIConfigurationGroup::probeCard
void probeCard(const QString &device)
Definition: videosource.cpp:1856
SourceID
Definition: videosource.cpp:2788
StandardSetting::addTargetedChild
void addTargetedChild(const QString &value, StandardSetting *setting)
Definition: standardsettings.cpp:110
MythSystemLegacy::ReadAll
QByteArray & ReadAll()
Definition: mythsystemlegacy.cpp:397
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
EmptyAudioDevice
Definition: videosource.h:277
CardUtil::GetChildInputIDs
static vector< uint > GetChildInputIDs(uint inputid)
Definition: cardutil.cpp:1339
firewiredevice.h
CardUtil::GetASIDeviceNumber
static int GetASIDeviceNumber(const QString &device, QString *error=nullptr)
AudioRateLimit::AudioRateLimit
AudioRateLimit(const CaptureCard &parent)
Definition: videosource.cpp:1024
GroupSetting::GroupSetting
GroupSetting()=default
CardUtil::GetVBoxdesc
static QString GetVBoxdesc(const QString &id, const QString &ip, const QString &tunerNo, const QString &tunerType)
CaptureCardEditor::Load
void Load(void) override
Definition: videosource.cpp:3547
ASIDevice::ASIDevice
ASIDevice(const CaptureCard &parent)
Definition: videosource.cpp:1759
MythSystemLegacy::Run
void Run(time_t timeout=0)
Runs a command inside the /bin/sh shell. Returns immediately.
Definition: mythsystemlegacy.cpp:212
mythdirs.h
CaptureCardButton::Clicked
void Clicked(const QString &choice)
VBoxDeviceID::SetTuner
void SetTuner(const QString &tuner)
Definition: videosource.cpp:1604
TunerCardAudioInput
Definition: videosource.h:261
DiSEqCDevSettings::Load
bool Load(uint card_input_id)
Loads configuration chain from DB for specified card input id.
Definition: diseqc.cpp:130
ASIConfigurationGroup::m_cardInfo
TransTextEditSetting * m_cardInfo
Definition: videosource.h:510
VideoSourceEditor::ShowDeleteAllSourcesDialog
void ShowDeleteAllSourcesDialog(void)
Definition: videosource.cpp:3581
DVBConfigurationGroup::m_cardName
DVBCardName * m_cardName
Definition: videosource.h:589
ExternalChannelCommand
Definition: videosource.cpp:2959
HTTPRequest::TestMimeType
static QString TestMimeType(const QString &sFileName)
Definition: httprequest.cpp:1063
DVBNoSeqStart::DVBNoSeqStart
DVBNoSeqStart(const CaptureCard &parent)
Definition: videosource.cpp:1156
FileDevice
Definition: videosource.cpp:956
CaptureCardTextEditSetting
Definition: videosource.cpp:390
VBoxDevice
Definition: videosource.h:385
ASIDevice::Load
void Load(void) override
Definition: videosource.cpp:1826
VBoxTunerIndex::setEnabled
void setEnabled(bool e) override
Definition: videosource.cpp:1570
CardUtil::CloneCard
static uint CloneCard(uint src_inputid, uint dst_inputid)
Definition: cardutil.cpp:1516
HDHomeRunDevice::m_deviceId
QString m_deviceId
Definition: videosource.h:340
VBIDevice::setFilter
uint setFilter(const QString &card, const QString &driver)
Definition: videosource.cpp:880
VideoSourceEditor::DeleteAllSources
void DeleteAllSources(bool doDelete)
Definition: videosource.cpp:3591
CardType::fillSelections
static void fillSelections(MythUIComboBoxSetting *setting)
Definition: videosource.cpp:2645
ASIConfigurationGroup
Definition: videosource.h:497
InputGroup::m_cardInput
const CardInput & m_cardInput
Definition: videosource.cpp:2846
DVBConfigurationGroup::probeCard
void probeCard(const QString &videodevice)
Definition: videosource.cpp:3719
CaptureCardDBStorage::m_parent
const CaptureCard & m_parent
Definition: videosource.h:246
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &stackname)
Definition: mythmainwindow.cpp:309
XMLTVGrabber::m_parent
const VideoSource & m_parent
Definition: videosource.cpp:375
FirewireGUID::GetAVCInfo
AVCInfo GetAVCInfo(const QString &guid) const
Definition: videosource.cpp:1234
CardInput::loadByID
void loadByID(int id)
Definition: videosource.cpp:3396
VBoxIP
Definition: videosource.h:845
ScanWizard
Definition: scanwizard.h:44
CardUtil::GetDeviceLabel
static QString GetDeviceLabel(const QString &inputtype, const QString &videodevice)
IPTVHost::IPTVHost
IPTVHost(const CaptureCard &parent)
Definition: videosource.cpp:1738
HDHomeRunDeviceID
Definition: videosource.h:369
NoGrabber_config
Definition: videosource.h:151
VBoxDeviceList
QMap< QString, VBoxDevice > VBoxDeviceList
Definition: videosource.h:398
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
VideoDevice::fillSelectionsFromDir
uint fillSelectionsFromDir(const QDir &dir, uint minor_min, uint minor_max, const QString &card, const QString &driver, bool allow_duplicates)
Definition: videosource.cpp:798
TransFreqTableSelector::Load
void Load(void) override
Definition: videosource.cpp:488
DiSEqCDevTree::Exists
static bool Exists(int cardid)
Check if a Diseqc device tree exists.
Definition: diseqc.cpp:395
CaptureCardEditor::DeleteAllCaptureCards
void DeleteAllCaptureCards(bool doDelete)
Definition: videosource.cpp:3501
AVCInfo
Definition: avcinfo.h:22
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
VideoDevice::VideoDevice
VideoDevice(const CaptureCard &parent, uint minor_min=0, uint minor_max=UINT_MAX, const QString &card=QString(), const QString &driver=QString())
Definition: videosource.cpp:755
DemoConfigurationGroup
Definition: videosource.h:529
scanwizard.h
VBoxConfigurationGroup::FillDeviceList
void FillDeviceList(void)
Definition: videosource.cpp:1986
XMLTV_generic_config::RunConfig
void RunConfig(void)
Definition: videosource.cpp:613
AudioRateLimit
Definition: videosource.cpp:1021
QuickTune
Definition: videosource.cpp:2939
HDHomeRunEITScan
Definition: videosource.cpp:1382
CaptureCard::loadByID
void loadByID(int id)
Definition: videosource.cpp:2569
VBoxDevice::m_discovered
bool m_discovered
Definition: videosource.h:395
close
#define close
Definition: compat.h:16
CaptureCardEditor::AddSelection
void AddSelection(const QString &label, const char *slot)
Definition: videosource.cpp:3465
tmp
static guint32 * tmp
Definition: goom_core.cpp:30
VideoSourceDBStorage::m_parent
const VideoSource & m_parent
Definition: videosource.h:55
EITOnly_config::Save
void Save(void) override
Definition: videosource.cpp:642
DVBEITScan
Definition: videosource.cpp:1183
CardInputDBStorage::GetWhereClause
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: videosource.cpp:3371
mythsystemlegacy.h
CardInput::m_srcFetch
ButtonStandardSetting * m_srcFetch
Definition: videosource.h:833
CaptureCardDBStorage::getCardID
int getCardID(void) const
Definition: videosource.cpp:3455
CardUtil::ProbeDefaultDeliverySystem
static QString ProbeDefaultDeliverySystem(const QString &device)
Definition: cardutil.cpp:650
V4LConfigurationGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:435
MPEGConfigurationGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:454
CardUtil::ProbeDVBType
static QString ProbeDVBType(const QString &device)
Definition: cardutil.cpp:668
ChannelUtil::SortChannels
static void SortChannels(ChannelInfoList &list, const QString &order, bool eliminate_duplicates=false)
Definition: channelutil.cpp:2282
ImportConfigurationGroup::m_size
GroupSetting * m_size
Definition: videosource.h:526
DemoConfigurationGroup::m_size
GroupSetting * m_size
Definition: videosource.h:542
TunerCardAudioInput::TunerCardAudioInput
TunerCardAudioInput(const CaptureCard &parent, QString dev=QString(), QString type=QString())
Definition: videosource.cpp:3868
DVBNetID::DVBNetID
DVBNetID(const VideoSource &parent, signed int value, signed int min_val)
Definition: videosource.cpp:417
CardUtil::ProbeVideoDevices
static QStringList ProbeVideoDevices(const QString &rawtype)
Definition: cardutil.cpp:460
DiSEqCDevSettings
DVB-S device settings class.
Definition: diseqc.h:35
DVBTuningDelay::DVBTuningDelay
DVBTuningDelay(const CaptureCard &parent)
Definition: videosource.cpp:1202
CetonDeviceID::SetIP
void SetIP(const QString &ip)
Definition: videosource.cpp:2063
CardUtil::ProbeDVBFrontendName
static QString ProbeDVBFrontendName(const QString &device)
Returns the input type from the video device.
Definition: cardutil.cpp:689
VideoDevice::Driver
QString Driver(void) const
Definition: videosource.cpp:859
VBoxDevice::m_inUse
bool m_inUse
Definition: videosource.h:394
VBoxDeviceIDList::m_cardIp
VBoxIP * m_cardIp
Definition: videosource.h:909
InputName::fillSelections
void fillSelections()
Definition: videosource.cpp:2726
HDHomeRunDevice
Definition: videosource.h:337
StandardSetting::settingsChanged
void settingsChanged(StandardSetting *selectedSetting=nullptr)
StandardSettingDialog
Definition: standardsettings.h:465
StandardSetting::addChild
virtual void addChild(StandardSetting *child)
Definition: standardsettings.cpp:64
V4L2encGroup
Definition: videosource.h:479
CardUtil::DVBS2
@ DVBS2
Definition: cardutil.h:61
VideoSourceDBStorage::GetSetClause
QString GetSetClause(MSqlBindings &bindings) const override
Definition: videosource.cpp:221
if
if(query.exec() &&query.next())
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:458
StandardSetting::GetStorage
Storage * GetStorage(void) const
Definition: standardsettings.h:78
sourceutil.h
InputName::Load
void Load(void) override
Definition: videosource.cpp:2720
SourceUtil::UpdateChannelsFromListings
static bool UpdateChannelsFromListings(uint sourceid, const QString &inputtype=QString(), bool wait=false)
Definition: sourceutil.cpp:403
VideoSourceEditor::AddSelection
void AddSelection(const QString &label, const char *slot)
Definition: videosource.cpp:3574
CardInputDBStorage::getInputID
int getInputID(void) const
Definition: videosource.cpp:3450
FirewireDevice::GetSTBList
static vector< AVCInfo > GetSTBList(void)
Definition: firewiredevice.cpp:364
CardUtil::UnlinkInputGroup
static bool UnlinkInputGroup(uint inputid, uint inputgroupid)
Definition: cardutil.cpp:1967
ImportConfigurationGroup::probeCard
void probeCard(const QString &device)
Definition: videosource.cpp:1914
minor
#define minor(X)
Definition: compat.h:138
XMLTV_generic_config
Definition: videosource.h:119
CardUtil::QPSK
@ QPSK
Definition: cardutil.h:51
VBoxDeviceID::VBoxDeviceID
VBoxDeviceID(const CaptureCard &parent)
Definition: videosource.cpp:1590
VBoxTunerIndex::VBoxTunerIndex
VBoxTunerIndex()
Definition: videosource.cpp:1561
dvbtypes.h
MPEGConfigurationGroup::m_vbiDevice
VBIDevice * m_vbiDevice
Definition: videosource.h:456
mythlogging.h
RegionID
Definition: videosource.cpp:448
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:224
StandardSetting::getSubSettings
virtual QList< StandardSetting * > * getSubSettings()
Definition: standardsettings.cpp:139
ScheduleOrder::ScheduleOrder
ScheduleOrder(const CardInput &parent, int _value)
Definition: videosource.cpp:3049
DVBCardName
Definition: videosource.cpp:1140
MythUIComboBoxSetting
Definition: standardsettings.h:215
CardUtil::IsEncoder
static bool IsEncoder(const QString &rawtype)
Definition: cardutil.h:127
FreqTableSelector
Definition: videosource.h:92
ImportConfigurationGroup::ImportConfigurationGroup
ImportConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:1887
CardUtil::GetV4LInfo
static bool GetV4LInfo(int videofd, QString &input, QString &driver, uint32_t &version, uint32_t &capabilities)
Definition: cardutil.cpp:2159
InputGroup::Save
void Save(void) override
Definition: videosource.cpp:2828
CardInput::Save
void Save(void) override
Definition: videosource.cpp:3417
AudioDevice::AudioDevice
AudioDevice(const CaptureCard &parent)
Definition: videosource.cpp:971
HDPVRConfigurationGroup::HDPVRConfigurationGroup
HDPVRConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:2328
CardInput::CreateNewInputGroupSlot
void CreateNewInputGroupSlot(const QString &name)
Definition: videosource.cpp:3242
DemoConfigurationGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:540
v4l2util.h
CardUtil::DeleteInput
static bool DeleteInput(uint inputid)
V4LConfigurationGroup::m_vbiDev
VBIDevice * m_vbiDev
Definition: videosource.h:437
CaptureCardButton::edit
void edit(MythScreenType *screen) override
Definition: videosource.cpp:3460
ASIConfigurationGroup::ASIConfigurationGroup
ASIConfigurationGroup(CaptureCard &parent, CardType &cardType)
Definition: videosource.cpp:1835
V4L2util::HasSlicedVBI
bool HasSlicedVBI(void) const
CardUtil::CreateDeviceInputGroup
static uint CreateDeviceInputGroup(uint inputid, const QString &type, const QString &host, const QString &device)
Definition: cardutil.cpp:1890
HDHomeRunDeviceID::HDHomeRunDeviceID
HDHomeRunDeviceID(const CaptureCard &parent, HDHomeRunConfigurationGroup &_group)
Definition: videosource.cpp:1361
BouquetID
Definition: videosource.cpp:431
CaptureCardSpinBoxSetting::CaptureCardSpinBoxSetting
CaptureCardSpinBoxSetting(const CaptureCard &parent, uint min_val, uint max_val, uint step, const QString &setting)
Definition: videosource.cpp:381
Storage::Load
virtual void Load(void)=0
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
compat.h
StandardSetting::getParent
StandardSetting * getParent() const
Definition: standardsettings.h:48
HDPVRConfigurationGroup::probeCard
void probeCard(const QString &device)
Definition: videosource.cpp:2353
VBoxIP::setEnabled
void setEnabled(bool e) override
Definition: videosource.cpp:1540
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:179
VideoSource::m_name
Name * m_name
Definition: videosource.h:227
CardUtil::QAM
@ QAM
Definition: cardutil.h:52
CetonConfigurationGroup
static void CetonConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:2099
PresetTuner
Definition: videosource.cpp:2974
CetonSetting::CetonSetting
CetonSetting(const char *label, const char *helptext)
Definition: videosource.cpp:2036
HDHomeRunDevice::m_checkbox
UseHDHomeRunDevice * m_checkbox
Definition: videosource.h:343
VBoxDeviceIDList::fillSelections
void fillSelections(const QString &current)
Adds all available device-tuner combinations to list.
Definition: videosource.cpp:1650
StandardSetting::Load
virtual void Load(void)
Definition: standardsettings.cpp:208
CaptureCard::Save
void Save(void) override
Definition: videosource.cpp:2586
SourceID::Load
void Load(void) override
Definition: videosource.cpp:2798
CardInput::m_inputGrp0
InputGroup * m_inputGrp0
Definition: videosource.h:835
VideoSourceSelector::m_mustHaveMplexId
bool m_mustHaveMplexId
Definition: videosource.h:74
FirewireGUID::m_guidToAvcInfo
QMap< QString, AVCInfo > m_guidToAvcInfo
Definition: videosource.cpp:1238
VBoxConfigurationGroup
Definition: videosource.h:404
AudioDevice
Definition: videosource.cpp:968
HDHomeRunDeviceID::Load
void Load(void) override
Definition: videosource.cpp:1370
NoGrabber_config::m_useEit
UseEIT * m_useEit
Definition: videosource.h:160
StandardSetting::setHelpText
virtual void setHelpText(const QString &str)
Definition: standardsettings.h:37
V4LConfigurationGroup::probeCard
void probeCard(const QString &device)
Definition: videosource.cpp:2154
ScanFrequency
Definition: channelscanmiscsettings.h:231
is_grabber_external
static bool is_grabber_external(const QString &grabber)
Definition: videosource.h:29
CardUtil::GetAudioDevice
static QString GetAudioDevice(uint inputid)
Definition: cardutil.h:281
vboxutils.h
CaptureCard
Definition: videosource.h:638
EmptyVBIDevice
Definition: videosource.h:302
FirewireConnection
Definition: videosource.cpp:1298
DiSEqCDevTree::Load
bool Load(const QString &device)
Loads the device tree from the database.
Definition: diseqc.cpp:313
CaptureCard::ID
Definition: videosource.h:660
HDHomeRunDevice::m_model
QString m_model
Definition: videosource.h:341
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:634
CardInputComboBoxSetting
Definition: videosource.cpp:2779
MythUIComboBoxSetting::getValueIndex
int getValueIndex(const QString &value) const
Definition: standardsettings.cpp:468
CaptureCardGroup
Definition: videosource.h:631
StandardSetting::Save
virtual void Save(void)
Definition: standardsettings.cpp:227
VBoxDevice::m_mythDeviceId
QString m_mythDeviceId
Definition: videosource.h:388
CardUtil::DeleteAllInputs
static bool DeleteAllInputs(void)
HDPVRConfigurationGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:471
CardUtil::GetDeliverySystemFromDB
static QString GetDeliverySystemFromDB(uint inputid)
Definition: cardutil.h:285
CaptureCardButton::m_value
QString m_value
Definition: videosource.h:724
VideoSource::VideoSource
VideoSource()
Definition: videosource.cpp:667
VBoxIP::UpdateDevices
void UpdateDevices(const QString &v)
Definition: videosource.cpp:1555
CardUtil::HasTuner
static bool HasTuner(const QString &rawtype, const QString &device)
Definition: cardutil.cpp:228
CaptureCardEditor::CaptureCardEditor
CaptureCardEditor()
Definition: videosource.cpp:3542
XMLTVGrabber::XMLTVGrabber
XMLTVGrabber(const VideoSource &parent)
Definition: videosource.cpp:263
mythnotification.h
CaptureCard::CaptureCard
CaptureCard(bool use_card_group=true)
Definition: videosource.cpp:2518
AVCInfo::m_vendorid
uint m_vendorid
Definition: avcinfo.h:49
CardUtil::GetDeviceInputGroup
static uint GetDeviceInputGroup(uint inputid)
Definition: cardutil.cpp:1903
DishNetEIT::DishNetEIT
DishNetEIT(const CardInput &parent)
Definition: videosource.cpp:3085
VBoxDeviceID::SetIP
void SetIP(const QString &ip)
Definition: videosource.cpp:1598
CardInput::ID
Definition: videosource.h:820
StandardSetting::getValue
virtual QString getValue(void) const
Definition: standardsettings.h:51
IPTVHost
Definition: videosource.cpp:1735
AVCInfo::m_product_name
QString m_product_name
Definition: avcinfo.h:52
DemoConfigurationGroup::probeCard
void probeCard(const QString &device)
Definition: videosource.cpp:2248
LiveTVOrder
Definition: videosource.cpp:3063
InputGroup::InputGroup
InputGroup(const CardInput &parent, uint group_num)
Definition: videosource.cpp:2814
CardInput::m_sourceId
SourceID * m_sourceId
Definition: videosource.h:830
CardInput::m_startChan
StartingChannel * m_startChan
Definition: videosource.h:831
ChannelInfoList
vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:133
FirewireSpeed
Definition: videosource.cpp:1311
uint
unsigned int uint
Definition: compat.h:140
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
VBoxTunerIndex::UpdateDevices
void UpdateDevices(const QString &v)
Definition: videosource.cpp:1584
CaptureCardEditor::ShowDeleteAllCaptureCardsDialog
void ShowDeleteAllCaptureCardsDialog(void)
Definition: videosource.cpp:3482
InputGroup
Definition: videosource.cpp:2811
V4L2encGroup::probeCard
void probeCard(const QString &device)
Definition: videosource.cpp:2394
CardInputDBStorage::m_parent
const CardInput & m_parent
Definition: videosource.h:704
IPTVConfigurationGroup
static void IPTVConfigurationGroup(CaptureCard &parent, CardType &cardType)
Definition: videosource.cpp:1748
DVBConfigurationGroup::Save
void Save(void) override
Definition: videosource.cpp:3969
CaptureCard::fillSelections
static void fillSelections(GroupSetting *setting)
Definition: videosource.cpp:2535
V4L2encGroup::m_cardInfo
TransTextEditSetting * m_cardInfo
Definition: videosource.h:488
InstanceCount::InstanceCount
InstanceCount(const CardInput &parent)
Definition: videosource.cpp:174
DVBCardNum::Load
void Load(void) override
Definition: videosource.cpp:1114
DemoConfigurationGroup::m_info
GroupSetting * m_info
Definition: videosource.h:541
FirewireGUID
Definition: videosource.cpp:1216
VideoSourceSelector::m_cardTypes
QString m_cardTypes
Definition: videosource.h:73
CardInput::m_instanceCount
MythUISpinBoxSetting * m_instanceCount
Definition: videosource.h:837
VBoxConfigurationGroup::VBoxConfigurationGroup
VBoxConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:1948
kMSRunShell
@ kMSRunShell
run process through shell
Definition: mythsystem.h:41
VBIDevice::fillSelectionsFromDir
uint fillSelectionsFromDir(const QDir &dir, const QString &card, const QString &driver)
Definition: videosource.cpp:910
DVBConfigurationGroup::Load
void Load(void) override
Definition: videosource.cpp:3956
StandardSetting::setLabel
virtual void setLabel(QString str)
Definition: standardsettings.h:34
channelutil.h
CardInputDBStorage::GetSetClause
QString GetSetClause(MSqlBindings &bindings) const override
Definition: videosource.cpp:3382
VBoxIP::SetOldValue
void SetOldValue(const QString &s)
Definition: videosource.h:853
DVBConfigurationGroup::~DVBConfigurationGroup
~DVBConfigurationGroup() override
Definition: videosource.cpp:3947
CaptureCardSpinBoxSetting
Definition: videosource.cpp:378
VBoxDeviceIDList::Load
void Load(void) override
Definition: videosource.cpp:1698
DVBTuningDelay
Definition: videosource.cpp:1199
CardInput::SetSourceID
void SetSourceID(const QString &sourceid)
Definition: videosource.cpp:3208
StartingChannel
Definition: videosource.h:778
CardInput::~CardInput
~CardInput() override
Definition: videosource.cpp:3199
FirewireModel
Definition: videosource.h:602
CardInput
Definition: videosource.h:796
VBoxDevice::m_desc
QString m_desc
Definition: videosource.h:390
AVCInfo::m_modelid
uint m_modelid
Definition: avcinfo.h:50
CardType
Definition: videosource.h:327
SignalTimeout::SignalTimeout
SignalTimeout(const CaptureCard &parent, uint value, uint min_val)
Definition: videosource.cpp:994
CaptureCardDBStorage::GetWhereClause
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: videosource.cpp:235
InputGroup::Load
void Load(void) override
Definition: videosource.cpp:2851
HDHomeRunConfigurationGroup::FillDeviceList
void FillDeviceList(void)
Definition: videosource.cpp:1445
VBoxDeviceIDList::m_cardTuner
VBoxTunerIndex * m_cardTuner
Definition: videosource.h:910
ASIDevice
Definition: videosource.cpp:1756
gChanLists
const CHANLISTS_vec gChanLists
Definition: frequencies.cpp:2230
channelinfo.h
VBoxDeviceIDList::VBoxDeviceIDList
VBoxDeviceIDList(VBoxDeviceID *deviceid, StandardSetting *desc, VBoxIP *cardip, VBoxTunerIndex *cardtuner, VBoxDeviceList *devicelist, const CaptureCard &parent)
Definition: videosource.cpp:1626
DVBConfigurationGroup::m_cardNum
DVBCardNum * m_cardNum
Definition: videosource.h:588
CardUtil::GetRawInputType
static QString GetRawInputType(uint inputid)
Definition: cardutil.h:277
VideoSource::deleteEntry
void deleteEntry(void) override
Definition: videosource.cpp:688
CaptureCardTextEditSetting::CaptureCardTextEditSetting
CaptureCardTextEditSetting(const CaptureCard &parent, const QString &setting)
Definition: videosource.cpp:393
StandardSetting::valueChanged
void valueChanged(const QString &newValue)
ImportConfigurationGroup
Definition: videosource.h:513
VideoDevice::m_driverName
QString m_driverName
Definition: videosource.cpp:865
lstat
#define lstat
Definition: compat.h:194
TransFreqTableSelector::TransFreqTableSelector
TransFreqTableSelector(uint _sourceid)
Definition: videosource.cpp:479
CaptureCardGroup::CaptureCardGroup
CaptureCardGroup(CaptureCard &parent)
Definition: videosource.cpp:2446
DVBOnDemand
Definition: videosource.cpp:1168
V4LConfigurationGroup::V4LConfigurationGroup
V4LConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:2129
V4L2util::IsOpen
bool IsOpen(void) const
Definition: v4l2util.h:29
StandardSetting::setEnabled
virtual void setEnabled(bool enabled)
Definition: standardsettings.cpp:47
SkipBtAudio::SkipBtAudio
SkipBtAudio(const CaptureCard &parent)
Definition: videosource.cpp:1043
CardUtil::IsCableCardPresent
static bool IsCableCardPresent(uint inputid, const QString &inputType)
Definition: cardutil.cpp:117
MythUIComboBoxSetting::addSelection
void addSelection(const QString &label, QString value=QString(), bool select=false)
Definition: standardsettings.cpp:479
DiSEqCDevSettings::Store
bool Store(uint card_input_id) const
Stores configuration chain to DB for specified card input id.
Definition: diseqc.cpp:164
VideoDevice::fillSelectionsFromDir
void fillSelectionsFromDir(const QDir &dir, bool absPath=true)
Definition: videosource.cpp:790
DiSEqCDev::InvalidateTrees
static void InvalidateTrees(void)
Invalidate cached trees.
Definition: diseqc.cpp:247
ScheduleOrder
Definition: videosource.cpp:3046
MythUITextEditSetting
Definition: standardsettings.h:143
CardInput::sourceFetch
void sourceFetch()
Definition: videosource.cpp:3335
MythUIFileBrowserSetting
Definition: standardsettings.h:184
VideoSource::getSourceID
int getSourceID(void) const
Definition: videosource.h:183
V4L2util
Definition: v4l2util.h:16
CardInput::channelScanner
void channelScanner()
Definition: videosource.cpp:3287
VBoxIP::m_oldValue
QString m_oldValue
Definition: videosource.h:863
DVBCardNum::fillSelections
void fillSelections(const QString &current)
Adds all available cards to list If current is >= 0 it will be considered available even if no device...
Definition: videosource.cpp:1073
mythcorecontext.h
MPEGConfigurationGroup::m_device
VideoDevice * m_device
Definition: videosource.h:455
VideoSource::ID
Definition: videosource.h:207
cardutil.h
CardInput::m_externalInputSettings
DiSEqCDevSettings * m_externalInputSettings
Definition: videosource.h:834
dir
QDir dir
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1171
InputGroup::m_groupId
uint m_groupId
Definition: videosource.cpp:2848
InputName::InputName
InputName(const CardInput &parent)
Definition: videosource.cpp:2714
EITOnly_config::m_useEit
UseEIT * m_useEit
Definition: videosource.h:148
MPEGConfigurationGroup::MPEGConfigurationGroup
MPEGConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:2175
CetonDeviceID::m_ip
QString m_ip
Definition: videosource.h:972
MPEGConfigurationGroup::probeCard
void probeCard(const QString &device)
Definition: videosource.cpp:2200
VideoSourceSelector::Load
void Load(void) override
Definition: videosource.cpp:80
V4L2encGroup::m_device
VideoDevice * m_device
Definition: videosource.h:489
VideoSource::fillSelections
static void fillSelections(GroupSetting *setting)
Definition: videosource.cpp:715
ASIConfigurationGroup::m_device
ASIDevice * m_device
Definition: videosource.h:509
VideoSource::loadByID
void loadByID(int id)
Definition: videosource.cpp:747
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:864
InputDisplayName::m_parent
const CardInput & m_parent
Definition: videosource.cpp:2776
DVBConfigurationGroup::m_channelTimeout
ChannelTimeout * m_channelTimeout
Definition: videosource.h:592
VBoxConfigurationGroup::m_deviceList
VBoxDeviceList m_deviceList
Definition: videosource.h:421
CommandPath::CommandPath
CommandPath(const CaptureCard &parent)
Definition: videosource.cpp:945
V4L2encGroup::V4L2encGroup
V4L2encGroup(CaptureCard &parent, CardType &cardType)
Definition: videosource.cpp:2373
StandardSetting::isEnabled
bool isEnabled() const
Definition: standardsettings.h:45
FirewireSpeed::FirewireSpeed
FirewireSpeed(const CaptureCard &parent)
Definition: videosource.cpp:1314
ScanFrequency::ScanFrequency
ScanFrequency(const VideoSource &parent)
Definition: videosource.cpp:403
VideoSource::m_id
ID * m_id
Definition: videosource.h:226
HDPVRConfigurationGroup::m_cardInfo
GroupSetting * m_cardInfo
Definition: videosource.h:472
CardInput::getSourceName
QString getSourceName(void) const
Definition: videosource.cpp:3218
SkipBtAudio
Definition: videosource.cpp:1040
DeliverySystem
Definition: videosource.cpp:2745
VBoxIP::VBoxIP
VBoxIP()
Definition: videosource.cpp:1531
VBoxDeviceID::SetOverrideDeviceID
void SetOverrideDeviceID(const QString &deviceid)
Definition: videosource.cpp:1610
CaptureCard::deleteEntry
void deleteEntry(void) override
Definition: videosource.cpp:2580
DVBConfigurationGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:586
CaptureCard::reload
void reload(void)
Definition: videosource.cpp:2627
CetonDeviceID::Load
void Load(void) override
Definition: videosource.cpp:2082
HDHomeRunConfigurationGroup
Definition: videosource.h:349
CardInputEditor::Load
void Load(void) override
Definition: videosource.cpp:3615
DVBOnDemand::DVBOnDemand
DVBOnDemand(const CaptureCard &parent)
Definition: videosource.cpp:1171
HDHomeRunDeviceID::m_group
HDHomeRunConfigurationGroup & m_group
Definition: videosource.h:380
VBoxTunerIndex::NewTuner
void NewTuner(const QString &)
InputDisplayName
Definition: videosource.cpp:2758
FirewireDesc::SetGUID
void SetGUID(const QString &_guid)
Definition: videosource.cpp:1282
IdSetting::setValue
void setValue(int value) override
Definition: videosource.h:172
CaptureCardEditor::AddNewCard
void AddNewCard(void)
Definition: videosource.cpp:3492
MythUISpinBoxSetting
Definition: standardsettings.h:325
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:107
DVBCardNum
Definition: videosource.cpp:1055
mythterminal.h
FileDevice::FileDevice
FileDevice(const CaptureCard &parent)
Definition: videosource.cpp:959
SourceUtil::DeleteAllSources
static bool DeleteAllSources(void)
Definition: sourceutil.cpp:577
DVBConfigurationGroup
Definition: videosource.h:567
VBoxIP::NewIP
void NewIP(const QString &)
CardUtil::IsTunerSharingCapable
static bool IsTunerSharingCapable(const QString &rawtype)
Definition: cardutil.h:168
CetonDeviceID::LoadedTuner
void LoadedTuner(const QString &)
InputGroup::Save
virtual void Save(const QString &)
Definition: videosource.cpp:2843
DiSEqCDevTree
DVB-S device tree class. Represents a tree of DVB-S devices.
Definition: diseqc.h:73
CardInput::m_schedGroup
MythUICheckBoxSetting * m_schedGroup
Definition: videosource.h:838
VBoxDeviceID::m_ip
QString m_ip
Definition: videosource.h:932
BouquetID::BouquetID
BouquetID(const VideoSource &parent, signed int value, signed int min_val)
Definition: videosource.cpp:434
build_compdb.help
help
Definition: build_compdb.py:10
VBoxTunerIndex::m_oldValue
QString m_oldValue
Definition: videosource.h:884
TransFreqTableSelector::m_sourceId
uint m_sourceId
Definition: videosource.h:115
MythScreenType::Exiting
void Exiting()
CardUtil::OFDM
@ OFDM
Definition: cardutil.h:53
StandardSetting::m_visible
bool m_visible
Definition: standardsettings.h:114
VBIDevice::fillSelectionsFromDir
void fillSelectionsFromDir(const QDir &dir, bool absPath=true)
Definition: videosource.cpp:902
UseEIT::UseEIT
UseEIT(const VideoSource &parent)
Definition: videosource.cpp:561
CaptureCardComboBoxSetting
Definition: videosource.h:249
VBoxDevice::m_tunerNo
QString m_tunerNo
Definition: videosource.h:392
CetonDeviceID::CetonDeviceID
CetonDeviceID(const CaptureCard &parent)
Definition: videosource.cpp:2055
CaptureCardDBStorage
Definition: videosource.h:230
CardUtil::ProbeAudioInputs
static QStringList ProbeAudioInputs(const QString &device, const QString &inputtype=QString())
StandardSetting::setVisible
void setVisible(bool visible)
Definition: standardsettings.cpp:53
StandardSetting
Definition: standardsettings.h:29
DemoConfigurationGroup::DemoConfigurationGroup
DemoConfigurationGroup(CaptureCard &parent, CardType &cardtype)
Definition: videosource.cpp:2222
SourceUtil::GetListingsLoginData
static bool GetListingsLoginData(uint sourceid, QString &grabber, QString &userid, QString &passwd, QString &lineupid)
Definition: sourceutil.cpp:171
SchedGroup
Definition: videosource.cpp:191
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:841
TransFreqTableSelector::Save
void Save(void) override
Definition: videosource.cpp:525
CardInput::m_scan
ButtonStandardSetting * m_scan
Definition: videosource.h:832
HDPVRConfigurationGroup::m_audioInput
TunerCardAudioInput * m_audioInput
Definition: videosource.h:473
TunerCardAudioInput::m_lastCardType
QString m_lastCardType
Definition: videosource.h:274
DVB_DEV_FRONTEND
@ DVB_DEV_FRONTEND
Definition: cardutil.h:29
DiSEqCDevTree::Store
bool Store(uint cardid, const QString &device="")
Stores the device tree to the database.
Definition: diseqc.cpp:424
CaptureCardEditor::ShowDeleteAllCaptureCardsDialogOnHost
void ShowDeleteAllCaptureCardsDialogOnHost(void)
Definition: videosource.cpp:3472
TunerCardAudioInput::fillSelections
int fillSelections(const QString &device)
Definition: videosource.cpp:3884
DVBEITScan::DVBEITScan
DVBEITScan(const CaptureCard &parent)
Definition: videosource.cpp:1186
MythTerminal
Definition: mythterminal.h:21
HDHomeRunDevice::m_cardIp
QString m_cardIp
Definition: videosource.h:342
RegionID::RegionID
RegionID(const VideoSource &parent, signed int value, signed int min_val)
Definition: videosource.cpp:451
VideoDevice::m_minorList
QMap< uint, uint > m_minorList
Definition: videosource.cpp:863
SignalTimeout
Definition: videosource.cpp:991
CardInput::getInputID
int getInputID(void) const
Definition: videosource.h:804
FirewireGUID::FirewireGUID
FirewireGUID(const CaptureCard &parent)
Definition: videosource.cpp:1219
CetonSetting::NewValue
void NewValue(const QString &)
CaptureCard::canDelete
bool canDelete(void) override
Definition: videosource.cpp:2575
MythUICheckBoxSetting
Definition: standardsettings.h:387
VBoxDeviceIDList::m_deviceId
VBoxDeviceID * m_deviceId
Definition: videosource.h:907
EITOnly_config::EITOnly_config
EITOnly_config(const VideoSource &_parent, StandardSetting *_setting)
Definition: videosource.cpp:625
InputGroup::m_groupNum
uint m_groupNum
Definition: videosource.cpp:2847
CardInput::CardInput
CardInput(const QString &cardtype, const QString &device, int cardid)
Definition: videosource.cpp:3099
MythTextInputDialog
Dialog prompting the user to enter a text string.
Definition: mythdialogbox.h:263
CardUtil::ATSC
@ ATSC
Definition: cardutil.h:54
VBoxDeviceIDList::UpdateDevices
void UpdateDevices(const QString &v)
Definition: videosource.cpp:1707
NoGrabber_config::Save
void Save(void) override
Definition: videosource.cpp:661
VideoSource::Name
Definition: videosource.h:215
VBoxTunerIndex::SetOldValue
void SetOldValue(const QString &s)
Definition: videosource.h:874
VBIDevice::VBIDevice
VBIDevice(const CaptureCard &parent)
Definition: videosource.cpp:871
exitcodes.h
CardUtil::IsUnscanable
static bool IsUnscanable(const QString &rawtype)
Definition: cardutil.h:150
DVBCardNum::DVBCardNum
DVBCardNum(const CaptureCard &parent)
Definition: videosource.cpp:1058
VideoSource::getSourceName
QString getSourceName(void) const
Definition: videosource.h:191
ChannelUtil::GetAllChannels
static ChannelInfoList GetAllChannels(uint sourceid)
Returns channels that are not connected to an input and channels that are not marked as visible.
Definition: channelutil.h:253
PresetTuner::PresetTuner
PresetTuner(const CardInput &parent)
Definition: videosource.cpp:2977
CardInput::m_id
ID * m_id
Definition: videosource.h:828
V4L2util::CardName
QString CardName(void) const
Definition: v4l2util.h:49
VBoxDeviceID::m_overrideDeviceId
QString m_overrideDeviceId
Definition: videosource.h:934
XMLTV_generic_config::m_parent
const VideoSource & m_parent
Definition: videosource.h:134
ChannelTimeout
Definition: videosource.cpp:1005
MythUIComboBoxSetting::getValueLabel
QString getValueLabel(void) const
Definition: standardsettings.cpp:473
MythUICheckBoxSetting::setValue
void setValue(const QString &newValue) override
Definition: standardsettings.cpp:694
VideoSourceEditor::NewSource
void NewSource(void)
Definition: videosource.cpp:3601
UseHDHomeRunDevice
Definition: videosource.cpp:1399
httprequest.h
XMLTVGrabber::Load
void Load(void) override
Definition: videosource.cpp:271
VideoDevice::Card
QString Card(void) const
Definition: videosource.cpp:860
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:49
CardUtil::GetStartingChannel
static QString GetStartingChannel(uint inputid)
Definition: cardutil.cpp:1707
VideoSourceSelector::m_initialSourceId
uint m_initialSourceId
Definition: videosource.h:72
LiveTVOrder::LiveTVOrder
LiveTVOrder(const CardInput &parent, int _value)
Definition: videosource.cpp:3066
query
MSqlQuery query(MSqlQuery::InitCon())
DeliverySystem::DeliverySystem
DeliverySystem()
Definition: videosource.cpp:2748
kMSStdOut
@ kMSStdOut
allow access to stdout
Definition: mythsystem.h:39
CetonDeviceID::LoadedIP
void LoadedIP(const QString &)
CardInputEditor::m_cardInputs
vector< CardInput * > m_cardInputs
Definition: videosource.h:775
ImportConfigurationGroup::m_parent
CaptureCard & m_parent
Definition: videosource.h:524
VBoxDeviceIDList::m_desc
StandardSetting * m_desc
Definition: videosource.h:908
VideoSourceShow::m_initialSourceId
uint m_initialSourceId
Definition: videosource.h:89
CardUtil::CreateInputGroup
static uint CreateInputGroup(const QString &name)
Definition: cardutil.cpp:1848
DVBCardType
Definition: videosource.cpp:1127
CardUtil::LinkInputGroup
static bool LinkInputGroup(uint inputid, uint inputgroupid)
Definition: cardutil.cpp:1927
videosource.h
ImportConfigurationGroup::m_info
GroupSetting * m_info
Definition: videosource.h:525
MythUIComboBoxSetting::setValue
void setValue(int value) override
Definition: standardsettings.cpp:459
CardInputDBStorage
Definition: videosource.h:685
CaptureCard::GetRawCardType
QString GetRawCardType(void) const
Definition: videosource.cpp:2527
VideoSourceDBStorage::GetWhereClause
QString GetWhereClause(MSqlBindings &bindings) const override
Definition: videosource.cpp:210
VBoxDeviceIDList::m_oldValue
QString m_oldValue
Definition: videosource.h:914
TunerCardAudioInput::m_lastDevice
QString m_lastDevice
Definition: videosource.h:273
InputPriority::InputPriority
InputPriority(const CardInput &parent)
Definition: videosource.cpp:3033
CetonSetting
Definition: videosource.h:937
GroupSetting
Definition: standardsettings.h:432
find
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
Definition: dvbstreamhandler.cpp:356
diseqcsettings.h
CardUtil::ERROR_OPEN
@ ERROR_OPEN
Definition: cardutil.h:48
FirewireConnection::FirewireConnection
FirewireConnection(const CaptureCard &parent)
Definition: videosource.cpp:1301
DVBNoSeqStart
Definition: videosource.cpp:1153
CardUtil::GetVideoDevice
static QString GetVideoDevice(uint inputid)
Definition: cardutil.h:279
CetonDeviceID
Definition: videosource.h:952
CaptureCard::Hostname
Definition: videosource.h:668
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:901
VideoSourceEditor::cardTypesInclude
static bool cardTypesInclude(const int &SourceID, const QString &thecardtype)
Definition: videosource.cpp:693
MythSystemLegacy::Wait
uint Wait(time_t timeout=0)
Definition: mythsystemlegacy.cpp:242
InputPriority
Definition: videosource.cpp:3030
ChannelTimeout::ChannelTimeout
ChannelTimeout(const CaptureCard &parent, uint value, uint min_val)
Definition: videosource.cpp:1008
DVBConfigurationGroup::m_cardType
DVBCardType * m_cardType
Definition: videosource.h:590
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:808
VideoDevice::m_cardName
QString m_cardName
Definition: videosource.cpp:864
CardUtil::ERROR_PROBE
@ ERROR_PROBE
Definition: cardutil.h:50
DVBConfigurationGroup::reloadDiseqcTree
void reloadDiseqcTree(const QString &device)
Definition: videosource.cpp:3702
CaptureCardEditor::DeleteAllCaptureCardsOnHost
void DeleteAllCaptureCardsOnHost(bool doDelete)
Definition: videosource.cpp:3511
CardInput::loadByInput
void loadByInput(int cardid, const QString &inputname)
Definition: videosource.cpp:3403