MythTV  master
satipstreamhandler.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef _SATIPSTREAMHANDLER_H_
4 #define _SATIPSTREAMHANDLER_H_
5 
6 // Qt headers
7 #include <QString>
8 #include <QStringList>
9 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
10 #include <QMutex>
11 #else
12 #include <QRecursiveMutex>
13 #endif
14 #include <QMap>
15 
16 // MythTV headers
17 #include "mpegstreamdata.h"
18 #include "streamhandler.h"
19 #include "dtvmultiplex.h"
20 #include "dtvconfparserhelpers.h"
21 #include "satiprtsp.h"
22 
23 class SatIPStreamHandler;
24 class DTVSignalMonitor;
25 class SatIPChannel;
26 class DeviceReadBuffer;
27 
29 {
30  friend class SatIPRTSPWriteHelper;
31  friend class SatIPRTSPReadHelper;
32  friend class SatIPSignalMonitor;
33 
34  public:
35  static SatIPStreamHandler *Get(const QString &devname, int inputid);
36  static void Return(SatIPStreamHandler * & ref, int inputid);
37 
39  bool /*allow_section_reader*/ = false,
40  bool /*needs_drb*/ = false,
41  const QString& output_file = QString()) override // StreamHandler
42  {
43  StreamHandler::AddListener(data, false, false, output_file);
44  } // StreamHandler
45 
46  bool UpdateFilters() override; // StreamHandler
47  bool Tune(const DTVMultiplex &tuning);
48 
49  private:
50  explicit SatIPStreamHandler(const QString & device, int inputid);
51 
52  bool Open(void);
53  void Close(void);
54 
55  void run(void) override; // MThread
56 
57  // For implementing Get & Return
58  static QMap<QString, SatIPStreamHandler*> s_handlers;
59  static QMap<QString, uint> s_handlersRefCnt;
60  static QMutex s_handlersLock;
61 
62  public:
63  int m_inputId {0};
64 
65  private:
67  QString m_device;
68  uint m_frontend {UINT_MAX};
69  QUrl m_baseurl;
72  bool m_setupinvoked {false};
73 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
74  QMutex m_tunelock {QMutex::Recursive};
75 #else
76  QRecursiveMutex m_tunelock;
77 #endif
78  QStringList m_oldpids;
79 
80  protected:
81  SatIPRTSP *m_rtsp {nullptr};
82 };
83 
84 #endif // _SATIPSTREAMHANDLER_H_
SatIPRTSPReadHelper
Definition: satiprtsp.h:29
SatIPSignalMonitor
Definition: satipsignalmonitor.h:11
DTVMultiplex
Definition: dtvmultiplex.h:24
streamhandler.h
StreamHandler
Definition: streamhandler.h:57
SatIPStreamHandler::m_tuningurl
QUrl m_tuningurl
Definition: satipstreamhandler.h:70
SatIPStreamHandler::m_rtsp
SatIPRTSP * m_rtsp
Definition: satipstreamhandler.h:81
SatIPRTSPWriteHelper
Definition: satiprtsp.h:71
SatIPStreamHandler::m_oldtuningurl
QUrl m_oldtuningurl
Definition: satipstreamhandler.h:71
DeviceReadBuffer
Buffers reads from device files.
Definition: DeviceReadBuffer.h:34
dtvmultiplex.h
SatIPStreamHandler::s_handlersRefCnt
static QMap< QString, uint > s_handlersRefCnt
Definition: satipstreamhandler.h:59
DTVTunerType
Definition: dtvconfparserhelpers.h:76
SatIPChannel
Definition: satipchannel.h:12
SatIPStreamHandler::Return
static void Return(SatIPStreamHandler *&ref, int inputid)
Definition: satipstreamhandler.cpp:61
SatIPStreamHandler::Open
bool Open(void)
Definition: satipstreamhandler.cpp:306
MPEGStreamData
Encapsulates data about MPEG stream and emits events for each table.
Definition: mpegstreamdata.h:84
SatIPStreamHandler::m_tunerType
DTVTunerType m_tunerType
Definition: satipstreamhandler.h:66
SatIPStreamHandler::SatIPStreamHandler
SatIPStreamHandler(const QString &device, int inputid)
Definition: satipstreamhandler.cpp:106
uint
unsigned int uint
Definition: compat.h:140
mpegstreamdata.h
SatIPStreamHandler::Close
void Close(void)
Definition: satipstreamhandler.cpp:344
SatIPStreamHandler::AddListener
void AddListener(MPEGStreamData *data, bool=false, bool=false, const QString &output_file=QString()) override
Definition: satipstreamhandler.h:38
SatIPStreamHandler::m_baseurl
QUrl m_baseurl
Definition: satipstreamhandler.h:69
SatIPStreamHandler::UpdateFilters
bool UpdateFilters() override
Definition: satipstreamhandler.cpp:118
satiprtsp.h
SatIPStreamHandler::s_handlersLock
static QMutex s_handlersLock
Definition: satipstreamhandler.h:60
SatIPStreamHandler::run
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: satipstreamhandler.cpp:151
SatIPRTSP
Definition: satiprtsp.h:92
DTVSignalMonitor
This class is intended to detect the presence of needed tables.
Definition: dtvsignalmonitor.h:14
SatIPStreamHandler::Get
static SatIPStreamHandler * Get(const QString &devname, int inputid)
Definition: satipstreamhandler.cpp:30
SatIPStreamHandler::m_setupinvoked
bool m_setupinvoked
Definition: satipstreamhandler.h:72
StreamHandler::AddListener
virtual void AddListener(MPEGStreamData *data, bool allow_section_reader=false, bool needs_buffering=false, const QString &output_file=QString())
Definition: streamhandler.cpp:33
SatIPStreamHandler::m_tunelock
QRecursiveMutex m_tunelock
Definition: satipstreamhandler.h:76
SatIPStreamHandler::Tune
bool Tune(const DTVMultiplex &tuning)
Definition: satipstreamhandler.cpp:215
SatIPStreamHandler::s_handlers
static QMap< QString, SatIPStreamHandler * > s_handlers
Definition: satipstreamhandler.h:58
dtvconfparserhelpers.h
SatIPStreamHandler::m_device
QString m_device
Definition: satipstreamhandler.h:67
SatIPStreamHandler::m_inputId
int m_inputId
Definition: satipstreamhandler.h:63
SatIPStreamHandler
Definition: satipstreamhandler.h:28
SatIPStreamHandler::m_oldpids
QStringList m_oldpids
Definition: satipstreamhandler.h:78
SatIPStreamHandler::m_frontend
uint m_frontend
Definition: satipstreamhandler.h:68