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

0001 /*
0002  * dvbliveview.h
0003  *
0004  * Copyright (C) 2007-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 DVBLIVEVIEW_H
0022 #define DVBLIVEVIEW_H
0023 
0024 #include <QTimer>
0025 #include "../mediawidget.h"
0026 #include "dvbchannel.h"
0027 
0028 class DvbDevice;
0029 class DvbLiveViewInternal;
0030 class DvbManager;
0031 
0032 class DvbLiveView : public QObject
0033 {
0034     Q_OBJECT
0035 public:
0036     DvbLiveView(DvbManager *manager_, QObject *parent);
0037     ~DvbLiveView();
0038 
0039     const DvbSharedChannel &getChannel() const;
0040     DvbDevice *getDevice() const;
0041 
0042     void playChannel(const DvbSharedChannel &channel_);
0043 
0044 public slots:
0045     void toggleOsd();
0046 
0047 signals:
0048     void previous();
0049     void next();
0050 
0051 private slots:
0052     void pmtSectionChanged(const QByteArray &pmtSectionData);
0053     void insertPatPmt();
0054     void deviceStateChanged();
0055     void showOsd();
0056     void osdTimeout();
0057 
0058     void currentAudioStreamChanged(int currentAudioStream);
0059     void currentSubtitleChanged(int currentSubtitle);
0060     void replay();
0061     void playbackFinished();
0062     void playbackStatusChanged(MediaWidget::PlaybackStatus playbackStatus);
0063 
0064 private:
0065     void startDevice();
0066     void stopDevice();
0067     void updatePids(bool forcePatPmtUpdate = false);
0068 
0069     DvbManager *manager;
0070     MediaWidget *mediaWidget;
0071     OsdWidget *osdWidget;
0072     DvbLiveViewInternal *internal;
0073 
0074     DvbSharedChannel channel;
0075     DvbDevice *device;
0076     QList<int> pids;
0077     QTimer patPmtTimer;
0078     QTimer osdTimer;
0079 
0080     int videoPid;
0081     int audioPid;
0082     int subtitlePid;
0083     int pausedTime;
0084     QList<int> audioPids;
0085     QList<int> subtitlePids;
0086 };
0087 
0088 #endif /* DVBLIVEVIEW_H */