MythTV  master
cetonchannel.cpp
Go to the documentation of this file.
1 
8 // MythTV includes
9 #include "cetonstreamhandler.h"
10 #include "cetonchannel.h"
11 #include "videosource.h"
12 #include "mythlogging.h"
13 #include "channelutil.h"
14 #include "mythdbcon.h"
15 
16 #define LOC QString("CetonChan[%1](%2): ").arg(m_inputid).arg(GetDevice())
17 
18 CetonChannel::CetonChannel(TVRec *parent, const QString &device) :
19  DTVChannel(parent), _device_id(device), _stream_handler(nullptr)
20 {
21 }
22 
24 {
25  Close();
26 }
27 
29 {
30  LOG(VB_CHANNEL, LOG_INFO, LOC + "Opening Ceton channel");
31 
32  if (IsOpen())
33  return true;
34 
36 
38  _tuner_types.push_back(tunerType);
39 
40  if (!InitializeInput())
41  {
42  Close();
43  return false;
44  }
45 
46  return _stream_handler->IsConnected();
47 }
48 
50 {
51  LOG(VB_CHANNEL, LOG_INFO, LOC + "Closing Ceton channel");
52 
53  if (!IsOpen())
54  return; // this caller didn't have it open in the first place..
55 
57 }
58 
60 {
61  if (IsOpen())
63  else
64  return true;
65 }
66 
67 bool CetonChannel::IsOpen(void) const
68 {
69  return _stream_handler;
70 }
71 
73 bool CetonChannel::Tune(const QString &freqid, int /*finetune*/)
74 {
75  return _stream_handler->TuneVChannel(freqid);
76 }
77 
78 static QString format_modulation(const DTVMultiplex &tuning)
79 {
81  return "qam_256";
83  return "qam_64";
84  //note...ceton also supports NTSC-M, but not sure what to use that for
85  else if (DTVModulation::kModulation8VSB == tuning.modulation)
86  return "8vsb";
87 
88  return "unknown";
89 }
90 
91 bool CetonChannel::Tune(const DTVMultiplex &tuning)
92 {
93  QString modulation = format_modulation(tuning);
94 
95  LOG(VB_CHANNEL, LOG_INFO, LOC + QString("Tuning to %1 %2")
96  .arg(tuning.frequency).arg(modulation));
97 
98  if (_stream_handler->TuneFrequency(tuning.frequency, modulation))
99  {
100  SetSIStandard(tuning.sistandard);
101  return true;
102  }
103 
104  return false;
105 }
106 
107 bool CetonChannel::SetChannelByString(const QString &channum)
108 {
109  bool ok = DTVChannel::SetChannelByString(channum);
110 
111  if (ok)
112  {
115  else
117  }
118  return ok;
119 }
bool Open(void) override
Opens the channel changing hardware for use.
void Close(void) override
Closes the channel changing hardware to use.
QString _device_id
Definition: cetonchannel.h:51
static const int kTunerTypeATSC
bool IsCableCardInstalled() const
bool TuneFrequency(uint frequency, const QString &modulation)
DTVModulation modulation
Definition: dtvmultiplex.h:90
DTVTunerType tunerType
Definition: dtvchannel.h:163
#define LOC
-*- Mode: c++ -*- CetonChannel Copyright (c) 2011 Ronald Frazier Copyright (c) 2006-2009 by Silicondu...
QString sistandard
Definition: dtvmultiplex.h:101
CetonChannel(TVRec *parent, const QString &device)
Class providing a generic interface to digital tuning hardware.
Definition: dtvchannel.h:34
uint GetProgramNumber(void) const
uint64_t frequency
Definition: dtvmultiplex.h:84
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:150
bool IsOpen(void) const override
Reports whether channel is already open.
static QString format_modulation(const DTVMultiplex &tuning)
bool SetChannelByString(const QString &channum) override
bool Tune(const DTVMultiplex &tuning) override
This performs the actual frequency tuning and in some cases input switching.
bool EnterPowerSavingMode(void) override
Enters power saving mode if the card supports it.
int currentProgramNum
Definition: dtvchannel.h:167
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
void SetSIStandard(const QString &)
Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable.
Definition: dtvchannel.cpp:61
vector< DTVTunerType > _tuner_types
Definition: cetonchannel.h:53
CetonStreamHandler * _stream_handler
Definition: cetonchannel.h:52
virtual int GetInputID(void) const
Definition: channelbase.h:67
bool SetChannelByString(const QString &chan) override
Definition: dtvchannel.cpp:167
bool TuneProgram(uint program)
static CetonStreamHandler * Get(const QString &devicename, int inputid)
bool TuneVChannel(const QString &vchannel)
bool IsConnected(void) const
~CetonChannel(void)
virtual bool InitializeInput(void)
Fills in input map from DB.
static void Return(CetonStreamHandler *&ref, int inputid)