forked from sd007/SimpleSipClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mediaclient.h
115 lines (97 loc) · 2.81 KB
/
mediaclient.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef MEDIACLIENT_H
#define MEDIACLIENT_H
#include <QObject>
#include <QWidget>
#include <QPushButton>
#include "defines.h"
#include <QMap>
#include <QLabel>
#include <QLineEdit>
#include <QByteArray>
#include <QTimer>
#include "defines.h"
#include "rtprecver.h"
#include "frameresolve/sms.h"
#include "frameresolve/access.h"
#include "decoder/decoder.h"
#include "imagelabel.h"
class MediaClient : public QWidget
{
Q_OBJECT
public:
explicit MediaClient(QWidget *parent = 0);
~MediaClient();
public:
void setUpUI();
void initDecoder();
void initRecver(QString ip, QString port, QString code);
void setClientParamContext();
pj_status_t initPJlib();
pj_status_t initSipMoudle(QString endptName, unsigned short tsxPort);
pj_status_t registerClient(SIPClient &cltparam);
pj_status_t unregisterClient(SIPClient &cltparam);
void destroy();
void startEventLoop();
bool sendInvite(QString deviceid, QString mediaRecvIp, short mediaRecvPort);
int sendBye();
void queryDeviveInfo(QString deviceid, QString cmdType = QString("Catalog"));
void sendKeepAlive(QString deviceid);
//thread
static int keepAlive_thread(void *arg);
static int eventloop_thread(void *arg);
//callback
static pj_bool_t on_rx_request( pjsip_rx_data *rdata );
//decode
Decoder *m_avDecoder = Q_NULLPTR;
private:
QString createPlaySDP(QString fromDeviceid, QString mediaRecvIp, unsigned short mediaRecvPort);
int initInvParam(TransportContext &tsxContext);
void messageResolve(char *txt);
private:
TransportContext m_tsxContext;
SIPClient m_sipClientparam;
pjsip_dialog *m_invitedlg;
pjsip_inv_session *m_invsession;
pj_caching_pool m_caching_pool;
pj_pool_t *m_sipPool;
static pjsip_endpoint *m_sipEndpt;
static bool quit_flag;
bool m_invInit = false;
pj_thread_t *m_keepalivethread;
pj_thread_t *m_eventloopthread;
LocalSipType m_localSipType;
//ui
QWidget *m_widget;
QLabel *m_lbserverip;
QLineEdit *m_edserverip;
QLabel *m_lbServid;
QLineEdit *m_edServid;
QLabel *m_lbServSipport;
QLineEdit *m_edServSipport;
QLabel *m_lbclientip;
QLineEdit *m_edclientip;
QLabel *m_lbClientID;
QLineEdit *m_edClientID;
QLabel *m_lbclientSipport;
QLineEdit *m_edclientSipport;
QLabel *m_lbmediarecvip;
QLineEdit *m_edmediarecvip;
QLabel *m_lbmediarecvport;
QLineEdit *m_edmediarecvport;
ImageLabel *m_imgLabel;
QLabel *m_lbmediaDeviceId;
QLineEdit *m_edmediaDeviceId;
QPushButton *m_btreg;
QPushButton *m_btplay;
QPushButton *m_btstop;
RtpRecver *m_rtpRecver;
//send to web
Access *m_access;
signals:
public slots:
void onRegister();
void onStop();
void onPlay();
void onRecvedFrame(QByteArray buff);
};
#endif // MEDIACLIENT_H