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