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
8#include <QString>
9#include <QMutex>
10#include <QMap>
11
12#include "streamhandler.h"
13
14class QString;
17class DVBChannel;
19
20//#define RETUNE_TIMEOUT 5000
21
22class DVBPIDInfo : public PIDInfo
23{
24 public:
25 explicit DVBPIDInfo(uint pid) : PIDInfo(pid) {}
26 DVBPIDInfo(uint pid, uint stream_type, int pes_type) :
27 PIDInfo(pid, stream_type, pes_type) {}
28 bool Open(const QString &dvb_dev, bool use_section_reader) override; // PIDInfo
29 bool Close(const QString &dvb_dev) override; // PIDInfo
30};
31
33{
34 public:
35 static DVBStreamHandler *Get(const QString &devname, int inputid);
36 static void Return(DVBStreamHandler * & ref, int inputid);
37
38 // DVB specific
39
40 void RetuneMonitor(void);
41
42 bool IsRetuneAllowed(void) const { return m_allowRetune; }
43
44 void SetRetuneAllowed(bool allow,
45 DTVSignalMonitor *sigmon,
46 DVBChannel *dvbchan);
47
48 protected:
49 void run(void) override; // MThread
50
51 private:
52 explicit DVBStreamHandler(const QString &dvb_device, int inputid);
53
54 void RunTS(void);
55 void RunSR(void);
56
57 bool SupportsTSMonitoring(void);
58
59 protected:
60 void CycleFiltersByPriority(void) override; // StreamHandler
61 PIDInfo *CreatePIDInfo(uint pid, uint stream_type, int pes_type) override // StreamHandler
62 { return new DVBPIDInfo(pid, stream_type, pes_type); }
63
64 private:
65 QString m_dvrDevPath;
66 volatile bool m_allowRetune { false };
67
70 DeviceReadBuffer *m_drb { nullptr };
71
72 // for caching TS monitoring supported value.
74 static QMap<QString,bool> s_recSupportsTsMonitoring;
75
76 // for implementing Get & Return
77 static QMutex s_handlersLock;
78 static QMap<QString,DVBStreamHandler*> s_handlers;
79 static QMap<QString,uint> s_handlersRefCnt;
80};
81
82#endif // DVBSTREAMHANDLER_H
This class is intended to detect the presence of needed tables.
Provides interface to the tuning hardware when using DVB drivers.
Definition: dvbchannel.h:31
bool Close(const QString &dvb_dev) override
DVBPIDInfo(uint pid, uint stream_type, int pes_type)
DVBPIDInfo(uint pid)
bool Open(const QString &dvb_dev, bool use_section_reader) override
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
PIDInfo * CreatePIDInfo(uint pid, uint stream_type, int pes_type) override
DeviceReadBuffer * m_drb
static QMap< QString, DVBStreamHandler * > s_handlers
bool IsRetuneAllowed(void) const
void CycleFiltersByPriority(void) override
volatile bool m_allowRetune
DVBChannel * m_dvbChannel
DVBStreamHandler(const QString &dvb_device, int inputid)
void RunTS(void)
Uses TS filtering devices to read a DVB device for tables & data.
void SetRetuneAllowed(bool allow, DTVSignalMonitor *sigmon, DVBChannel *dvbchan)
static QMutex s_rec_supportsTsMonitoringLock
void RunSR(void)
Uses "Section" reader to read a DVB device for tables.
static QMap< QString, bool > s_recSupportsTsMonitoring
static QMutex s_handlersLock
DTVSignalMonitor * m_sigMon
static void Return(DVBStreamHandler *&ref, int inputid)
static DVBStreamHandler * Get(const QString &devname, int inputid)
bool SupportsTSMonitoring(void)
Returns true if TS monitoring is supported.
static QMap< QString, uint > s_handlersRefCnt
Buffers reads from device files.
unsigned int uint
Definition: compat.h:60