diff options
Diffstat (limited to 'toxav/msi.h')
-rw-r--r-- | toxav/msi.h | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/toxav/msi.h b/toxav/msi.h index d63f2441..660df05e 100644 --- a/toxav/msi.h +++ b/toxav/msi.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <inttypes.h> | 25 | #include <inttypes.h> |
26 | #include <pthread.h> | 26 | #include <pthread.h> |
27 | 27 | ||
28 | #include "codec.h" | ||
28 | #include "../toxcore/Messenger.h" | 29 | #include "../toxcore/Messenger.h" |
29 | 30 | ||
30 | typedef uint8_t MSICallIDType[12]; | 31 | typedef uint8_t MSICallIDType[12]; |
@@ -35,8 +36,8 @@ typedef void ( *MSICallbackType ) ( void *agent, int32_t call_idx, void *arg ); | |||
35 | * Call type identifier. Also used as rtp callback prefix. | 36 | * Call type identifier. Also used as rtp callback prefix. |
36 | */ | 37 | */ |
37 | typedef enum { | 38 | typedef enum { |
38 | type_audio = 192, | 39 | msi_TypeAudio = 192, |
39 | type_video | 40 | msi_TypeVideo |
40 | } MSICallType; | 41 | } MSICallType; |
41 | 42 | ||
42 | 43 | ||
@@ -44,11 +45,11 @@ typedef enum { | |||
44 | * Call state identifiers. | 45 | * Call state identifiers. |
45 | */ | 46 | */ |
46 | typedef enum { | 47 | typedef enum { |
47 | call_inviting, /* when sending call invite */ | 48 | msi_CallInviting, /* when sending call invite */ |
48 | call_starting, /* when getting call invite */ | 49 | msi_CallStarting, /* when getting call invite */ |
49 | call_active, | 50 | msi_CallActive, |
50 | call_hold, | 51 | msi_CallHold, |
51 | call_hanged_up | 52 | msi_CallOver |
52 | 53 | ||
53 | } MSICallState; | 54 | } MSICallState; |
54 | 55 | ||
@@ -74,26 +75,27 @@ typedef struct _MSICodecSettings { | |||
74 | * Callbacks ids that handle the states | 75 | * Callbacks ids that handle the states |
75 | */ | 76 | */ |
76 | typedef enum { | 77 | typedef enum { |
77 | MSI_OnInvite, /* Incoming call */ | 78 | msi_OnInvite, /* Incoming call */ |
78 | MSI_OnRinging, /* When peer is ready to accept/reject the call */ | 79 | msi_OnRinging, /* When peer is ready to accept/reject the call */ |
79 | MSI_OnStart, /* Call (RTP transmission) started */ | 80 | msi_OnStart, /* Call (RTP transmission) started */ |
80 | MSI_OnCancel, /* The side that initiated call canceled invite */ | 81 | msi_OnCancel, /* The side that initiated call canceled invite */ |
81 | MSI_OnReject, /* The side that was invited rejected the call */ | 82 | msi_OnReject, /* The side that was invited rejected the call */ |
82 | MSI_OnEnd, /* Call that was active ended */ | 83 | msi_OnEnd, /* Call that was active ended */ |
83 | MSI_OnRequestTimeout, /* When the requested action didn't get response in specified time */ | 84 | msi_OnRequestTimeout, /* When the requested action didn't get response in specified time */ |
84 | MSI_OnPeerTimeout, /* Peer timed out; stop the call */ | 85 | msi_OnPeerTimeout, /* Peer timed out; stop the call */ |
85 | MSI_OnPeerCSChange, /* Peer requested Csettings change */ | 86 | msi_OnPeerCSChange, /* Peer requested Csettings change */ |
86 | MSI_OnSelfCSChange /* Csettings change confirmation */ | 87 | msi_OnSelfCSChange /* Csettings change confirmation */ |
87 | } MSICallbackID; | 88 | } MSICallbackID; |
88 | 89 | ||
89 | |||
90 | /** | 90 | /** |
91 | * Callbacks container | 91 | * Errors |
92 | */ | 92 | */ |
93 | typedef struct _MSICallbackCont { | 93 | typedef enum { |
94 | MSICallbackType function; | 94 | msi_ErrorNoCall = -20, /* Trying to perform call action while not in a call */ |
95 | void *data; | 95 | msi_ErrorInvalidState = -21, /* Trying to perform call action while in invalid state*/ |
96 | } MSICallbackCont; | 96 | msi_ErrorAlreadyInCallWithPeer = -22, /* Trying to call peer when already in a call with peer */ |
97 | msi_ErrorReachedCallLimit = -23, /* Cannot handle more calls */ | ||
98 | } MSIError; | ||
97 | 99 | ||
98 | /** | 100 | /** |
99 | * The call struct. | 101 | * The call struct. |
@@ -135,10 +137,10 @@ typedef struct _MSISession { | |||
135 | uint32_t frequ; | 137 | uint32_t frequ; |
136 | uint32_t call_timeout; /* Time of the timeout for some action to end; 0 if infinite */ | 138 | uint32_t call_timeout; /* Time of the timeout for some action to end; 0 if infinite */ |
137 | 139 | ||
138 | pthread_mutex_t mutex; | 140 | pthread_mutex_t mutex[1]; |
139 | 141 | ||
140 | void *timer_handler; | 142 | void *timer_handler; |
141 | MSICallbackCont callbacks[10]; /* Callbacks used by this session */ | 143 | PAIR(MSICallbackType, void *) callbacks[10]; |
142 | } MSISession; | 144 | } MSISession; |
143 | 145 | ||
144 | /** | 146 | /** |