diff options
Diffstat (limited to 'toxmsi/phone.h')
-rw-r--r-- | toxmsi/phone.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/toxmsi/phone.h b/toxmsi/phone.h new file mode 100644 index 00000000..d661dcfd --- /dev/null +++ b/toxmsi/phone.h | |||
@@ -0,0 +1,62 @@ | |||
1 | #ifndef _PHONE_H_ | ||
2 | #define _PHONE_H_ | ||
3 | |||
4 | #include "toxmsi.h" | ||
5 | #include "../toxrtp/toxrtp.h" | ||
6 | #include "toxmsi_message.h" | ||
7 | #include "../toxrtp/toxrtp_message.h" | ||
8 | #include "../toxrtp/tests/test_helper.h" | ||
9 | #include <assert.h> | ||
10 | #include <pthread.h> | ||
11 | #include "AV_codec.h" | ||
12 | |||
13 | /* Define client version */ | ||
14 | #define _USERAGENT "tox_phone-v.0.2.1" | ||
15 | |||
16 | static pthread_mutex_t _mutex; | ||
17 | |||
18 | #define THREADLOCK() \ | ||
19 | pthread_mutex_lock ( &_mutex ); | ||
20 | |||
21 | #define THREADUNLOCK() \ | ||
22 | pthread_mutex_unlock ( &_mutex ); | ||
23 | |||
24 | typedef struct phone_s { | ||
25 | msi_session_t* _msi; | ||
26 | |||
27 | rtp_session_t* _rtp_audio; | ||
28 | rtp_session_t* _rtp_video; | ||
29 | |||
30 | uint32_t _frame_rate; | ||
31 | |||
32 | uint16_t _send_port, _recv_port; | ||
33 | |||
34 | int _tox_sock; | ||
35 | |||
36 | pthread_t _medialoop_id; | ||
37 | codec_state *cs; | ||
38 | |||
39 | Networking_Core* _networking; | ||
40 | } phone_t; | ||
41 | |||
42 | phone_t* initPhone(uint16_t _listen_port, uint16_t _send_port); | ||
43 | int quitPhone(phone_t* _phone); | ||
44 | |||
45 | /* My recv functions */ | ||
46 | int rtp_handlepacket ( void* _object, tox_IP_Port ip_port, uint8_t* data, uint32_t length ); | ||
47 | int msi_handlepacket ( void* _object, tox_IP_Port ip_port, uint8_t* data, uint32_t length ); | ||
48 | |||
49 | /* This is basically representation of networking_poll of toxcore */ | ||
50 | void* phone_receivepacket ( void* _phone ); | ||
51 | |||
52 | /* Phones main loop */ | ||
53 | void* phone_poll ( void* _phone ); | ||
54 | |||
55 | pthread_t phone_startmain_loop(phone_t* _phone); | ||
56 | pthread_t phone_startmedia_loop ( phone_t* _phone ); | ||
57 | |||
58 | /* Thread handlers */ | ||
59 | void* phone_handle_receive_callback ( void* _p ); | ||
60 | void* phone_handle_media_transport_poll ( void* _hmtc_args_p ); | ||
61 | |||
62 | #endif /* _PHONE_H_ */ | ||