SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
datvideostream.h
Go to the documentation of this file.
1 // Copyright (C) 2018 F4HKW //
3 // for F4EXB / SDRAngel //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef DATVIDEOSTREAM_H
20 #define DATVIDEOSTREAM_H
21 
22 #include <QIODevice>
23 #include <QQueue>
24 #include <QByteArray>
25 #include <QEventLoop>
26 #include <QMutex>
27 #include <QThread>
28 
29 #define MinStackSize 4
30 #define DefaultMemoryLimit 2048000
31 
32 class DATVideostream : public QIODevice
33 {
34  Q_OBJECT
35 
36 public:
39 
42 
43  int pushData(const char * chrData, int intSize);
44  bool setMemoryLimit(int intMemoryLimit);
45 
46  virtual bool isSequential() const;
47  virtual qint64 bytesAvailable() const;
48  virtual void close();
49  virtual bool open(OpenMode mode);
50 
51  QQueue<QByteArray> m_objFIFO;
52 
53 signals:
54 
55  void onDataAvailable();
56  void onDataPackets(int *intDataPackets, int *intDataBytes, int *intPercentBuffer,qint64 *intTotalReceived);
57 
58 protected:
59 
60  virtual qint64 readData(char *data, qint64 len);
61  virtual qint64 writeData(const char *data, qint64 len);
62  virtual qint64 readLineData(char *data, qint64 maxSize);
63 
64 private:
65 
66  QEventLoop m_objeventLoop;
67  QMutex m_objMutex;
75 
76  void cleanUp();
77 };
78 
79 #endif // DATVIDEOSTREAM_H
QEventLoop m_objeventLoop
virtual void close()
virtual bool isSequential() const
bool setMemoryLimit(int intMemoryLimit)
virtual qint64 readData(char *data, qint64 len)
QQueue< QByteArray > m_objFIFO
qint64 m_intTotalReceived
int pushData(const char *chrData, int intSize)
void onDataAvailable()
virtual qint64 writeData(const char *data, qint64 len)
virtual qint64 bytesAvailable() const
qint64 m_intPacketReceived
virtual qint64 readLineData(char *data, qint64 maxSize)
virtual bool open(OpenMode mode)
void onDataPackets(int *intDataPackets, int *intDataBytes, int *intPercentBuffer, qint64 *intTotalReceived)