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 private:
49 explicit DVBStreamHandler(const QString &dvb_device, int inputid);
50
51 void run(void) override; // MThread
52 void RunTS(void);
53 void RunSR(void);
54
55 void CycleFiltersByPriority(void) override; // StreamHandler
56
57 bool SupportsTSMonitoring(void);
58
59 PIDInfo *CreatePIDInfo(uint pid, uint stream_type, int pes_type) override // StreamHandler
60 { return new DVBPIDInfo(pid, stream_type, pes_type); }
61
62 private:
63 QString m_dvrDevPath;
64 volatile bool m_allowRetune { false };
65
68 DeviceReadBuffer *m_drb { nullptr };
69
70 // for caching TS monitoring supported value.
72 static QMap<QString,bool> s_recSupportsTsMonitoring;
73
74 // for implementing Get & Return
75 static QMutex s_handlersLock;
76 static QMap<QString,DVBStreamHandler*> s_handlers;
77 static QMap<QString,uint> s_handlersRefCnt;
78};
79
80#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: freesurround.h:24