-
Notifications
You must be signed in to change notification settings - Fork 1
/
liveviewthread.h
96 lines (70 loc) · 1.69 KB
/
liveviewthread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef LIVEVIEWTHREAD_H
#define LIVEVIEWTHREAD_H
#include <QObject>
#include <QThread>
#include <QDebug>
//#include <QSemaphore>
#include <QTime>
#include "common.h"
class QNetworkAccessManager;
class QNetworkReply;
class RingBuffer;
class NetworkConnection;
class LiveViewProducer : public QThread
{
Q_OBJECT
public:
explicit LiveViewProducer(NetworkConnection *networkConnection,QObject *parent);
void run();
void setLiveViewRequest(QString liveViewRequest);
void stop();
private slots:
void onLiveViewManagerReadyRead();
signals:
void publishProducerStarted();
void newByteReached();
void publishLiveViewStreamStatus(bool);
private:
//QNetworkAccessManager *liveViewManager;
QNetworkReply *liveReply;
NetworkConnection *_networkConnection;
QString _liveViewRequest;
bool liveViewStreamAlive;
//QByteArray replyBuffer;
};
class LiveViewConsumer : public QThread
{
Q_OBJECT
public:
explicit LiveViewConsumer(QObject *parent = 0);
void setInputStream(QNetworkReply *reply);
signals:
void publishLiveViewBytes(QByteArray bytes);
public slots:
void awakeConsumer();
void sleepConsumer();
private:
//RingBuffer *ringBuffer;
QNetworkReply *_reply;
void buildLiveView();
virtual void run();
int offset;
uint64_t starttime;
uint64_t endtime;
uint64_t foundstartOffset;
int arrayiter;
bool foundstart;
bool foundend;
bool carry;
int jpegSize ;//34048;
int hjpegSize ;
int paddingSize ;
//bool liveViewStreamAlive;
//char *consumerP;
#ifdef _USESTREAM
QDataStream inputStream;
#else
QByteArray inputStream;
#endif
};
#endif // LIVEVIEWTHREAD_H