Changeset 5014 for pjproject/trunk/pjsip-apps/src/pjsua/android/jni
- Timestamp:
- Mar 22, 2015 8:53:03 AM (10 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/pjsua/android/jni
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/android/jni/pjsua.i
r4496 r5014 4 4 #include "pjsua_app_callback.h" 5 5 #include "../../pjsua_app.h" 6 #include <android/native_window_jni.h> 6 7 7 8 #ifdef __cplusplus … … 17 18 %} 18 19 19 int pjsuaStart(); 20 void pjsuaDestroy(); 21 int pjsuaRestart(); 22 23 /* turn on director wrapping PjsuaAppCallback */ 20 /* Turn on director wrapping PjsuaAppCallback */ 24 21 %feature("director") PjsuaAppCallback; 25 22 23 /* Convert Surface object to ANativeWindow for setIncomingVideoRenderer() */ 24 %typemap(in) jobject surface { 25 $1 = (jobject)ANativeWindow_fromSurface(jenv, $input); 26 } 27 26 28 %include "pjsua_app_callback.h" 27 28 void setCallbackObject(PjsuaAppCallback* callback);29 -
pjproject/trunk/pjsip-apps/src/pjsua/android/jni/pjsua_app_callback.cpp
r5005 r5014 30 30 static int restart_argc; 31 31 static char **restart_argv; 32 static pjsua_callback pjsua_cb_orig; 33 static jobject callVideoSurface; 32 34 33 35 extern const char *pjsua_app_def_argv[]; … … 42 44 } 43 45 46 static void on_call_media_state(pjsua_call_id call_id) 47 { 48 pjsua_call_info call_info; 49 unsigned mi; 50 pj_bool_t has_error = PJ_FALSE; 51 52 pjsua_call_get_info(call_id, &call_info); 53 54 for (mi=0; mi<call_info.media_cnt; ++mi) { 55 pjsua_call_media_info *med_info = &call_info.media[mi]; 56 if (med_info->type == PJMEDIA_TYPE_VIDEO && 57 med_info->status == PJSUA_CALL_MEDIA_ACTIVE && 58 med_info->stream.vid.win_in != PJSUA_INVALID_ID) 59 { 60 pjmedia_vid_dev_hwnd vhwnd; 61 62 /* Setup renderer surface */ 63 pj_bzero(&vhwnd, sizeof(vhwnd)); 64 vhwnd.type = PJMEDIA_VID_DEV_HWND_TYPE_ANDROID; 65 vhwnd.info.window = callVideoSurface; 66 pjsua_vid_win_set_win(med_info->stream.vid.win_in, &vhwnd); 67 break; 68 } 69 } 70 71 /* Forward to original callback */ 72 if (pjsua_cb_orig.on_call_media_state) 73 (*pjsua_cb_orig.on_call_media_state)(call_id); 74 } 44 75 45 76 /** Callback wrapper **/ 46 77 static void on_cli_config(pjsua_app_config *cfg) 47 78 { 79 pjsua_cb_orig = cfg->cfg.cb; 48 80 cfg->log_cfg.cb = &log_writer; 81 82 /* Override pjsua callback, e.g: to install renderer view */ 83 cfg->cfg.cb.on_call_media_state = &on_call_media_state; 49 84 } 50 85 … … 127 162 } 128 163 164 165 void setIncomingVideoRenderer(jobject surface) 166 { 167 callVideoSurface = surface; 168 } 169 129 170 #endif -
pjproject/trunk/pjsip-apps/src/pjsua/android/jni/pjsua_app_callback.h
r4496 r5014 20 20 #define __PJSUA_APP_CALLBACK_H__ 21 21 22 #include <jni.h> 23 22 24 class PjsuaAppCallback { 23 25 public: … … 32 34 int pjsuaRestart(); 33 35 void setCallbackObject(PjsuaAppCallback* callback); 36 void setIncomingVideoRenderer(jobject surface); 34 37 } 35 38
Note: See TracChangeset
for help on using the changeset viewer.