summaryrefslogtreecommitdiff
path: root/toxav/phone.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxav/phone.c')
-rwxr-xr-xtoxav/phone.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/toxav/phone.c b/toxav/phone.c
index 95b49231..2d7b4c90 100755
--- a/toxav/phone.c
+++ b/toxav/phone.c
@@ -126,7 +126,7 @@ typedef struct av_session_s {
126 AVCodec *webcam_decoder; 126 AVCodec *webcam_decoder;
127#endif 127#endif
128} av_session_t; 128} av_session_t;
129 129av_session_t *_phone;
130 130
131void av_allocate_friend(av_session_t *_phone, int _id, int _active) 131void av_allocate_friend(av_session_t *_phone, int _id, int _active)
132{ 132{
@@ -858,7 +858,7 @@ int phone_startmedia_loop ( ToxAv *arg )
858 858
859 /* Only checks for last peer */ 859 /* Only checks for last peer */
860 if ( toxav_get_peer_transmission_type(arg, 0) == TypeVideo && 860 if ( toxav_get_peer_transmission_type(arg, 0) == TypeVideo &&
861 0 > event.rise(encode_video_thread, toxav_get_agent_handler(arg)) ) { 861 0 > event.rise(encode_video_thread, _phone) ) {
862 INFO("Error while starting encode_video_thread()"); 862 INFO("Error while starting encode_video_thread()");
863 return -1; 863 return -1;
864 } 864 }
@@ -873,7 +873,7 @@ int phone_startmedia_loop ( ToxAv *arg )
873 873
874 /* Only checks for last peer */ 874 /* Only checks for last peer */
875 if ( toxav_get_peer_transmission_type(arg, 0) == TypeVideo && 875 if ( toxav_get_peer_transmission_type(arg, 0) == TypeVideo &&
876 0 > event.rise(decode_video_thread, toxav_get_agent_handler(arg)) ) { 876 0 > event.rise(decode_video_thread, _phone) ) {
877 INFO("Error while starting decode_video_thread()"); 877 INFO("Error while starting decode_video_thread()");
878 return -1; 878 return -1;
879 } 879 }
@@ -886,7 +886,7 @@ int phone_startmedia_loop ( ToxAv *arg )
886 886
887 /* One threaded audio */ 887 /* One threaded audio */
888 888
889 if ( 0 > event.rise(one_threaded_audio, toxav_get_agent_handler(arg)) ) { 889 if ( 0 > event.rise(one_threaded_audio, _phone) ) {
890 INFO ("Shit-head"); 890 INFO ("Shit-head");
891 return -1; 891 return -1;
892 } 892 }
@@ -945,8 +945,6 @@ void *callback_recv_starting ( void *_arg )
945} 945}
946void *callback_recv_ending ( void *_arg ) 946void *callback_recv_ending ( void *_arg )
947{ 947{
948 av_session_t *_phone = toxav_get_agent_handler(_arg);
949
950 _phone->running_encaud = 0; 948 _phone->running_encaud = 0;
951 _phone->running_decaud = 0; 949 _phone->running_decaud = 0;
952 _phone->running_encvid = 0; 950 _phone->running_encvid = 0;
@@ -995,8 +993,6 @@ void *callback_call_rejected ( void *_arg )
995} 993}
996void *callback_call_ended ( void *_arg ) 994void *callback_call_ended ( void *_arg )
997{ 995{
998 av_session_t *_phone = toxav_get_agent_handler(_arg);
999
1000 _phone->running_encaud = 0; 996 _phone->running_encaud = 0;
1001 _phone->running_decaud = 0; 997 _phone->running_decaud = 0;
1002 _phone->running_encvid = 0; 998 _phone->running_encvid = 0;
@@ -1137,22 +1133,22 @@ failed_init_ffmpeg: ;
1137 fraddr_to_str( _byte_address, _retu->_my_public_id ); 1133 fraddr_to_str( _byte_address, _retu->_my_public_id );
1138 1134
1139 1135
1140 _retu->av = toxav_new(_retu->_messenger, _retu, width, height); 1136 _retu->av = toxav_new(_retu->_messenger, width, height);
1141 1137
1142 /* ------------------ */ 1138 /* ------------------ */
1143 1139
1144 toxav_register_callstate_callback(callback_call_started, av_OnStart); 1140 toxav_register_callstate_callback(callback_call_started, av_OnStart, _retu->av);
1145 toxav_register_callstate_callback(callback_call_canceled, av_OnCancel); 1141 toxav_register_callstate_callback(callback_call_canceled, av_OnCancel, _retu->av);
1146 toxav_register_callstate_callback(callback_call_rejected, av_OnReject); 1142 toxav_register_callstate_callback(callback_call_rejected, av_OnReject, _retu->av);
1147 toxav_register_callstate_callback(callback_call_ended, av_OnEnd); 1143 toxav_register_callstate_callback(callback_call_ended, av_OnEnd, _retu->av);
1148 toxav_register_callstate_callback(callback_recv_invite, av_OnInvite); 1144 toxav_register_callstate_callback(callback_recv_invite, av_OnInvite, _retu->av);
1149 1145
1150 toxav_register_callstate_callback(callback_recv_ringing, av_OnRinging); 1146 toxav_register_callstate_callback(callback_recv_ringing, av_OnRinging, _retu->av);
1151 toxav_register_callstate_callback(callback_recv_starting, av_OnStarting); 1147 toxav_register_callstate_callback(callback_recv_starting, av_OnStarting, _retu->av);
1152 toxav_register_callstate_callback(callback_recv_ending, av_OnEnding); 1148 toxav_register_callstate_callback(callback_recv_ending, av_OnEnding, _retu->av);
1153 1149
1154 toxav_register_callstate_callback(callback_recv_error, av_OnError); 1150 toxav_register_callstate_callback(callback_recv_error, av_OnError, _retu->av);
1155 toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout); 1151 toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, _retu->av);
1156 1152
1157 /* ------------------ */ 1153 /* ------------------ */
1158 1154
@@ -1426,7 +1422,7 @@ int main ( int argc, char *argv [] )
1426 return 1; 1422 return 1;
1427 } 1423 }
1428 1424
1429 av_session_t *_phone = av_init_session(); 1425 _phone = av_init_session();
1430 1426
1431 assert ( _phone ); 1427 assert ( _phone );
1432 1428