File indexing completed on 2024-05-12 04:52:18
0001 /* 0002 * dvbscan.h 0003 * 0004 * Copyright (C) 2008-2011 Christoph Pfister <christophpfister@gmail.com> 0005 * 0006 * This program is free software; you can redistribute it and/or modify 0007 * it under the terms of the GNU General Public License as published by 0008 * the Free Software Foundation; either version 2 of the License, or 0009 * (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License along 0017 * with this program; if not, write to the Free Software Foundation, Inc., 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 0019 */ 0020 0021 #ifndef DVBSCAN_H 0022 #define DVBSCAN_H 0023 0024 #include "dvbchannel.h" 0025 0026 class AtscVctSection; 0027 class DvbDescriptor; 0028 class DvbDevice; 0029 class DvbNitSection; 0030 class DvbPatEntry; 0031 class DvbPatSection; 0032 class DvbPmtSection; 0033 class DvbScanFilter; 0034 class DvbSdtEntry; 0035 class DvbSdtSection; 0036 0037 class DvbPreviewChannel : public DvbChannel 0038 { 0039 public: 0040 DvbPreviewChannel() : snr(-1) { } 0041 ~DvbPreviewChannel() { } 0042 0043 /* 0044 * assigned when reading PMT 0045 */ 0046 0047 // QString source; 0048 // DvbTransponder transponder; 0049 // int transportStreamId; 0050 // int pmtPid; 0051 // QByteArray pmtSectionData; 0052 // int serviceId; 0053 // int audioPid; // may be -1 (not present) 0054 // bool hasVideo; 0055 0056 QString snr; 0057 0058 /* 0059 * assigned when reading SDT 0060 */ 0061 0062 // QString name; 0063 // int networkId; // may be -1 (not present); ATSC meaning: source id 0064 // bool isScrambled; 0065 QString provider; 0066 0067 /* 0068 * assigned when adding channel to the main list 0069 */ 0070 0071 // int number; 0072 }; 0073 0074 class DvbScan : public QObject 0075 { 0076 friend class DvbScanFilter; 0077 Q_OBJECT 0078 public: 0079 DvbScan(DvbDevice *device_, const QString &source_, const DvbTransponder &transponder_, bool useOtherNit); 0080 DvbScan(DvbDevice *device_, const QString &source_, 0081 const QList<DvbTransponder> &transponders_, bool useOtherNit); 0082 DvbScan(DvbDevice *device_, const QString &source_, const QString &autoScanSource, bool useOtherNit); 0083 ~DvbScan(); 0084 0085 void start(); 0086 0087 signals: 0088 void foundChannels(const QList<DvbPreviewChannel> &channels); 0089 void scanProgress(int percentage); 0090 void scanFinished(); 0091 0092 private slots: 0093 void deviceStateChanged(); 0094 0095 private: 0096 enum FilterType 0097 { 0098 PatFilter, 0099 PmtFilter, 0100 SdtFilter, 0101 VctFilter, 0102 NitFilter 0103 }; 0104 0105 enum State 0106 { 0107 ScanPat, 0108 ScanNit, 0109 ScanSdt, 0110 ScanPmt, 0111 ScanTune, 0112 ScanTuning 0113 }; 0114 0115 bool startFilter(int pid, FilterType type); 0116 void updateState(); 0117 0118 void processPat(const DvbPatSection §ion); 0119 void processPmt(const DvbPmtSection §ion, int pid); 0120 void processSdt(const DvbSdtSection §ion); 0121 void processVct(const AtscVctSection §ion); 0122 void processNit(const DvbNitSection §ion); 0123 void processNitDescriptor(const DvbDescriptor &descriptor); 0124 void filterFinished(DvbScanFilter *filter); 0125 0126 DvbDevice *device; 0127 QString source; 0128 DvbTransponder transponder; 0129 bool isLive; 0130 bool isAuto; 0131 bool useOtherNit; 0132 0133 // only used if isLive is false 0134 QList<DvbTransponder> transponders; 0135 int transponderIndex; 0136 0137 State state; 0138 QList<DvbPatEntry> patEntries; 0139 int patIndex; 0140 QList<DvbSdtEntry> sdtEntries; 0141 QList<DvbPreviewChannel> channels; 0142 0143 DvbBackendDevice::Scale scale; 0144 float snr; 0145 int transportStreamId; 0146 0147 QList<DvbScanFilter *> filters; 0148 int activeFilters; 0149 }; 0150 0151 #endif /* DVBSCAN_H */