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_tuner_types.push_back(m_tunerType);
34 
35  if (!InitializeInput())
36  {
37  Close();
38  return false;
39  }
40 
41  return m_stream_handler->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_stream_handler;
64 }
65 
67 bool CetonChannel::Tune(const QString &freqid, int /*finetune*/)
68 {
69  return m_stream_handler->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_stream_handler->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 }
bool Open(void) override
Opens the channel changing hardware for use.
void Close(void) override
Closes the channel changing hardware to use.
static const int kTunerTypeATSC
vector< DTVTunerType > m_tuner_types
Definition: cetonchannel.h:54
bool IsCableCardInstalled() const
bool TuneFrequency(uint frequency, const QString &modulation)
QString m_device_id
Definition: cetonchannel.h:52
DTVTunerType m_tunerType
Definition: dtvchannel.h:163
#define LOC
-*- Mode: c++ -*- CetonChannel Copyright (c) 2011 Ronald Frazier Copyright (c) 2006-2009 by Silicondu...
static CetonStreamHandler * Get(const QString &devname, int inputid)
DTVModulation m_modulation
Definition: dtvmultiplex.h:100
uint GetProgramNumber(void) const
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.
QString m_sistandard
Definition: dtvmultiplex.h:111
#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:50
virtual int GetInputID(void) const
Definition: channelbase.h:67
bool SetChannelByString(const QString &chan) override
Definition: dtvchannel.cpp:156
bool TuneProgram(uint program)
bool TuneVChannel(const QString &vchannel)
bool IsConnected(void) const
~CetonChannel(void)
CetonStreamHandler * m_stream_handler
Definition: cetonchannel.h:53
int m_currentProgramNum
Definition: dtvchannel.h:168
virtual bool InitializeInput(void)
Fills in input map from DB.
static void Return(CetonStreamHandler *&ref, int inputid)
uint64_t m_frequency
Definition: dtvmultiplex.h:94