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 #include <QMutex>
10 #include <QMap>
11 
12 // MythTV headers
13 #include "mpegstreamdata.h"
14 #include "streamhandler.h"
15 #include "dtvmultiplex.h"
16 #include "dtvconfparserhelpers.h"
17 #include "satiprtsp.h"
18 
19 class SatIPStreamHandler;
20 class DTVSignalMonitor;
21 class SatIPChannel;
22 class DeviceReadBuffer;
23 
25 {
26  friend class SatIPRTSPWriteHelper;
27  friend class SatIPRTSPReadHelper;
28  friend class SatIPSignalMonitor;
29 
30  public:
31  static SatIPStreamHandler *Get(const QString &devname, int inputid);
32  static void Return(SatIPStreamHandler * & ref, int inputid);
33 
35  bool /*allow_section_reader*/ = false,
36  bool /*needs_drb*/ = false,
37  const QString& output_file = QString()) override // StreamHandler
38  {
39  StreamHandler::AddListener(data, false, false, output_file);
40  } // StreamHandler
41 
42  bool UpdateFilters() override; // StreamHandler
43  bool Tune(const DTVMultiplex &tuning);
44 
45  private:
46  explicit SatIPStreamHandler(const QString & device, int inputid);
47 
48  bool Open(void);
49  void Close(void);
50 
51  void run(void) override; // MThread
52 
53  // For implementing Get & Return
54  static QMap<QString, SatIPStreamHandler*> s_handlers;
55  static QMap<QString, uint> s_handlersRefCnt;
56  static QMutex s_handlersLock;
57 
58  public:
59  int m_inputId {0};
60 
61  private:
63  QString m_device;
64  uint m_frontend {UINT_MAX};
65  QUrl m_baseurl;
68  bool m_setupinvoked {false};
69  QMutex m_tunelock {QMutex::Recursive};
70  QStringList m_oldpids;
71 
72  protected:
73  SatIPRTSP *m_rtsp {nullptr};
74 };
75 
76 #endif // _SATIPSTREAMHANDLER_H_
SatIPRTSPReadHelper
Definition: satiprtsp.h:29
SatIPSignalMonitor
Definition: satipsignalmonitor.h:11
DTVMultiplex
Definition: dtvmultiplex.h:24
streamhandler.h
StreamHandler
Definition: streamhandler.h:54
SatIPStreamHandler::m_tuningurl
QUrl m_tuningurl
Definition: satipstreamhandler.h:66
SatIPStreamHandler::m_rtsp
SatIPRTSP * m_rtsp
Definition: satipstreamhandler.h:73
SatIPRTSPWriteHelper
Definition: satiprtsp.h:71
SatIPStreamHandler::m_oldtuningurl
QUrl m_oldtuningurl
Definition: satipstreamhandler.h:67
DeviceReadBuffer
Buffers reads from device files.
Definition: DeviceReadBuffer.h:34
dtvmultiplex.h
SatIPStreamHandler::s_handlersRefCnt
static QMap< QString, uint > s_handlersRefCnt
Definition: satipstreamhandler.h:55
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:305
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:62
SatIPStreamHandler::SatIPStreamHandler
SatIPStreamHandler(const QString &device, int inputid)
Definition: satipstreamhandler.cpp:106
uint
unsigned int uint
Definition: compat.h:141
mpegstreamdata.h
SatIPStreamHandler::Close
void Close(void)
Definition: satipstreamhandler.cpp:343
SatIPStreamHandler::m_tunelock
QMutex m_tunelock
Definition: satipstreamhandler.h:69
SatIPStreamHandler::AddListener
void AddListener(MPEGStreamData *data, bool=false, bool=false, const QString &output_file=QString()) override
Definition: satipstreamhandler.h:34
SatIPStreamHandler::m_baseurl
QUrl m_baseurl
Definition: satipstreamhandler.h:65
SatIPStreamHandler::UpdateFilters
bool UpdateFilters() override
Definition: satipstreamhandler.cpp:118
satiprtsp.h
SatIPStreamHandler::s_handlersLock
static QMutex s_handlersLock
Definition: satipstreamhandler.h:56
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:68
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::Tune
bool Tune(const DTVMultiplex &tuning)
Definition: satipstreamhandler.cpp:214
SatIPStreamHandler::s_handlers
static QMap< QString, SatIPStreamHandler * > s_handlers
Definition: satipstreamhandler.h:54
dtvconfparserhelpers.h
SatIPStreamHandler::m_device
QString m_device
Definition: satipstreamhandler.h:63
SatIPStreamHandler::m_inputId
int m_inputId
Definition: satipstreamhandler.h:59
SatIPStreamHandler
Definition: satipstreamhandler.h:24
SatIPStreamHandler::m_oldpids
QStringList m_oldpids
Definition: satipstreamhandler.h:70
SatIPStreamHandler::m_frontend
uint m_frontend
Definition: satipstreamhandler.h:64