Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

841 lines
32 KiB

  1. //------------------------------------------------------------------------------
  2. // File: Tune.h
  3. //
  4. // Desc: Additional infrastructure to extend the tuner.idl. Works nicely
  5. // from C++.
  6. //
  7. // Copyright (c) 1999 - 2001, Microsoft Corporation. All rights reserved.
  8. //------------------------------------------------------------------------------
  9. #pragma once
  10. #ifndef TUNE_H
  11. #define TUNE_H
  12. #include <tuner.h>
  13. namespace BDATuningModel {
  14. const long DEFAULT_MIN_CHANNEL = 2;
  15. const long DEFAULT_MAX_CHANNEL = 999;
  16. const long DEFAULT_MIN_FREQUENCY = 535; //bottom us am
  17. const long DEFAULT_MAX_FREQUENCY = 108000; // top us fm
  18. const long DEFAULT_ANALOG_TUNER_COUNTRY_CODE = 1; //usa
  19. const TunerInputType DEFAULT_ANALOG_TUNER_INPUT_TYPE = TunerInputCable; //usa
  20. typedef CComQIPtr<ITuningSpaceContainer> PQTuningSpaceContainer;
  21. typedef CComQIPtr<ITuningSpace> PQTuningSpace;
  22. typedef CComQIPtr<IAnalogRadioTuningSpace> PQAnalogRadioTuningSpace;
  23. typedef CComQIPtr<IAnalogTVTuningSpace> PQAnalogTVTuningSpace;
  24. typedef CComQIPtr<IATSCTuningSpace> PQATSCTuningSpace;
  25. typedef CComQIPtr<ITuneRequest> PQTuneRequest;
  26. typedef CComQIPtr<IChannelTuneRequest> PQChannelTuneRequest;
  27. typedef CComQIPtr<IATSCChannelTuneRequest> PQATSCChannelTuneRequest;
  28. typedef CComQIPtr<ILocator> PQLocator;
  29. typedef CComQIPtr<IATSCLocator> PQATSCLocator;
  30. typedef CComQIPtr<IDVBTuningSpace> PQDVBTuningSpace;
  31. typedef CComQIPtr<IDVBTuneRequest> PQDVBTuneRequest;
  32. typedef CComQIPtr<IDVBSLocator> PQDVBSLocator;
  33. typedef CComQIPtr<IDVBTLocator> PQDVBTLocator;
  34. typedef CComQIPtr<IAuxInTuningSpace> PQAuxInTuningSpace;
  35. // tuning space container
  36. class TNTuningSpaceContainer : public PQTuningSpaceContainer {
  37. TNTuningSpaceContainer() {}
  38. TNTuningSpaceContainer(const PQTuningSpaceContainer &a) : PQTuningSpaceContainer(a) {}
  39. TNTuningSpaceContainer(ITuningSpace *p) : PQTuningSpaceContainer(p) {}
  40. TNTuningSpaceContainer(IUnknown *p) : PQTuningSpaceContainer(p) {}
  41. TNTuningSpaceContainer(const TNTuningSpaceContainer &a) : PQTuningSpaceContainer(a) {}
  42. TNTuningSpaceContainer& operator=(TNTuningSpaceContainer& rhs) {
  43. PQTuningSpaceContainer::operator=(rhs);
  44. return *this;
  45. }
  46. };
  47. // tuning spaces
  48. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNTuningSpaceHelper : public TUNINGSPACETYPE {
  49. public:
  50. TNTuningSpaceHelper() {}
  51. TNTuningSpaceHelper(const TUNINGSPACETYPE &a) : TUNINGSPACETYPE(a) {}
  52. TNTuningSpaceHelper(ITuningSpace *p) : TUNINGSPACETYPE(p) {}
  53. TNTuningSpaceHelper(IUnknown *p) : TUNINGSPACETYPE(p) {}
  54. TNTuningSpaceHelper(const TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TUNINGSPACETYPE(a) {}
  55. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  56. TUNINGSPACETYPE::operator=(rhs);
  57. return *this;
  58. }
  59. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  60. TUNINGSPACETYPE::operator=(rhs);
  61. return *this;
  62. }
  63. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown *rhs) {
  64. TUNINGSPACETYPE::operator=(rhs);
  65. return *this;
  66. }
  67. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(ITuningSpace *rhs) {
  68. TUNINGSPACETYPE::operator=(rhs);
  69. return *this;
  70. }
  71. bool operator==(TUNINGSPACETYPE& rhs) {
  72. CComBSTR rhsname;
  73. HRESULT hr = rhs->get_UniqueName(&rhsname);
  74. if (FAILED(hr)) {
  75. return false;
  76. }
  77. CComBSTR name;
  78. hr = (*this)->get_UniqueName(&name);
  79. if (FAILED(hr)) {
  80. return false;
  81. }
  82. return name == rhsname;
  83. }
  84. bool operator!=(TUNINGSPACETYPE& rhs) {
  85. return !operator==(rhs);
  86. }
  87. PQTuneRequest CreateTuneRequest() {
  88. PQTuneRequest p;
  89. HRESULT hr = (*this)->CreateTuneRequest(&p);
  90. if (FAILED(hr)) {
  91. return PQTuneRequest();
  92. }
  93. return p;
  94. }
  95. PQLocator Locator() {
  96. _ASSERT(*this);
  97. PQLocator ts;
  98. HRESULT hr = (*this)->get_DefaultLocator(&ts);
  99. if (FAILED(hr)) {
  100. return PQLocator();
  101. }
  102. return ts;
  103. }
  104. HRESULT Locator(PQLocator& l) {
  105. _ASSERT(*this);
  106. return (*this)->put_Locator(l);
  107. }
  108. void Clone() {
  109. PQTuningSpace t;
  110. HRESULT hr = (*this)->Clone(&t);
  111. if (FAILED(hr) || !t) {
  112. Release(); // clone failed, clear ourselves
  113. return;
  114. }
  115. TUNINGSPACETYPE::operator=(t);
  116. }
  117. };
  118. typedef TNTuningSpaceHelper<PQTuningSpace, PQTuneRequest> TNTuningSpace;
  119. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAnalogRadioTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  120. public:
  121. TNAnalogRadioTuningSpaceHelper() {}
  122. TNAnalogRadioTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  123. TNAnalogRadioTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  124. TNAnalogRadioTuningSpaceHelper(const TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  125. TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  126. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  127. return *this;
  128. }
  129. template<class TS, class TR> TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  130. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  131. return *this;
  132. }
  133. TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  134. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  135. return *this;
  136. }
  137. TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  138. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  139. return *this;
  140. }
  141. long MaxFrequency() {
  142. _ASSERT(*this);
  143. long freq;
  144. HRESULT hr = (*this)->get_MaxFrequency(&freq);
  145. if (FAILED(hr)) {
  146. freq = DEFAULT_MAX_FREQUENCY;
  147. }
  148. return freq;
  149. }
  150. HRESULT MaxFrequency(long freq) {
  151. _ASSERT(*this);
  152. return (*this)->put_MaxFrequency(freq);
  153. }
  154. long MinFrequency() {
  155. _ASSERT(*this);
  156. long freq;
  157. HRESULT hr = (*this)->get_MinFrequency(&freq);
  158. if (FAILED(hr)) {
  159. freq = DEFAULT_MIN_FREQUENCY;
  160. }
  161. return freq;
  162. }
  163. HRESULT MinFrequency(long freq) {
  164. _ASSERT(*this);
  165. return (*this)->put_MinFrequency(freq);
  166. }
  167. };
  168. typedef TNAnalogRadioTuningSpaceHelper<PQAnalogRadioTuningSpace, PQChannelTuneRequest> TNAnalogRadioTuningSpace;
  169. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAnalogTVTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  170. public:
  171. TNAnalogTVTuningSpaceHelper() {}
  172. TNAnalogTVTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  173. TNAnalogTVTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  174. TNAnalogTVTuningSpaceHelper(const TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  175. TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  176. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  177. return *this;
  178. }
  179. template<class TS, class TR> TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  180. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  181. return *this;
  182. }
  183. TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  184. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  185. return *this;
  186. }
  187. TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  188. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  189. return *this;
  190. }
  191. TunerInputType InputType() {
  192. _ASSERT(*this);
  193. TunerInputType ti;
  194. HRESULT hr = (*this)->get_InputType(&ti);
  195. if (FAILED(hr)) {
  196. ti = DEFAULT_ANALOG_TUNER_INPUT_TYPE;
  197. }
  198. return ti;
  199. }
  200. HRESULT InputType(TunerInputType ti) {
  201. _ASSERT(*this);
  202. return (*this)->put_InputType(&ti);
  203. }
  204. long CountryCode() {
  205. _ASSERT(*this);
  206. long cc;
  207. HRESULT hr = (*this)->get_CountryCode(&cc);
  208. if (FAILED(hr)) {
  209. cc = DEFAULT_ANALOG_TUNER_INPUT_TYPE;
  210. }
  211. return cc;
  212. }
  213. HRESULT CountryCode(long cc) {
  214. _ASSERT(*this);
  215. return (*this)->put_CountryCode(cc);
  216. }
  217. long MinChannel() {
  218. _ASSERT(*this);
  219. long chan;
  220. HRESULT hr = (*this)->get_MinChannel(&chan);
  221. if (FAILED(hr)) {
  222. chan = DEFAULT_MIN_CHANNEL;
  223. }
  224. return chan;
  225. }
  226. HRESULT MinChannel(long chan) {
  227. _ASSERT(*this);
  228. return (*this)->put_MinChannel(chan);
  229. }
  230. long MaxChannel() {
  231. _ASSERT(*this);
  232. long chan;
  233. HRESULT hr = (*this)->get_MaxChannel(&chan);
  234. if (FAILED(hr)) {
  235. chan = DEFAULT_MAX_CHANNEL;
  236. }
  237. return chan;
  238. }
  239. HRESULT MaxChannel(long chan) {
  240. _ASSERT(*this);
  241. return (*this)->put_MaxChannel(chan);
  242. }
  243. };
  244. typedef TNAnalogTVTuningSpaceHelper<PQAnalogTVTuningSpace, PQChannelTuneRequest> TNAnalogTVTuningSpace;
  245. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAuxInTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  246. public:
  247. TNAuxInTuningSpaceHelper() {}
  248. TNAuxInTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  249. TNAuxInTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  250. TNAuxInTuningSpaceHelper(const TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  251. TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  252. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  253. return *this;
  254. }
  255. template<class TS, class TR> TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  256. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  257. return *this;
  258. }
  259. TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  260. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  261. return *this;
  262. }
  263. TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  264. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  265. return *this;
  266. }
  267. };
  268. typedef TNAuxInTuningSpaceHelper<PQAuxInTuningSpace, PQChannelTuneRequest> TNAuxInTuningSpace;
  269. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNATSCTuningSpaceHelper : public TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  270. public:
  271. TNATSCTuningSpaceHelper() {}
  272. TNATSCTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  273. TNATSCTuningSpaceHelper(IUnknown *p) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  274. TNATSCTuningSpaceHelper(const TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  275. TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  276. TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  277. return *this;
  278. }
  279. template<class TS, class TR> TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  280. TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  281. return *this;
  282. }
  283. TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  284. TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  285. return *this;
  286. }
  287. TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  288. TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  289. return *this;
  290. }
  291. long MinMinorChannel() {
  292. _ASSERT(*this);
  293. long chan;
  294. HRESULT hr = (*this)->get_MinMinorChannel(&chan);
  295. if (FAILED(hr)) {
  296. chan = DEFAULT_MIN_CHANNEL;
  297. }
  298. return chan;
  299. }
  300. HRESULT MinMinorChannel(long chan) {
  301. _ASSERT(*this);
  302. return (*this)->put_MinMinorChannel(chan);
  303. }
  304. long MaxMinorChannel() {
  305. _ASSERT(*this);
  306. long chan;
  307. HRESULT hr = (*this)->get_MaxMinorChannel(&chan);
  308. if (FAILED(hr)) {
  309. chan = DEFAULT_MAX_CHANNEL;
  310. }
  311. return chan;
  312. }
  313. HRESULT MaxMinorChannel(long chan) {
  314. _ASSERT(*this);
  315. return (*this)->put_MaxMinorChannel(chan);
  316. }
  317. long MinPhysicalChannel() {
  318. _ASSERT(*this);
  319. long chan;
  320. HRESULT hr = (*this)->get_MinPhysicalChannel(&chan);
  321. if (FAILED(hr)) {
  322. chan = DEFAULT_MIN_CHANNEL;
  323. }
  324. return chan;
  325. }
  326. HRESULT MinPhysicalChannel(long chan) {
  327. _ASSERT(*this);
  328. return (*this)->put_MinPhysicalChannel(chan);
  329. }
  330. long MaxPhysicalChannel() {
  331. _ASSERT(*this);
  332. long chan;
  333. HRESULT hr = (*this)->get_MaxPhysicalChannel(&chan);
  334. if (FAILED(hr)) {
  335. chan = DEFAULT_MAX_CHANNEL;
  336. }
  337. return chan;
  338. }
  339. HRESULT MaxPhysicalChannel(long chan) {
  340. _ASSERT(*this);
  341. return (*this)->put_MaxPhysicalChannel(chan);
  342. }
  343. };
  344. typedef TNATSCTuningSpaceHelper<PQATSCTuningSpace, PQATSCChannelTuneRequest> TNATSCTuningSpace;
  345. // dvb tuning space
  346. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNDVBTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  347. public:
  348. TNDVBTuningSpaceHelper() {}
  349. TNDVBTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  350. TNDVBTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  351. TNDVBTuningSpaceHelper(const TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  352. TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  353. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  354. return *this;
  355. }
  356. template<class TS, class TR> TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  357. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  358. return *this;
  359. }
  360. TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  361. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  362. return *this;
  363. }
  364. TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  365. TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  366. return *this;
  367. }
  368. DVBSystemType SystemType() const {
  369. DVBSystemType st;
  370. HRESULT hr = (*this)->get_SystemType(&st);
  371. if (FAILED(hr)) {
  372. return DVB_Cable;
  373. }
  374. return st;
  375. }
  376. HRESULT SystemType(DVBSystemType st) {
  377. _ASSERT(*this);
  378. return (*this)->put_SystemType(st);
  379. }
  380. };
  381. typedef TNDVBTuningSpaceHelper<PQDVBTuningSpace, PQDVBTuneRequest> TNDVBTuningSpace;
  382. // locators
  383. template<class LOCATORTYPE> class TNLocatorHelper : public LOCATORTYPE {
  384. public:
  385. TNLocatorHelper() {}
  386. TNLocatorHelper(const LOCATORTYPE &a) : LOCATORTYPE(a) {}
  387. TNLocatorHelper(IUnknown *p) : LOCATORTYPE(p) {}
  388. TNLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : LOCATORTYPE(a) {}
  389. TNLocatorHelper(ILocator *p) : LOCATORTYPE(p) {}
  390. TNLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
  391. LOCATORTYPE::operator=(rhs);
  392. return *this;
  393. }
  394. TNLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
  395. LOCATORTYPE::operator=(rhs);
  396. return *this;
  397. }
  398. TNLocatorHelper<LOCATORTYPE>& operator=(ILocator* rhs) {
  399. LOCATORTYPE::operator=(rhs);
  400. return *this;
  401. }
  402. TNLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
  403. LOCATORTYPE::operator=(rhs);
  404. return *this;
  405. }
  406. void Clone() {
  407. PQLocator t;
  408. HRESULT hr = (*this)->Clone(&t);
  409. if (FAILED(hr) || !t) {
  410. Release(); // clone failed, clear ourselves
  411. return;
  412. }
  413. LOCATORTYPE::operator=(t);
  414. }
  415. long CarrierFrequency() {
  416. _ASSERT(*this);
  417. long f;
  418. HRESULT hr = (*this)->get_CarrierFrequency(&f);
  419. if (FAILED(hr)) {
  420. return -1;
  421. }
  422. return f;
  423. }
  424. HRESULT CarrierFrequency(long f) {
  425. _ASSERT(*this);
  426. return (*this)->put_CarrierFrequency(f);
  427. }
  428. FECMethod InnerFEC() {
  429. _ASSERT(*this);
  430. FECMethod f;
  431. HRESULT hr = (*this)->get_InnerFEC(&f);
  432. if (FAILED(hr)) {
  433. return BDA_FEC_METHOD_NOT_SET;
  434. }
  435. return f;
  436. }
  437. HRESULT InnerFEC(FECMethod f) {
  438. _ASSERT(*this);
  439. return (*this)->put_InnerFEC(f);
  440. }
  441. BinaryConvolutionCodeRate InnerFECRate() {
  442. _ASSERT(*this);
  443. BinaryConvolutionCodeRate f;
  444. HRESULT hr = (*this)->get_InnerFECRate(&f);
  445. if (FAILED(hr)) {
  446. return BDA_BCC_RATE_NOT_SET;
  447. }
  448. return f;
  449. }
  450. HRESULT InnerFECRate(BinaryConvolutionCodeRate f) {
  451. _ASSERT(*this);
  452. return (*this)->put_InnerFECRate(f);
  453. }
  454. FECMethod OuterFEC() {
  455. _ASSERT(*this);
  456. FECMethod f;
  457. HRESULT hr = (*this)->get_OuterFEC(&f);
  458. if (FAILED(hr)) {
  459. return BDA_FEC_METHOD_NOT_SET;
  460. }
  461. return f;
  462. }
  463. HRESULT OuterFEC(FECMethod f) {
  464. _ASSERT(*this);
  465. return (*this)->put_OuterFEC(f);
  466. }
  467. BinaryConvolutionCodeRate OuterFECRate() {
  468. _ASSERT(*this);
  469. BinaryConvolutionCodeRate f;
  470. HRESULT hr = (*this)->get_OuterFECRate(&f);
  471. if (FAILED(hr)) {
  472. return BDA_BCC_RATE_NOT_SET;
  473. }
  474. return f;
  475. }
  476. HRESULT OuterFECRate(BinaryConvolutionCodeRate f) {
  477. _ASSERT(*this);
  478. return (*this)->put_OuterFECRate(f);
  479. }
  480. ModulationType Modulation() {
  481. _ASSERT(*this);
  482. ModulationType f;
  483. HRESULT hr = (*this)->get_Modulation(&f);
  484. if (FAILED(hr)) {
  485. return BDA_MOD_NOT_SET;
  486. }
  487. return f;
  488. }
  489. HRESULT Modulation(ModulationType f) {
  490. _ASSERT(*this);
  491. return (*this)->put_Modulation(f);
  492. }
  493. long SymbolRate() {
  494. _ASSERT(*this);
  495. long f;
  496. HRESULT hr = (*this)->get_SymbolRate(&f);
  497. if (FAILED(hr)) {
  498. return -1;
  499. }
  500. return f;
  501. }
  502. HRESULT SymbolRate(long f) {
  503. _ASSERT(*this);
  504. return (*this)->put_SymbolRate(f);
  505. }
  506. };
  507. typedef TNLocatorHelper<PQLocator> TNLocator;
  508. template<class LOCATORTYPE> class TNATSCLocatorHelper : public TNLocatorHelper<LOCATORTYPE> {
  509. public:
  510. TNATSCLocatorHelper() {}
  511. TNATSCLocatorHelper(const LOCATORTYPE &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  512. TNATSCLocatorHelper(IUnknown *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  513. TNATSCLocatorHelper(const TNATSCLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  514. TNATSCLocatorHelper(IATSCLocator *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  515. TNATSCLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  516. TNATSCLocatorHelper<LOCATORTYPE>& operator=(TNATSCLocatorHelper<LOCATORTYPE>& rhs) {
  517. TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  518. return *this;
  519. }
  520. TNATSCLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
  521. TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  522. return *this;
  523. }
  524. TNATSCLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
  525. TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  526. return *this;
  527. }
  528. TNATSCLocatorHelper<LOCATORTYPE>& operator=(IATSCLocator* rhs) {
  529. TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  530. return *this;
  531. }
  532. TNATSCLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
  533. TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  534. return *this;
  535. }
  536. long PhysicalChannel() {
  537. _ASSERT(*this);
  538. long pc;
  539. HRESULT hr = (*this)->get_PhysicalChannel(&pc);
  540. if (FAILED(hr)) {
  541. return -1;
  542. }
  543. return pc;
  544. }
  545. HRESULT PhysicalChannel(long pc) {
  546. _ASSERT(*this);
  547. return (*this)->put_PhysicalChannel(pc);
  548. }
  549. long TSID() {
  550. _ASSERT(*this);
  551. long pc;
  552. HRESULT hr = (*this)->get_TSID(&pc);
  553. if (FAILED(hr)) {
  554. return -1;
  555. }
  556. return pc;
  557. }
  558. HRESULT TSID(long pc) {
  559. _ASSERT(*this);
  560. return (*this)->put_TSID(pc);
  561. }
  562. long ProgramNumber() {
  563. _ASSERT(*this);
  564. long pc;
  565. HRESULT hr = (*this)->get_ProgramNumber(&pc);
  566. if (FAILED(hr)) {
  567. return -1;
  568. }
  569. return pc;
  570. }
  571. HRESULT ProgramNumber(long pc) {
  572. _ASSERT(*this);
  573. return (*this)->put_ProgramNumber(pc);
  574. }
  575. };
  576. typedef TNATSCLocatorHelper<PQATSCLocator> TNATSCLocator;
  577. // tune requests
  578. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNTuneRequestHelper : public TUNEREQUESTTYPE {
  579. public:
  580. TNTuneRequestHelper() {}
  581. TNTuneRequestHelper(const TUNEREQUESTTYPE &a) : TUNEREQUESTTYPE(a) {}
  582. TNTuneRequestHelper(IUnknown *p) : TUNEREQUESTTYPE(p) {}
  583. TNTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TUNEREQUESTTYPE(a) {}
  584. TNTuneRequestHelper(ITuneRequest *p) : TUNEREQUESTTYPE(p) {}
  585. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  586. TUNEREQUESTTYPE::operator=(rhs);
  587. return *this;
  588. }
  589. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  590. TUNEREQUESTTYPE::operator=(rhs);
  591. return *this;
  592. }
  593. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(ITuneRequest* rhs) {
  594. TUNEREQUESTTYPE::operator=(rhs);
  595. return *this;
  596. }
  597. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  598. TUNEREQUESTTYPE::operator=(rhs);
  599. return *this;
  600. }
  601. // this function creates a new instance of the base ITuneRequest* and copies
  602. // all the values of the current ITuneRequest and sets this to the new one
  603. // this provides the value semantics needed by the network providers
  604. void Clone() {
  605. PQTuneRequest t;
  606. HRESULT hr = (*this)->Clone(&t);
  607. if (FAILED(hr) || !t) {
  608. Release(); // clone failed, clear ourselves
  609. return;
  610. }
  611. TUNEREQUESTTYPE::operator=(t);
  612. }
  613. PQTuningSpace TuningSpace() {
  614. _ASSERT(*this);
  615. PQTuningSpace ts;
  616. HRESULT hr = (*this)->get_TuningSpace(&ts);
  617. if (FAILED(hr)) {
  618. return PQTuningSpace();
  619. }
  620. return ts;
  621. }
  622. LOCATORTYPE Locator() {
  623. _ASSERT(*this);
  624. PQLocator pc;
  625. HRESULT hr = (*this)->get_Locator(&pc);
  626. if (FAILED(hr)) {
  627. return PQLocator().p;
  628. }
  629. return pc.p;
  630. }
  631. HRESULT Locator(LOCATORTYPE& pc) {
  632. _ASSERT(*this);
  633. return (*this)->put_Locator(pc);
  634. }
  635. };
  636. typedef TNTuneRequestHelper<PQTuneRequest, PQLocator> TNTuneRequest;
  637. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNChannelTuneRequestHelper : public TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
  638. public:
  639. TNChannelTuneRequestHelper() {}
  640. TNChannelTuneRequestHelper(const TNTuneRequest &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  641. TNChannelTuneRequestHelper(IChannelTuneRequest *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  642. TNChannelTuneRequestHelper(IUnknown *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  643. TNChannelTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  644. TNChannelTuneRequestHelper(const TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  645. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  646. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  647. return *this;
  648. }
  649. template<class TR, class LOC> TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
  650. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TUNEREQUESTTYPE(rhs));
  651. return *this;
  652. }
  653. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  654. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  655. return *this;
  656. }
  657. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IChannelTuneRequest* rhs) {
  658. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  659. return *this;
  660. }
  661. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  662. TUNEREQUESTTYPE::operator=(rhs);
  663. return *this;
  664. }
  665. long Channel() {
  666. _ASSERT(*this);
  667. long c;
  668. HRESULT hr = (*this)->get_Channel(&c);
  669. if (FAILED(hr)) {
  670. return -1;
  671. }
  672. return c;
  673. }
  674. HRESULT Channel(long c) {
  675. _ASSERT(*this);
  676. return (*this)->put_Channel(c);
  677. }
  678. };
  679. typedef TNChannelTuneRequestHelper<PQChannelTuneRequest, PQLocator> TNChannelTuneRequest;
  680. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNATSCChannelTuneRequestHelper : public TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
  681. public:
  682. TNATSCChannelTuneRequestHelper() {}
  683. TNATSCChannelTuneRequestHelper(const TNTuneRequest &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  684. TNATSCChannelTuneRequestHelper(IATSCChannelTuneRequest *p) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  685. TNATSCChannelTuneRequestHelper(IUnknown *p) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  686. TNATSCChannelTuneRequestHelper(const TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  687. TNATSCChannelTuneRequestHelper(const TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  688. TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  689. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  690. return *this;
  691. }
  692. template<class TR, class LOC>TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
  693. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TR(rhs));
  694. return *this;
  695. }
  696. TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  697. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  698. return *this;
  699. }
  700. TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IATSCChannelTuneRequest *rhs) {
  701. TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  702. return *this;
  703. }
  704. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  705. TUNEREQUESTTYPE::operator=(rhs);
  706. return *this;
  707. }
  708. long MinorChannel() {
  709. _ASSERT(*this);
  710. long mc;
  711. HRESULT hr = (*this)->get_MinorChannel(&mc);
  712. if (FAILED(hr)) {
  713. return -1;
  714. }
  715. return mc;
  716. }
  717. HRESULT MinorChannel(long mc) {
  718. _ASSERT(*this);
  719. return (*this)->put_MinorChannel(mc);
  720. }
  721. };
  722. typedef TNATSCChannelTuneRequestHelper<PQATSCChannelTuneRequest, PQATSCLocator> TNATSCChannelTuneRequest;
  723. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNDVBTuneRequestHelper : public TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
  724. public:
  725. TNDVBTuneRequestHelper() {}
  726. TNDVBTuneRequestHelper(const TNTuneRequest &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  727. TNDVBTuneRequestHelper(IDVBTuneRequest *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  728. TNDVBTuneRequestHelper(IUnknown *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  729. TNDVBTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  730. TNDVBTuneRequestHelper(const TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  731. TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  732. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  733. return *this;
  734. }
  735. template<class TR, class LOC> TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
  736. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TUNEREQUESTTYPE(rhs));
  737. return *this;
  738. }
  739. TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  740. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  741. return *this;
  742. }
  743. TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IDVBTuneRequest* rhs) {
  744. TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  745. return *this;
  746. }
  747. TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  748. TUNEREQUESTTYPE::operator=(rhs);
  749. return *this;
  750. }
  751. long ONID() {
  752. _ASSERT(*this);
  753. long c;
  754. HRESULT hr = (*this)->get_ONID(&c);
  755. if (FAILED(hr)) {
  756. return -1;
  757. }
  758. return c;
  759. }
  760. HRESULT ONID(long c) {
  761. _ASSERT(*this);
  762. return (*this)->put_ONID(c);
  763. }
  764. long TSID() {
  765. _ASSERT(*this);
  766. long c;
  767. HRESULT hr = (*this)->get_TSID(&c);
  768. if (FAILED(hr)) {
  769. return -1;
  770. }
  771. return c;
  772. }
  773. HRESULT TSID(long c) {
  774. _ASSERT(*this);
  775. return (*this)->put_TSID(c);
  776. }
  777. long SID() {
  778. _ASSERT(*this);
  779. long c;
  780. HRESULT hr = (*this)->get_SID(&c);
  781. if (FAILED(hr)) {
  782. return -1;
  783. }
  784. return c;
  785. }
  786. HRESULT SID(long c) {
  787. _ASSERT(*this);
  788. return (*this)->put_SID(c);
  789. }
  790. };
  791. typedef TNDVBTuneRequestHelper<PQDVBTuneRequest, PQLocator> TNDVBTuneRequest;
  792. }; // namespace
  793. #ifndef NO_DEFAULT_BDATUNINGMODEL_NAMESPACE
  794. using namespace BDATuningModel;
  795. #endif
  796. #endif
  797. // end of file - tune.h