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(CetonChannel::GetDevice())
17 
19 {
21 }
22 
24 {
25  LOG(VB_CHANNEL, LOG_INFO, LOC + "Opening Ceton channel");
26 
27  if (IsOpen())
28  return true;
29 
31 
33  m_tunerTypes.push_back(m_tunerType);
34 
35  if (!InitializeInput())
36  {
37  Close();
38  return false;
39  }
40 
41  return m_streamHandler->IsConnected();
42 }
43 
45 {
46  LOG(VB_CHANNEL, LOG_INFO, LOC + "Closing Ceton channel");
47 
48  if (!CetonChannel::IsOpen())
49  return; // this caller didn't have it open in the first place..
50 
52 }
53 
55 {
56  if (IsOpen())
58  return true;
59 }
60 
61 bool CetonChannel::IsOpen(void) const
62 {
63  return m_streamHandler;
64 }
65 
67 bool CetonChannel::Tune(const QString &freqid, int /*finetune*/)
68 {
69  return m_streamHandler->TuneVChannel(freqid);
70 }
71 
72 static QString format_modulation(const DTVMultiplex &tuning)
73 {
75  return "qam_256";
77  return "qam_64";
78  //note...ceton also supports NTSC-M, but not sure what to use that for
80  return "8vsb";
81 
82  return "unknown";
83 }
84 
85 bool CetonChannel::Tune(const DTVMultiplex &tuning)
86 {
87  QString modulation = format_modulation(tuning);
88 
89  LOG(VB_CHANNEL, LOG_INFO, LOC + QString("Tuning to %1 %2")
90  .arg(tuning.m_frequency).arg(modulation));
91 
92  if (m_streamHandler->TuneFrequency(tuning.m_frequency, modulation))
93  {
95  return true;
96  }
97 
98  return false;
99 }
100 
101 bool CetonChannel::SetChannelByString(const QString &channum)
102 {
103  bool ok = DTVChannel::SetChannelByString(channum);
104 
105  if (ok)
106  {
109  else
111  }
112  return ok;
113 }
DTVMultiplex::m_frequency
uint64_t m_frequency
Definition: dtvmultiplex.h:94
DTVMultiplex
Definition: dtvmultiplex.h:24
CetonChannel::IsOpen
bool IsOpen(void) const override
Reports whether channel is already open.
Definition: cetonchannel.cpp:61
CetonStreamHandler::IsCableCardInstalled
bool IsCableCardInstalled() const
Definition: cetonstreamhandler.h:32
mythdbcon.h
CetonChannel::~CetonChannel
~CetonChannel(void) override
Definition: cetonchannel.cpp:18
DTVChannel::SetChannelByString
bool SetChannelByString(const QString &chan) override
Definition: dtvchannel.cpp:156
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
CetonStreamHandler::TuneVChannel
bool TuneVChannel(const QString &vchannel)
Definition: cetonstreamhandler.cpp:413
DTVChannel::m_currentProgramNum
int m_currentProgramNum
Definition: dtvchannel.h:167
CetonChannel::Close
void Close(void) override
Closes the channel changing hardware to use.
Definition: cetonchannel.cpp:44
DTVModulation::kModulationQAM256
@ kModulationQAM256
Definition: dtvconfparserhelpers.h:363
CetonChannel::Tune
bool Tune(const DTVMultiplex &tuning) override
This performs the actual frequency tuning and in some cases input switching.
Definition: cetonchannel.cpp:85
cetonchannel.h
mythlogging.h
DTVChannel::SetSIStandard
void SetSIStandard(const QString &si_std)
Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable.
Definition: dtvchannel.cpp:50
CetonStreamHandler::IsConnected
bool IsConnected(void) const
Definition: cetonstreamhandler.cpp:222
CetonChannel::m_deviceId
QString m_deviceId
Definition: cetonchannel.h:54
CetonStreamHandler::TuneProgram
bool TuneProgram(uint program)
Definition: cetonstreamhandler.cpp:353
CetonStreamHandler::GetProgramNumber
uint GetProgramNumber(void) const
Definition: cetonstreamhandler.cpp:446
format_modulation
static QString format_modulation(const DTVMultiplex &tuning)
Definition: cetonchannel.cpp:72
cetonstreamhandler.h
CetonStreamHandler::EnterPowerSavingMode
bool EnterPowerSavingMode(void)
Definition: cetonstreamhandler.cpp:206
channelutil.h
DTVChannel::m_tunerType
DTVTunerType m_tunerType
Definition: dtvchannel.h:162
CetonStreamHandler::Return
static void Return(CetonStreamHandler *&ref, int inputid)
Definition: cetonstreamhandler.cpp:70
CetonChannel::m_streamHandler
CetonStreamHandler * m_streamHandler
Definition: cetonchannel.h:55
CetonStreamHandler::Get
static CetonStreamHandler * Get(const QString &devname, int inputid)
Definition: cetonstreamhandler.cpp:37
LOC
#define LOC
-*- Mode: c++ -*- CetonChannel Copyright (c) 2011 Ronald Frazier Copyright (c) 2006-2009 by Silicondu...
Definition: cetonchannel.cpp:16
DTVMultiplex::m_sistandard
QString m_sistandard
Definition: dtvmultiplex.h:111
ChannelBase::GetInputID
virtual int GetInputID(void) const
Definition: channelbase.h:67
CetonStreamHandler::TuneFrequency
bool TuneFrequency(uint frequency, const QString &modulation)
Definition: cetonstreamhandler.cpp:309
DTVModulation::kModulation8VSB
@ kModulation8VSB
Definition: dtvconfparserhelpers.h:365
DTVMultiplex::m_modulation
DTVModulation m_modulation
Definition: dtvmultiplex.h:100
DTVTunerType::kTunerTypeATSC
static const int kTunerTypeATSC
Definition: dtvconfparserhelpers.h:98
CetonChannel::SetChannelByString
bool SetChannelByString(const QString &channum) override
Definition: cetonchannel.cpp:101
CetonChannel::m_tunerTypes
std::vector< DTVTunerType > m_tunerTypes
Definition: cetonchannel.h:56
ChannelBase::InitializeInput
virtual bool InitializeInput(void)
Fills in input map from DB.
Definition: channelbase.cpp:541
DTVModulation::kModulationQAM64
@ kModulationQAM64
Definition: dtvconfparserhelpers.h:361
CetonChannel::Open
bool Open(void) override
Opens the channel changing hardware for use.
Definition: cetonchannel.cpp:23
videosource.h
CetonChannel::EnterPowerSavingMode
bool EnterPowerSavingMode(void) override
Enters power saving mode if the card supports it.
Definition: cetonchannel.cpp:54