File indexing completed on 2024-05-12 04:52:14

0001 /*
0002  * dvbepg_p.h
0003  *
0004  * Copyright (C) 2009-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 DVBEPG_P_H
0022 #define DVBEPG_P_H
0023 
0024 #include "dvbbackenddevice.h"
0025 #include "dvbepg.h"
0026 #include "dvbsi.h"
0027 
0028 class DvbContentDescriptor;
0029 class DvbParentalRatingDescriptor;
0030 class DvbEpgLangEntry;
0031 
0032 class DvbEpgFilter : public QSharedData, public DvbSectionFilter
0033 {
0034 public:
0035     DvbEpgFilter(DvbManager *manager, DvbDevice *device_, const DvbSharedChannel &channel);
0036     ~DvbEpgFilter();
0037 
0038     DvbDevice *device;
0039     QString source;
0040     DvbTransponder transponder;
0041 
0042 private:
0043     Q_DISABLE_COPY(DvbEpgFilter)
0044     static QTime bcdToTime(int bcd);
0045 
0046     DvbEpgLangEntry *getLangEntry(DvbEpgEntry &epgEntry,
0047                       int code1, int code2, int code3,
0048                       bool add_code = true,
0049                       QString *code = NULL);
0050     void processSection(const char *data, int size) override;
0051     QString getContent(DvbContentDescriptor &descriptor);
0052     QString getParental(DvbParentalRatingDescriptor &descriptor);
0053 
0054     DvbChannelModel *channelModel;
0055     DvbEpgModel *epgModel;
0056     DvbManager *manager;
0057 };
0058 
0059 class AtscEpgMgtFilter : public DvbSectionFilter
0060 {
0061 public:
0062     explicit AtscEpgMgtFilter(AtscEpgFilter *epgFilter_) : epgFilter(epgFilter_) { }
0063     ~AtscEpgMgtFilter() { }
0064 
0065 private:
0066     Q_DISABLE_COPY(AtscEpgMgtFilter)
0067     void processSection(const char *data, int size) override;
0068 
0069     AtscEpgFilter *epgFilter;
0070 };
0071 
0072 class AtscEpgEitFilter : public DvbSectionFilter
0073 {
0074 public:
0075     explicit AtscEpgEitFilter(AtscEpgFilter *epgFilter_) : epgFilter(epgFilter_) { }
0076     ~AtscEpgEitFilter() { }
0077 
0078 private:
0079     Q_DISABLE_COPY(AtscEpgEitFilter)
0080     void processSection(const char *data, int size) override;
0081 
0082     AtscEpgFilter *epgFilter;
0083 };
0084 
0085 class AtscEpgEttFilter : public DvbSectionFilter
0086 {
0087 public:
0088     explicit AtscEpgEttFilter(AtscEpgFilter *epgFilter_) : epgFilter(epgFilter_) { }
0089     ~AtscEpgEttFilter() { }
0090 
0091 private:
0092     Q_DISABLE_COPY(AtscEpgEttFilter)
0093     void processSection(const char *data, int size) override;
0094 
0095     AtscEpgFilter *epgFilter;
0096 };
0097 
0098 class AtscEpgFilter : public QSharedData
0099 {
0100     friend class AtscEpgMgtFilter;
0101     friend class AtscEpgEitFilter;
0102     friend class AtscEpgEttFilter;
0103 public:
0104     AtscEpgFilter(DvbManager *manager, DvbDevice *device_, const DvbSharedChannel &channel);
0105     ~AtscEpgFilter();
0106 
0107     DvbDevice *device;
0108     QString source;
0109     DvbTransponder transponder;
0110 
0111 private:
0112     Q_DISABLE_COPY(AtscEpgFilter)
0113     void processMgtSection(const char *data, int size);
0114     void processEitSection(const char *data, int size);
0115     void processEttSection(const char *data, int size);
0116 
0117     DvbChannelModel *channelModel;
0118     DvbEpgModel *epgModel;
0119     AtscEpgMgtFilter mgtFilter;
0120     AtscEpgEitFilter eitFilter;
0121     AtscEpgEttFilter ettFilter;
0122     QList<int> eitPids;
0123     QList<int> ettPids;
0124     QMap<quint32, DvbSharedEpgEntry> epgEntries;
0125 };
0126 
0127 #endif /* DVBEPG_P_H */