MythTV  master
linuxfirewiredevice.h
Go to the documentation of this file.
1 
7 #ifndef LINUX_FIREWIRE_DEVICE_H
8 #define LINUX_FIREWIRE_DEVICE_H
9 
10 #include <QRunnable>
11 
12 #include "firewiredevice.h"
13 #include "mthread.h"
14 
15 class LFDPriv;
16 class LinuxAVCInfo;
18 
19 class LinuxFirewireDevice : public FirewireDevice, public QRunnable
20 {
22  unsigned char *tspacket, int len, uint dropped, void *callback_data);
23 
24  public:
25  LinuxFirewireDevice(uint64_t guid, uint subunitid,
26  uint speed, bool use_p2p,
27  uint av_buffer_size_in_bytes = 0);
28  ~LinuxFirewireDevice() override;
29 
30  // Commands
31  bool OpenPort(void) override; // FirewireDevice
32  bool ClosePort(void) override; // FirewireDevice
33  bool ResetBus(void) override; // FirewireDevice
34 
35  void AddListener(TSDataListener *listener) override; // FirewireDevice
36  void RemoveListener(TSDataListener *listener) override; // FirewireDevice
37 
38  // Gets
39  bool IsPortOpen(void) const override; // FirewireDevice
40 
41  // Signal from driver
42  void SignalReset(uint generation);
43 
44  // Statics
45  static std::vector<AVCInfo> GetSTBList(void);
46 
47  // Constants
48  static const uint kBroadcastChannel;
49  static const uint kConnectionP2P;
50  static const uint kConnectionBroadcast;
51  static const uint kMaxBufferedPackets;
52 
53  private:
54  bool OpenNode(void);
55  bool CloseNode(void);
56 
57  bool OpenAVStream(void);
58  bool CloseAVStream(void);
59 
60  bool OpenP2PNode(void);
61  bool CloseP2PNode(void);
62 
63  bool OpenBroadcastNode(void);
64  bool CloseBroadcastNode(void);
65 
66  bool StartStreaming(void);
67  bool StopStreaming(void);
68 
69  void run(void) override; // QRunnable
70  void PrintDropped(uint dropped_packets);
71 
72  bool SetAVStreamBufferSize(uint size_in_bytes);
73  bool SetAVStreamSpeed(uint speed);
74 
75  bool IsNodeOpen(void) const;
76  bool IsAVStreamOpen(void) const;
77 
78  bool UpdateDeviceList(void);
79  void UpdateDeviceListItem(uint64_t guid, void *pitem);
80  std::vector<AVCInfo> GetSTBListPrivate(void);
81 
82  bool SendAVCCommand(const std::vector<uint8_t> &cmd,
83  std::vector<uint8_t> &result,
84  int retry_cnt) override; // FirewireDevice
85 
86  LinuxAVCInfo *GetInfoPtr(void);
87  const LinuxAVCInfo *GetInfoPtr(void) const;
88 
89  void HandleBusReset(void);
90 
91  private:
93  bool m_dbResetDisabled {false};
94  bool m_useP2P;
95  LFDPriv *m_priv {nullptr};
96 };
97 
98 #endif // LINUX_FIREWIRE_DEVICE_H
LinuxFirewireDevice::m_useP2P
bool m_useP2P
Definition: linuxfirewiredevice.h:94
LinuxFirewireDevice::CloseP2PNode
bool CloseP2PNode(void)
Definition: linuxfirewiredevice.cpp:440
LinuxFirewireDevice::SignalReset
void SignalReset(uint generation)
Definition: linuxfirewiredevice.cpp:152
LinuxFirewireDevice::AddListener
void AddListener(TSDataListener *listener) override
Definition: linuxfirewiredevice.cpp:337
LinuxFirewireDevice::LinuxFirewireDevice
LinuxFirewireDevice(uint64_t guid, uint subunitid, uint speed, bool use_p2p, uint av_buffer_size_in_bytes=0)
Definition: linuxfirewiredevice.cpp:121
LinuxAVCInfo
Definition: linuxavcinfo.h:22
LinuxFirewireDevice::GetSTBList
static std::vector< AVCInfo > GetSTBList(void)
Definition: linuxfirewiredevice.cpp:799
LinuxFirewireDevice::IsAVStreamOpen
bool IsAVStreamOpen(void) const
Definition: linuxfirewiredevice.cpp:760
LinuxFirewireDevice::OpenAVStream
bool OpenAVStream(void)
Definition: linuxfirewiredevice.cpp:521
LinuxFirewireDevice::OpenP2PNode
bool OpenP2PNode(void)
Definition: linuxfirewiredevice.cpp:406
LinuxFirewireDevice::OpenPort
bool OpenPort(void) override
Definition: linuxfirewiredevice.cpp:228
LinuxFirewireDevice::m_priv
LFDPriv * m_priv
Definition: linuxfirewiredevice.h:95
firewiredevice.h
LinuxFirewireDevice::GetInfoPtr
LinuxAVCInfo * GetInfoPtr(void)
Definition: linuxfirewiredevice.cpp:945
LinuxFirewireDevice::CloseBroadcastNode
bool CloseBroadcastNode(void)
Definition: linuxfirewiredevice.cpp:507
TSDataListener
Definition: streamlisteners.h:52
LinuxFirewireDevice::IsNodeOpen
bool IsNodeOpen(void) const
Definition: linuxfirewiredevice.cpp:755
LinuxFirewireDevice::UpdateDeviceListItem
void UpdateDeviceListItem(uint64_t guid, void *pitem)
Definition: linuxfirewiredevice.cpp:920
LinuxFirewireDevice::GetSTBListPrivate
std::vector< AVCInfo > GetSTBListPrivate(void)
Definition: linuxfirewiredevice.cpp:811
LinuxFirewireDevice
Definition: linuxfirewiredevice.h:19
LinuxFirewireDevice::kBroadcastChannel
static const uint kBroadcastChannel
Definition: linuxfirewiredevice.h:48
LinuxFirewireDevice::ClosePort
bool ClosePort(void) override
Definition: linuxfirewiredevice.cpp:288
LinuxFirewireDevice::SendAVCCommand
bool SendAVCCommand(const std::vector< uint8_t > &cmd, std::vector< uint8_t > &result, int retry_cnt) override
Definition: linuxfirewiredevice.cpp:365
LinuxFirewireDevice::m_bufsz
uint m_bufsz
Definition: linuxfirewiredevice.h:92
LinuxFirewireDevice::~LinuxFirewireDevice
~LinuxFirewireDevice() override
Definition: linuxfirewiredevice.cpp:136
LinuxFirewireDevice::linux_firewire_device_tspacket_handler
friend int linux_firewire_device_tspacket_handler(unsigned char *tspacket, int len, uint dropped, void *callback_data)
Definition: linuxfirewiredevice.cpp:963
LinuxFirewireDevice::CloseNode
bool CloseNode(void)
Definition: linuxfirewiredevice.cpp:393
LinuxFirewireDevice::m_dbResetDisabled
bool m_dbResetDisabled
Definition: linuxfirewiredevice.h:93
LinuxFirewireDevice::HandleBusReset
void HandleBusReset(void)
Definition: linuxfirewiredevice.cpp:172
LinuxFirewireDevice::OpenBroadcastNode
bool OpenBroadcastNode(void)
Definition: linuxfirewiredevice.cpp:466
LinuxFirewireDevice::SetAVStreamBufferSize
bool SetAVStreamBufferSize(uint size_in_bytes)
Definition: linuxfirewiredevice.cpp:708
LinuxFirewireDevice::StartStreaming
bool StartStreaming(void)
Definition: linuxfirewiredevice.cpp:660
LinuxFirewireDevice::kConnectionP2P
static const uint kConnectionP2P
Definition: linuxfirewiredevice.h:49
LinuxFirewireDevice::kMaxBufferedPackets
static const uint kMaxBufferedPackets
Definition: linuxfirewiredevice.h:51
uint
unsigned int uint
Definition: compat.h:141
LinuxFirewireDevice::StopStreaming
bool StopStreaming(void)
Definition: linuxfirewiredevice.cpp:690
LinuxFirewireDevice::run
void run(void) override
Definition: linuxfirewiredevice.cpp:578
LinuxFirewireDevice::CloseAVStream
bool CloseAVStream(void)
Definition: linuxfirewiredevice.cpp:559
LinuxFirewireDevice::SetAVStreamSpeed
bool SetAVStreamSpeed(uint speed)
Definition: linuxfirewiredevice.cpp:725
LinuxFirewireDevice::PrintDropped
void PrintDropped(uint dropped_packets)
Definition: linuxfirewiredevice.cpp:786
LinuxFirewireDevice::IsPortOpen
bool IsPortOpen(void) const override
Definition: linuxfirewiredevice.cpp:373
LinuxFirewireDevice::kConnectionBroadcast
static const uint kConnectionBroadcast
Definition: linuxfirewiredevice.h:50
mthread.h
LinuxFirewireDevice::ResetBus
bool ResetBus(void) override
Definition: linuxfirewiredevice.cpp:765
LinuxFirewireDevice::RemoveListener
void RemoveListener(TSDataListener *listener) override
Definition: linuxfirewiredevice.cpp:351
LinuxFirewireDevice::UpdateDeviceList
bool UpdateDeviceList(void)
Definition: linuxfirewiredevice.cpp:845
LFDPriv
Definition: linuxfirewiredevice.cpp:47
LinuxFirewireDevice::OpenNode
bool OpenNode(void)
Definition: linuxfirewiredevice.cpp:386
FirewireDevice
Definition: firewiredevice.h:23