- Timestamp:
- Jun 25, 2015 8:17:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
r5041 r5118 40 40 static char **restartArgv; 41 41 static int restartArgc; 42 static pj_thread_desc a_thread_desc;43 static pj_thread_t *a_thread;44 42 45 43 static void displayMsg(const char *msg) … … 118 116 } 119 117 118 /* Setup device orientation change notification */ 119 [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 120 [[NSNotificationCenter defaultCenter] addObserver:app 121 selector:@selector(orientationChanged:) 122 name:UIDeviceOrientationDidChangeNotification 123 object:[UIDevice currentDevice]]; 124 120 125 status = pjsua_app_run(PJ_TRUE); 121 126 if (status != PJ_SUCCESS) { … … 124 129 displayMsg(errmsg); 125 130 } 131 132 [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; 126 133 127 134 pjsua_app_destroy(); … … 158 165 } 159 166 167 - (void)orientationChanged:(NSNotification *)note 168 { 169 #if PJSUA_HAS_VIDEO 170 const pjmedia_orient pj_ori[4] = 171 { 172 PJMEDIA_ORIENT_ROTATE_90DEG, /* UIDeviceOrientationPortrait */ 173 PJMEDIA_ORIENT_ROTATE_270DEG, /* UIDeviceOrientationPortraitUpsideDown */ 174 PJMEDIA_ORIENT_ROTATE_180DEG, /* UIDeviceOrientationLandscapeLeft, 175 home button on the right side */ 176 PJMEDIA_ORIENT_NATURAL /* UIDeviceOrientationLandscapeRight, 177 home button on the left side */ 178 }; 179 static pj_thread_desc a_thread_desc; 180 static pj_thread_t *a_thread; 181 static UIDeviceOrientation prev_ori = 0; 182 UIDeviceOrientation dev_ori = [[UIDevice currentDevice] orientation]; 183 184 if (dev_ori == prev_ori && !note) return; 185 186 NSLog(@"Device orientation changed: %d", (prev_ori = dev_ori)); 187 188 if (dev_ori >= UIDeviceOrientationPortrait && 189 dev_ori <= UIDeviceOrientationLandscapeRight) 190 { 191 if (!pj_thread_is_registered()) { 192 pj_thread_register("ipjsua", a_thread_desc, &a_thread); 193 } 194 195 pjsua_vid_dev_set_orient(PJMEDIA_VID_DEFAULT_CAPTURE_DEV, 196 pj_ori[dev_ori-1]); 197 } 198 #endif 199 } 200 160 201 - (void)keepAlive { 202 static pj_thread_desc a_thread_desc; 203 static pj_thread_t *a_thread; 161 204 int i; 162 205 163 if (!pj_thread_is_registered()) 164 { 206 if (!pj_thread_is_registered()) { 165 207 pj_thread_register("ipjsua", a_thread_desc, &a_thread); 166 208 } … … 230 272 i = (wid == PJSUA_INVALID_ID) ? 0 : wid; 231 273 last = (wid == PJSUA_INVALID_ID) ? PJSUA_MAX_VID_WINS : wid+1; 274 275 [app orientationChanged:NULL]; 232 276 233 277 for (;i < last; ++i) {
Note: See TracChangeset
for help on using the changeset viewer.