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);
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*) override; // FirewireDevice
36  void RemoveListener(TSDataListener*) 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 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  vector<AVCInfo> GetSTBListPrivate(void);
81 
82  bool SendAVCCommand(const vector<uint8_t> &cmd,
83  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_db_reset_disabled {false};
94  bool m_use_p2p;
95  LFDPriv *m_priv {nullptr};
96 };
97 
98 #endif // _LINUX_FIREWIRE_DEVICE_H_
bool ResetBus(void) override
void UpdateDeviceListItem(uint64_t guid, void *pitem)
LinuxFirewireDevice(uint64_t guid, uint subunitid, uint speed, bool use_p2p, uint av_buffer_size_in_bytes=0)
static const uint kConnectionP2P
static const uint kBroadcastChannel
bool IsAVStreamOpen(void) const
bool SendAVCCommand(const vector< uint8_t > &cmd, vector< uint8_t > &result, int retry_cnt) override
static vector< AVCInfo > GetSTBList(void)
void AddListener(TSDataListener *) override
void run(void) override
bool SetAVStreamSpeed(uint speed)
void RemoveListener(TSDataListener *) override
bool SetAVStreamBufferSize(uint size_in_bytes)
friend int linux_firewire_device_tspacket_handler(unsigned char *tspacket, int len, uint dropped, void *callback_data)
unsigned int uint
Definition: compat.h:140
vector< AVCInfo > GetSTBListPrivate(void)
LinuxAVCInfo * GetInfoPtr(void)
static const uint kMaxBufferedPackets
bool IsNodeOpen(void) const
bool OpenPort(void) override
void SignalReset(uint generation)
void PrintDropped(uint dropped_packets)
static const uint kConnectionBroadcast
bool ClosePort(void) override
bool IsPortOpen(void) const override