diff options
author | mannol <eniz_vukovic@hotmail.com> | 2014-11-18 00:46:46 +0100 |
---|---|---|
committer | mannol <eniz_vukovic@hotmail.com> | 2014-11-18 00:46:46 +0100 |
commit | 386c9748d48d3bb4513e8e5c32e2b30a4d6a00d4 (patch) | |
tree | 55d0fb2e9fb6e1149317b9de355c28dd86c57014 /toxav/rtp.h | |
parent | 4e6f993e7d22865ee2ac90bd7dd3ff25b078c55c (diff) |
av refactor
Diffstat (limited to 'toxav/rtp.h')
-rw-r--r-- | toxav/rtp.h | 97 |
1 files changed, 17 insertions, 80 deletions
diff --git a/toxav/rtp.h b/toxav/rtp.h index d57c5ef7..0b481eb8 100644 --- a/toxav/rtp.h +++ b/toxav/rtp.h | |||
@@ -24,19 +24,15 @@ | |||
24 | 24 | ||
25 | #define RTP_VERSION 2 | 25 | #define RTP_VERSION 2 |
26 | #include <inttypes.h> | 26 | #include <inttypes.h> |
27 | #include <pthread.h> | 27 | // #include <pthread.h> |
28 | 28 | ||
29 | #include "../toxcore/util.h" | ||
30 | #include "../toxcore/network.h" | ||
31 | #include "../toxcore/net_crypto.h" | ||
32 | #include "../toxcore/Messenger.h" | 29 | #include "../toxcore/Messenger.h" |
33 | 30 | ||
34 | #define MAX_SEQU_NUM 65535 | 31 | #define MAX_SEQU_NUM 65535 |
35 | #define MAX_RTP_SIZE 65535 | 32 | #define MAX_RTP_SIZE 65535 |
36 | 33 | ||
37 | /** | 34 | /** |
38 | * @brief Standard rtp header | 35 | * Standard rtp header |
39 | * | ||
40 | */ | 36 | */ |
41 | 37 | ||
42 | typedef struct _RTPHeader { | 38 | typedef struct _RTPHeader { |
@@ -52,8 +48,7 @@ typedef struct _RTPHeader { | |||
52 | 48 | ||
53 | 49 | ||
54 | /** | 50 | /** |
55 | * @brief Standard rtp extension header. | 51 | * Standard rtp extension header. |
56 | * | ||
57 | */ | 52 | */ |
58 | typedef struct _RTPExtHeader { | 53 | typedef struct _RTPExtHeader { |
59 | uint16_t type; /* Extension profile */ | 54 | uint16_t type; /* Extension profile */ |
@@ -64,8 +59,7 @@ typedef struct _RTPExtHeader { | |||
64 | 59 | ||
65 | 60 | ||
66 | /** | 61 | /** |
67 | * @brief Standard rtp message. | 62 | * Standard rtp message. |
68 | * | ||
69 | */ | 63 | */ |
70 | typedef struct _RTPMessage { | 64 | typedef struct _RTPMessage { |
71 | RTPHeader *header; | 65 | RTPHeader *header; |
@@ -79,11 +73,11 @@ typedef struct _RTPMessage { | |||
79 | 73 | ||
80 | 74 | ||
81 | /** | 75 | /** |
82 | * @brief Our main session descriptor. | 76 | * Our main session descriptor. |
83 | * It measures the session variables and controls | 77 | * It measures the session variables and controls |
84 | * the entire session. There are functions for manipulating | 78 | * the entire session. There are functions for manipulating |
85 | * the session so tend to use those instead of directly modifying | 79 | * the session so tend to use those instead of directly modifying |
86 | * session parameters. | 80 | * session parameters. |
87 | * | 81 | * |
88 | */ | 82 | */ |
89 | typedef struct _RTPSession { | 83 | typedef struct _RTPSession { |
@@ -109,88 +103,31 @@ typedef struct _RTPSession { | |||
109 | uint8_t prefix; | 103 | uint8_t prefix; |
110 | 104 | ||
111 | int dest; | 105 | int dest; |
112 | int32_t call_index; | ||
113 | struct _ToxAv *av; | ||
114 | 106 | ||
107 | struct _CSSession *cs; | ||
108 | |||
115 | } RTPSession; | 109 | } RTPSession; |
116 | 110 | ||
117 | |||
118 | /** | ||
119 | * @brief Release all messages held by session. | ||
120 | * | ||
121 | * @param session The session. | ||
122 | * @return int | ||
123 | * @retval -1 Error occurred. | ||
124 | * @retval 0 Success. | ||
125 | */ | ||
126 | int rtp_release_session_recv ( RTPSession *session ); | ||
127 | |||
128 | |||
129 | /** | 111 | /** |
130 | * @brief Call this to change queue limit | 112 | * Must be called before calling any other rtp function. |
131 | * | ||
132 | * @param session The session | ||
133 | * @param limit new limit | ||
134 | * @return void | ||
135 | */ | 113 | */ |
136 | void rtp_queue_adjust_limit ( RTPSession *session, uint64_t limit ); | 114 | RTPSession *rtp_new ( int payload_type, Messenger *messenger, int friend_num ); |
137 | 115 | ||
138 | /** | 116 | /** |
139 | * @brief Get's oldest message in the list. | 117 | * Terminate the session. |
140 | * | ||
141 | * @param session Where the list is. | ||
142 | * @return RTPMessage* The message. You need to call rtp_msg_free() to free it. | ||
143 | * @retval NULL No messages in the list, or no list. | ||
144 | */ | 118 | */ |
145 | RTPMessage *rtp_recv_msg ( RTPSession *session ); | 119 | void rtp_kill ( RTPSession *session, Messenger *messenger ); |
146 | |||
147 | 120 | ||
148 | /** | 121 | /** |
149 | * @brief Sends msg to _RTPSession::dest | 122 | * Sends msg to _RTPSession::dest |
150 | * | ||
151 | * @param session The session. | ||
152 | * @param msg The message | ||
153 | * @param messenger Tox* object. | ||
154 | * @return int | ||
155 | * @retval -1 On error. | ||
156 | * @retval 0 On success. | ||
157 | */ | 123 | */ |
158 | int rtp_send_msg ( RTPSession *session, Messenger *messenger, const uint8_t *data, uint16_t length ); | 124 | int rtp_send_msg ( RTPSession *session, Messenger *messenger, const uint8_t *data, uint16_t length ); |
159 | 125 | ||
160 | |||
161 | /** | 126 | /** |
162 | * @brief Speaks for it self. | 127 | * Dealloc msg. |
163 | * | ||
164 | * @param session The control session msg belongs to. It can be NULL. | ||
165 | * @param msg The message. | ||
166 | * @return void | ||
167 | */ | 128 | */ |
168 | void rtp_free_msg ( RTPSession *session, RTPMessage *msg ); | 129 | void rtp_free_msg ( RTPSession *session, RTPMessage *msg ); |
169 | 130 | ||
170 | /** | ||
171 | * @brief Must be called before calling any other rtp function. It's used | ||
172 | * to initialize RTP control session. | ||
173 | * | ||
174 | * @param payload_type Type of payload used to send. You can use values in toxmsi.h::MSICallType | ||
175 | * @param messenger Tox* object. | ||
176 | * @param friend_num Friend id. | ||
177 | * @return RTPSession* Created control session. | ||
178 | * @retval NULL Error occurred. | ||
179 | */ | ||
180 | RTPSession *rtp_init_session ( int payload_type, Messenger *messenger, int friend_num ); | ||
181 | |||
182 | |||
183 | /** | ||
184 | * @brief Terminate the session. | ||
185 | * | ||
186 | * @param session The session. | ||
187 | * @param messenger The messenger who owns the session | ||
188 | * @return int | ||
189 | * @retval -1 Error occurred. | ||
190 | * @retval 0 Success. | ||
191 | */ | ||
192 | void rtp_terminate_session ( RTPSession *session, Messenger *messenger ); | ||
193 | |||
194 | 131 | ||
195 | 132 | ||
196 | #endif /* __TOXRTP */ | 133 | #endif /* __TOXRTP */ |