MythTV  master
asistreamhandler.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef ASISTREAMHANDLER_H
4 #define ASISTREAMHANDLER_H
5 
6 #include <vector>
7 
8 #include <QString>
9 #include <QMutex>
10 #include <QMap>
11 
12 #include "streamhandler.h"
13 #include "mythdate.h"
14 
15 class ASIStreamHandler;
16 class DTVSignalMonitor;
17 class ASIChannel;
18 class DeviceReadBuffer;
19 
21 {
26 };
27 
29 {
36 };
37 
38 
39 //#define RETUNE_TIMEOUT 5000
40 
41 // Note : This class always uses a DRB && a TS reader.
42 
44 {
45  public:
46  static ASIStreamHandler *Get(const QString &devname, int inputid);
47  static void Return(ASIStreamHandler * & ref, int inputid);
48 
50  bool /*allow_section_reader*/ = false,
51  bool /*needs_drb*/ = false,
52  const QString& output_file = QString()) override // StreamHandler
53  {
54  StreamHandler::AddListener(data, false, true, output_file);
55  }
56 
58  void SetRXMode(ASIRXMode m);
59 
60  private:
61  explicit ASIStreamHandler(const QString &device, int inputid);
62 
63  bool Open(void);
64  void Close(void);
65 
66  void run(void) override; // MThread
67 
68  void PriorityEvent(int fd) override; // DeviceReaderCB
69 
70  void SetRunningDesired(bool desired) override; // StreamHandler
71 
72  private:
73  int m_deviceNum {-1};
74  int m_bufSize {-1};
75  int m_numBuffers {-1};
76  int m_fd {-1};
80  DeviceReadBuffer *m_drb {nullptr};
81 
82  // for implementing Get & Return
83  static QMutex s_handlersLock;
84  static QMap<QString, ASIStreamHandler*> s_handlers;
85  static QMap<QString, uint> s_handlersRefCnt;
86 };
87 
88 #endif // ASISTREAMHANDLER_H
ASIStreamHandler::m_packetSize
uint m_packetSize
Definition: asistreamhandler.h:77
kASIRXSyncOn188
@ kASIRXSyncOn188
Definition: asistreamhandler.h:31
kASIExternalClock2
@ kASIExternalClock2
Definition: asistreamhandler.h:25
streamhandler.h
kASIRecoveredReceiveClock
@ kASIRecoveredReceiveClock
Definition: asistreamhandler.h:24
ASIStreamHandler::s_handlers
static QMap< QString, ASIStreamHandler * > s_handlers
Definition: asistreamhandler.h:84
StreamHandler
Definition: streamhandler.h:54
ASIStreamHandler::m_fd
int m_fd
Definition: asistreamhandler.h:76
ASIStreamHandler
Definition: asistreamhandler.h:43
DeviceReadBuffer
Buffers reads from device files.
Definition: DeviceReadBuffer.h:34
ASIStreamHandler::m_bufSize
int m_bufSize
Definition: asistreamhandler.h:74
kASIInternalClock
@ kASIInternalClock
Definition: asistreamhandler.h:22
ASIStreamHandler::s_handlersRefCnt
static QMap< QString, uint > s_handlersRefCnt
Definition: asistreamhandler.h:85
ASIRXMode
ASIRXMode
Definition: asistreamhandler.h:28
mythdate.h
kASIRXSyncOn204ConvertTo188
@ kASIRXSyncOn204ConvertTo188
Definition: asistreamhandler.h:35
ASIStreamHandler::Get
static ASIStreamHandler * Get(const QString &devname, int inputid)
Definition: asistreamhandler.cpp:33
ASIStreamHandler::m_clockSource
ASIClockSource m_clockSource
Definition: asistreamhandler.h:78
MPEGStreamData
Encapsulates data about MPEG stream and emits events for each table.
Definition: mpegstreamdata.h:84
ASIStreamHandler::Return
static void Return(ASIStreamHandler *&ref, int inputid)
Definition: asistreamhandler.cpp:66
kASIRXRawMode
@ kASIRXRawMode
Definition: asistreamhandler.h:30
ASIStreamHandler::SetClockSource
void SetClockSource(ASIClockSource cs)
Definition: asistreamhandler.cpp:110
ASIStreamHandler::AddListener
void AddListener(MPEGStreamData *data, bool=false, bool=false, const QString &output_file=QString()) override
Definition: asistreamhandler.h:49
uint
unsigned int uint
Definition: compat.h:140
ASIStreamHandler::m_drb
DeviceReadBuffer * m_drb
Definition: asistreamhandler.h:80
ASIStreamHandler::m_rxMode
ASIRXMode m_rxMode
Definition: asistreamhandler.h:79
ASIStreamHandler::Open
bool Open(void)
Definition: asistreamhandler.cpp:261
ASIStreamHandler::s_handlersLock
static QMutex s_handlersLock
Definition: asistreamhandler.h:83
ASIClockSource
ASIClockSource
Definition: asistreamhandler.h:20
ASIStreamHandler::SetRunningDesired
void SetRunningDesired(bool desired) override
At minimum this sets _running_desired, this may also send signals to anything that might be blocking ...
Definition: asistreamhandler.cpp:124
ASIStreamHandler::Close
void Close(void)
Definition: asistreamhandler.cpp:336
ASIChannel
-*- Mode: c++ -*-
Definition: asichannel.h:14
kASIExternalClock
@ kASIExternalClock
Definition: asistreamhandler.h:23
ASIStreamHandler::PriorityEvent
void PriorityEvent(int fd) override
Definition: asistreamhandler.cpp:345
ASIStreamHandler::ASIStreamHandler
ASIStreamHandler(const QString &device, int inputid)
Definition: asistreamhandler.cpp:104
DTVSignalMonitor
This class is intended to detect the presence of needed tables.
Definition: dtvsignalmonitor.h:14
ASIStreamHandler::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: asistreamhandler.cpp:131
kASIRXSyncOnActualConvertTo188
@ kASIRXSyncOnActualConvertTo188
Definition: asistreamhandler.h:34
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
kASIRXSyncOn204
@ kASIRXSyncOn204
Definition: asistreamhandler.h:32
kASIRXSyncOnActualSize
@ kASIRXSyncOnActualSize
Definition: asistreamhandler.h:33
ASIStreamHandler::SetRXMode
void SetRXMode(ASIRXMode m)
Definition: asistreamhandler.cpp:117
ASIStreamHandler::m_deviceNum
int m_deviceNum
Definition: asistreamhandler.h:73
ASIStreamHandler::m_numBuffers
int m_numBuffers
Definition: asistreamhandler.h:75
TSPacket::kSize
static constexpr unsigned int kSize
Definition: tspacket.h:223