MythTV  master
dvbstreamhandler.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef DVBSTREAMHANDLER_H
4 #define DVBSTREAMHANDLER_H
5 
6 #include <vector>
7 using namespace std;
8 
9 #include <QString>
10 #include <QMutex>
11 #include <QMap>
12 
13 #include "streamhandler.h"
14 
15 class QString;
16 class DVBStreamHandler;
17 class DTVSignalMonitor;
18 class DVBChannel;
19 class DeviceReadBuffer;
20 
21 //#define RETUNE_TIMEOUT 5000
22 
23 class DVBPIDInfo : public PIDInfo
24 {
25  public:
26  explicit DVBPIDInfo(uint pid) : PIDInfo(pid) {}
27  DVBPIDInfo(uint pid, uint stream_type, int pes_type) :
28  PIDInfo(pid, stream_type, pes_type) {}
29  bool Open(const QString &dvb_dev, bool use_section_reader) override; // PIDInfo
30  bool Close(const QString &dvb_dev) override; // PIDInfo
31 };
32 
34 {
35  public:
36  static DVBStreamHandler *Get(const QString &devname, int inputid);
37  static void Return(DVBStreamHandler * & ref, int inputid);
38 
39  // DVB specific
40 
41  void RetuneMonitor(void);
42 
43  bool IsRetuneAllowed(void) const { return m_allowRetune; }
44 
45  void SetRetuneAllowed(bool allow,
46  DTVSignalMonitor *sigmon,
47  DVBChannel *dvbchan);
48 
49  private:
50  explicit DVBStreamHandler(const QString &dvb_device, int inputid);
51 
52  void run(void) override; // MThread
53  void RunTS(void);
54  void RunSR(void);
55 
56  void CycleFiltersByPriority(void) override; // StreamHandler
57 
58  bool SupportsTSMonitoring(void);
59 
60  PIDInfo *CreatePIDInfo(uint pid, uint stream_type, int pes_type) override // StreamHandler
61  { return new DVBPIDInfo(pid, stream_type, pes_type); }
62 
63  private:
64  QString m_dvrDevPath;
65  volatile bool m_allowRetune;
66 
70 
71  // for caching TS monitoring supported value.
73  static QMap<QString,bool> s_recSupportsTsMonitoring;
74 
75  // for implementing Get & Return
76  static QMutex s_handlersLock;
77  static QMap<QString,DVBStreamHandler*> s_handlers;
78  static QMap<QString,uint> s_handlersRefCnt;
79 };
80 
81 #endif // DVBSTREAMHANDLER_H
DVBPIDInfo(uint pid)
static QMap< QString, bool > s_recSupportsTsMonitoring
PIDInfo * CreatePIDInfo(uint pid, uint stream_type, int pes_type) override
Provides interface to the tuning hardware when using DVB drivers.
Definition: dvbchannel.h:29
static QMap< QString, DVBStreamHandler * > s_handlers
DTVSignalMonitor * m_sigMon
volatile bool m_allowRetune
static QMutex s_handlersLock
static QMap< QString, uint > s_handlersRefCnt
static QMutex s_rec_supportsTsMonitoringLock
unsigned int uint
Definition: compat.h:140
DeviceReadBuffer * m_drb
This class is intended to detect the presence of needed tables.
DVBPIDInfo(uint pid, uint stream_type, int pes_type)
DVBChannel * m_dvbChannel
bool IsRetuneAllowed(void) const
Buffers reads from device files.