MythTV  master
capture.h
Go to the documentation of this file.
1 // Program Name: capture.h
3 // Created : Sep. 21, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //
25 
26 #ifndef CAPTURE_H
27 #define CAPTURE_H
28 
29 #include <QScriptEngine>
30 
32 
33 class Capture : public CaptureServices
34 {
35  Q_OBJECT
36 
37  public:
38 
39  Q_INVOKABLE explicit Capture( QObject */*parent*/ = nullptr ) {}
40 
41  public:
42 
43  DTC::CaptureCardList* GetCaptureCardList ( const QString &HostName,
44  const QString &CardType ) override; // CaptureServices
45 
46  DTC::CaptureCard* GetCaptureCard ( int CardId ) override; // CaptureServices
47 
48  bool RemoveCaptureCard ( int CardId ) override; // CaptureServices
49 
50  int AddCaptureCard ( const QString &VideoDevice,
51  const QString &AudioDevice,
52  const QString &VBIDevice,
53  const QString &CardType,
55  const QString &HostName,
56  uint DVBSWFilter,
57  uint DVBSatType,
58  bool DVBWaitForSeqStart,
59  bool SkipBTAudio,
60  bool DVBOnDemand,
61  uint DVBDiSEqCType,
63  const QString &FirewireModel,
68  uint Contrast,
70  uint Colour,
71  uint Hue,
72  uint DiSEqCId,
73  bool DVBEITScan) override; // CaptureServices
74 
75  bool UpdateCaptureCard ( int CardId,
76  const QString &Setting,
77  const QString &Value ) override; // CaptureServices
78 
79  // Card Inputs
80 
81  bool RemoveCardInput ( int CardInputId) override; // CaptureServices
82 
83  int AddCardInput ( uint CardId,
84  uint SourceId,
85  const QString &InputName,
86  const QString &ExternalCommand,
87  const QString &ChangerDevice,
88  const QString &ChangerModel,
89  const QString &HostName,
90  const QString &TuneChan,
91  const QString &StartChan,
92  const QString &DisplayName,
93  bool DishnetEIT,
94  uint RecPriority,
95  uint Quicktune,
96  uint SchedOrder,
97  uint LiveTVOrder) override; // CaptureServices
98 
99  bool UpdateCardInput ( int CardInputId,
100  const QString &Setting,
101  const QString &Value ) override; // CaptureServices
102 
103 };
104 
105 // --------------------------------------------------------------------------
106 // The following class wrapper is due to a limitation in Qt Script Engine. It
107 // requires all methods that return pointers to user classes that are derived from
108 // QObject actually return QObject* (not the user class *). If the user class pointer
109 // is returned, the script engine treats it as a QVariant and doesn't create a
110 // javascript prototype wrapper for it.
111 //
112 // This class allows us to keep the rich return types in the main API class while
113 // offering the script engine a class it can work with.
114 //
115 // Only API Classes that return custom classes needs to implement these wrappers.
116 //
117 // We should continue to look for a cleaning solution to this problem.
118 // --------------------------------------------------------------------------
119 
120 class ScriptableCapture : public QObject
121 {
122  Q_OBJECT
123 
124  private:
125 
127  QScriptEngine *m_pEngine;
128 
129  public:
130 
131  Q_INVOKABLE ScriptableCapture( QScriptEngine *pEngine, QObject *parent = nullptr ) : QObject( parent )
132  {
133  m_pEngine = pEngine;
134  }
135 
136  public slots:
137 
138  bool RemoveCaptureCard ( int Id )
139  {
140  SCRIPT_CATCH_EXCEPTION( false,
141  return m_obj.RemoveCaptureCard( Id );
142  )
143  }
144 
145  bool AddCaptureCard ( const QString &VideoDevice,
146  const QString &AudioDevice,
147  const QString &VBIDevice,
148  const QString &CardType,
149  const uint AudioRateLimit,
150  const QString &HostName,
151  const uint DVBSWFilter,
152  const uint DVBSatType,
153  bool DVBWaitForSeqStart,
154  bool SkipBTAudio,
155  bool DVBOnDemand,
156  const uint DVBDiSEqCType,
157  const uint FirewireSpeed,
158  const QString &FirewireModel,
159  const uint FirewireConnection,
160  const uint SignalTimeout,
161  const uint ChannelTimeout,
162  const uint DVBTuningDelay,
163  const uint Contrast,
164  const uint Brightness,
165  const uint Colour,
166  const uint Hue,
167  const uint DiSEqCId,
168  bool DVBEITScan)
169  {
170  SCRIPT_CATCH_EXCEPTION( false,
172  AudioRateLimit, HostName, DVBSWFilter,
173  DVBSatType, DVBWaitForSeqStart, SkipBTAudio, DVBOnDemand,
176  Colour, Hue, DiSEqCId, DVBEITScan);
177  )
178  }
179 };
180 
181 
183 
184 #endif
unsigned int slots[4]
Definition: element.c:38
bool AddCaptureCard(const QString &VideoDevice, const QString &AudioDevice, const QString &VBIDevice, const QString &CardType, const uint AudioRateLimit, const QString &HostName, const uint DVBSWFilter, const uint DVBSatType, bool DVBWaitForSeqStart, bool SkipBTAudio, bool DVBOnDemand, const uint DVBDiSEqCType, const uint FirewireSpeed, const QString &FirewireModel, const uint FirewireConnection, const uint SignalTimeout, const uint ChannelTimeout, const uint DVBTuningDelay, const uint Contrast, const uint Brightness, const uint Colour, const uint Hue, const uint DiSEqCId, bool DVBEITScan)
Definition: capture.h:145
bool UpdateCaptureCard(int CardId, const QString &Setting, const QString &Value) override
Definition: capture.cpp:294
DTC::CaptureCardList * GetCaptureCardList(const QString &HostName, const QString &CardType) override
Definition: capture.cpp:44
Capture m_obj
Definition: capture.h:126
Q_INVOKABLE Capture(QObject *=nullptr)
Definition: capture.h:39
bool UpdateCardInput(int CardInputId, const QString &Setting, const QString &Value) override
Definition: capture.cpp:349
bool RemoveCardInput(int CardInputId) override
Definition: capture.cpp:306
#define SCRIPT_CATCH_EXCEPTION(default, code)
Definition: service.h:83
unsigned int uint
Definition: compat.h:140
bool RemoveCaptureCard(int CardId) override
Definition: capture.cpp:237
Q_SCRIPT_DECLARE_QMETAOBJECT_MYTHTV(ScriptableCapture, QObject *)
int AddCaptureCard(const QString &VideoDevice, const QString &AudioDevice, const QString &VBIDevice, const QString &CardType, uint AudioRateLimit, const QString &HostName, uint DVBSWFilter, uint DVBSatType, bool DVBWaitForSeqStart, bool SkipBTAudio, bool DVBOnDemand, uint DVBDiSEqCType, uint FirewireSpeed, const QString &FirewireModel, uint FirewireConnection, uint SignalTimeout, uint ChannelTimeout, uint DVBTuningDelay, uint Contrast, uint Brightness, uint Colour, uint Hue, uint DiSEqCId, bool DVBEITScan) override
Definition: capture.cpp:251
DTC::CaptureCard * GetCaptureCard(int CardId) override
Definition: capture.cpp:149
QScriptEngine * m_pEngine
Definition: capture.h:127
bool RemoveCaptureCard(int Id)
Definition: capture.h:138
Q_INVOKABLE ScriptableCapture(QScriptEngine *pEngine, QObject *parent=nullptr)
Definition: capture.h:131
int AddCardInput(uint CardId, uint SourceId, const QString &InputName, const QString &ExternalCommand, const QString &ChangerDevice, const QString &ChangerModel, const QString &HostName, const QString &TuneChan, const QString &StartChan, const QString &DisplayName, bool DishnetEIT, uint RecPriority, uint Quicktune, uint SchedOrder, uint LiveTVOrder) override
Definition: capture.cpp:316
QMap< QString, bool > Setting