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

0001 /*
0002  * dvbrecording_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 DVBRECORDING_P_H
0022 #define DVBRECORDING_P_H
0023 
0024 #include <QFile>
0025 #include <QTimer>
0026 #include "dvbchannel.h"
0027 #include "dvbsi.h"
0028 
0029 class DvbDevice;
0030 class DvbManager;
0031 class DvbRecording;
0032 
0033 class DvbRecordingFile : private QObject, public QSharedData, private DvbPidFilter
0034 {
0035     Q_OBJECT
0036 public:
0037     explicit DvbRecordingFile(DvbManager *manager_);
0038     ~DvbRecordingFile();
0039 
0040     // start() returns true if the recording is already running
0041     bool start(DvbRecording &recording);
0042     void stop();
0043 
0044 private slots:
0045     void deviceStateChanged();
0046     void pmtSectionChanged(const QByteArray &pmtSectionData_);
0047     void insertPatPmt();
0048 
0049 private:
0050     void processData(const char data[188]) override;
0051 
0052     DvbManager *manager;
0053     DvbSharedChannel channel;
0054     QFile file;
0055     QList<QByteArray> buffers;
0056     DvbDevice *device;
0057     QList<int> pids;
0058     DvbPmtFilter pmtFilter;
0059     QByteArray pmtSectionData;
0060     DvbSectionGenerator patGenerator;
0061     DvbSectionGenerator pmtGenerator;
0062     QTimer patPmtTimer;
0063     bool pmtValid;
0064 };
0065 
0066 #endif /* DVBRECORDING_P_H */