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 _allow_retune; }
44 
45  void SetRetuneAllowed(bool allow,
46  DTVSignalMonitor *sigmon,
47  DVBChannel *dvbchan);
48 
49  private:
50  explicit DVBStreamHandler(const QString &, 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 _dvr_dev_path;
65  volatile bool _allow_retune;
66 
70 
71  // for caching TS monitoring supported value.
73  static QMap<QString,bool> s_rec_supports_ts_monitoring;
74 
75  // for implementing Get & Return
76  static QMutex s_handlers_lock;
77  static QMap<QString,DVBStreamHandler*> s_handlers;
78  static QMap<QString,uint> s_handlers_refcnt;
79 };
80 
81 #endif // _DVBSTREAMHANDLER_H_
DVBPIDInfo(uint pid)
volatile bool _allow_retune
PIDInfo * CreatePIDInfo(uint pid, uint stream_type, int pes_type) override
unsigned int uint
Definition: compat.h:140
Provides interface to the tuning hardware when using DVB drivers.
Definition: dvbchannel.h:29
static QMap< QString, DVBStreamHandler * > s_handlers
static QMutex s_handlers_lock
static QMap< QString, bool > s_rec_supports_ts_monitoring
static int run(MythMediaDevice *dev=nullptr, bool startRandomShow=false)
static QMap< QString, uint > s_handlers_refcnt
static QMutex s_rec_supports_ts_monitoring_lock
DVBChannel * _dvbchannel
This class is intended to detect the presence of needed tables.
DVBPIDInfo(uint pid, uint stream_type, int pes_type)
bool IsRetuneAllowed(void) const
DeviceReadBuffer * _drb
Buffers reads from device files.
DTVSignalMonitor * _sigmon