- Timestamp:
- Jul 3, 2015 6:21:30 AM (9 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia-videodev/config.h
r5027 r5125 54 54 55 55 #if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0) 56 57 /** 58 * This setting controls the maximum number of supported video device drivers. 59 * 60 * Default: 8 61 */ 62 #ifndef PJMEDIA_VID_DEV_MAX_DRIVERS 63 # define PJMEDIA_VID_DEV_MAX_DRIVERS 8 64 #endif 65 66 /** 67 * This setting controls the maximum number of supported video devices. 68 * 69 * Default: 16 70 */ 71 #ifndef PJMEDIA_VID_DEV_MAX_DEVS 72 # define PJMEDIA_VID_DEV_MAX_DEVS 16 73 #endif 74 56 75 57 76 /** -
pjproject/trunk/pjmedia/include/pjmedia-videodev/videodev.h
r4994 r5125 241 241 242 242 /** 243 * Support for changing video orientation in renderer and querying 244 * video orientation info in capture. Changing video orientation in 245 * a renderer will potentially affect the size of render window, 246 * i.e: width and height swap. When a capture device supports this 247 * capability, it will generate event PJMEDIA_EVENT_ORIENT_CHANGED 248 * (see #pjmedia_event) everytime the capture orientation is changed. 243 * Support for changing video orientation. For a renderer device, 244 * changing video orientation in will potentially affect the size of 245 * render window, i.e: width and height swap. For a capture device, 246 * the video will be rotated but the size of the video frame 247 * will stay the same, so the video may be resized or stretched. 249 248 * 250 249 * The value of this capability is pjmedia_orient. -
pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c
r4998 r5125 106 106 #endif 107 107 108 #define MAX_DRIVERS 16109 #define MAX_DEVS 64108 #define MAX_DRIVERS PJMEDIA_VID_DEV_MAX_DRIVERS 109 #define MAX_DEVS PJMEDIA_VID_DEV_MAX_DEVS 110 110 111 111 -
pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
r5118 r5125 182 182 UIDeviceOrientation dev_ori = [[UIDevice currentDevice] orientation]; 183 183 184 if (dev_ori == prev_ori && !note) return;184 if (dev_ori == prev_ori) return; 185 185 186 186 NSLog(@"Device orientation changed: %d", (prev_ori = dev_ori)); … … 193 193 } 194 194 195 pjsua_vid_dev_set_orient(PJMEDIA_VID_DEFAULT_CAPTURE_DEV, 196 pj_ori[dev_ori-1]); 195 pjsua_vid_dev_set_setting(PJMEDIA_VID_DEFAULT_CAPTURE_DEV, 196 PJMEDIA_VID_DEV_CAP_ORIENTATION, 197 &pj_ori[dev_ori-1], PJ_TRUE); 197 198 } 198 199 #endif … … 273 274 last = (wid == PJSUA_INVALID_ID) ? PJSUA_MAX_VID_WINS : wid+1; 274 275 275 [app orientationChanged:NULL];276 277 276 for (;i < last; ++i) { 278 277 pjsua_vid_win_info wi; -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r5118 r5125 6612 6612 6613 6613 /** 6614 * Set the orientation of the video device. The function only works 6615 * for video capture device and if the device is currently active (i.e. 6616 * a video preview has been started or there is a video call using the device). 6617 * Application can check if a video device is active by calling 6618 * #pjsua_vid_dev_is_active(). 6614 * Configure the capability of a video capture device. If the device is 6615 * currently active (i.e. if there is a video call using the device or 6616 * a video preview has been started), the function will forward the setting 6617 * to the video device instance to be applied immediately, if it supports it. 6618 * 6619 * The setting will be saved for future opening of the video device, if the 6620 * "keep" argument is set to non-zero. If the video device is currently 6621 * inactive, and the "keep" argument is false, this function will return 6622 * error. 6623 * 6624 * Note: This function will only works for video capture devices. To 6625 * configure the setting of video renderer device instances, use 6626 * pjsua_vid_win API instead. 6627 * 6628 * Warning: If application refreshes the video device list, it needs to 6629 * manually update the settings to reflect the newly updated video device 6630 * indexes. See #pjmedia_vid_dev_refresh() for more information. 6631 * 6632 * See also #pjmedia_vid_stream_set_cap() for more information about setting 6633 * a video device capability. 6619 6634 * 6620 6635 * @param id The video device index. 6621 * @param orient Video device orientation. 6622 * 6623 * @return PJ_SUCCESS on success, or the appropriate error code. 6624 */ 6625 PJ_DECL(pj_status_t) pjsua_vid_dev_set_orient(pjmedia_vid_dev_index id, 6626 pjmedia_orient orient); 6636 * @param cap The video device capability to change. 6637 * @param pval Pointer to value. Please see #pjmedia_vid_dev_cap 6638 * documentation about the type of value to be 6639 * supplied for each setting. 6640 * 6641 * @return PJ_SUCCESS on success or the appropriate error code. 6642 */ 6643 PJ_DECL(pj_status_t) pjsua_vid_dev_set_setting(pjmedia_vid_dev_index id, 6644 pjmedia_vid_dev_cap cap, 6645 const void *pval, 6646 pj_bool_t keep); 6647 6648 /** 6649 * Retrieve the value of a video capture device setting. If the device is 6650 * currently active (i.e. if there is a video call using the device or 6651 * a video preview has been started), the function will forward the request 6652 * to the video device. If video device is currently inactive, and if 6653 * application had previously set the setting and mark the setting as kept, 6654 * then that setting will be returned. Otherwise, this function will return 6655 * error. 6656 * The function only works for video capture device. 6657 * 6658 * @param id The video device index. 6659 * @param cap The video device capability to retrieve. 6660 * @param pval Pointer to receive the value. 6661 * Please see #pjmedia_vid_dev_cap documentation about 6662 * the type of value to be supplied for each setting. 6663 * 6664 * @return PJ_SUCCESS on success or the appropriate error code. 6665 */ 6666 PJ_DECL(pj_status_t) pjsua_vid_dev_get_setting(pjmedia_vid_dev_index id, 6667 pjmedia_vid_dev_cap cap, 6668 void *pval); 6627 6669 6628 6670 /** -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r4986 r5125 483 483 pjmedia_vid_dev_index vcap_dev; /**< Capture device ID. */ 484 484 pjmedia_vid_dev_index vrdr_dev; /**< Playback device ID. */ 485 /* For keeping video device settings */ 486 pj_uint32_t vid_caps[PJMEDIA_VID_DEV_MAX_DEVS]; 487 pjmedia_vid_dev_param vid_param[PJMEDIA_VID_DEV_MAX_DEVS]; 485 488 486 489 /* File players: */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
r5118 r5125 227 227 228 228 /* 229 * Set the orientation of the video device. 230 */ 231 PJ_DEF(pj_status_t) pjsua_vid_dev_set_orient( pjmedia_vid_dev_index id, 232 pjmedia_orient orient) 233 { 234 pjsua_vid_win *w; 235 pjmedia_vid_dev_stream *cap_dev; 229 * Set the capability of the video device. 230 */ 231 PJ_DEF(pj_status_t) pjsua_vid_dev_set_setting( pjmedia_vid_dev_index id, 232 pjmedia_vid_dev_cap cap, 233 const void *pval, 234 pj_bool_t keep) 235 { 236 pj_status_t status = PJ_SUCCESS; 236 237 pjsua_vid_win_id wid = vid_preview_get_win(id, PJ_FALSE); 237 238 238 if (wid == PJSUA_INVALID_ID) { 239 PJ_LOG(3, (THIS_FILE, "Unable to set orientation for video dev %d: " 240 "device not active", id)); 241 return PJ_ENOTFOUND; 242 } 243 244 w = &pjsua_var.win[wid]; 239 if (wid != PJSUA_INVALID_ID) { 240 pjsua_vid_win *w; 241 pjmedia_vid_dev_stream *cap_dev; 242 243 w = &pjsua_var.win[wid]; 244 cap_dev = pjmedia_vid_port_get_stream(w->vp_cap); 245 246 status = pjmedia_vid_dev_stream_set_cap(cap_dev, cap, pval); 247 if (status != PJ_SUCCESS) 248 return status; 249 } else { 250 status = PJ_ENOTFOUND; 251 } 252 253 if (keep) { 254 pjmedia_vid_dev_info info; 255 256 status = pjmedia_vid_dev_get_info(id, &info); 257 if (status != PJ_SUCCESS || (info.dir & PJMEDIA_DIR_CAPTURE) == 0) 258 return status; 245 259 246 cap_dev = pjmedia_vid_port_get_stream(w->vp_cap); 247 248 return pjmedia_vid_dev_stream_set_cap(cap_dev, 249 PJMEDIA_VID_DEV_CAP_ORIENTATION, 250 &orient); 260 /* Get real capture ID, if set to PJMEDIA_VID_DEFAULT_CAPTURE_DEV */ 261 id = info.id; 262 status = pjmedia_vid_dev_param_set_cap(&pjsua_var.vid_param[id], 263 cap, pval); 264 if (status == PJ_SUCCESS) { 265 pjsua_var.vid_caps[id] |= cap; 266 } 267 } 268 269 return status; 270 } 271 272 /* 273 * Get the value of the video device capability. 274 */ 275 PJ_DEF(pj_status_t) pjsua_vid_dev_get_setting( pjmedia_vid_dev_index id, 276 pjmedia_vid_dev_cap cap, 277 void *pval) 278 { 279 pj_status_t status = PJ_SUCCESS; 280 pjsua_vid_win_id wid = vid_preview_get_win(id, PJ_FALSE); 281 282 if (wid != PJSUA_INVALID_ID) { 283 pjsua_vid_win *w; 284 pjmedia_vid_dev_stream *cap_dev; 285 286 w = &pjsua_var.win[wid]; 287 cap_dev = pjmedia_vid_port_get_stream(w->vp_cap); 288 289 status = pjmedia_vid_dev_stream_get_cap(cap_dev, cap, pval); 290 } else { 291 pjmedia_vid_dev_info info; 292 293 status = pjmedia_vid_dev_get_info(id, &info); 294 if (status != PJ_SUCCESS) 295 return status; 296 297 /* Get real device ID, if set to default device */ 298 id = info.id; 299 300 if ((pjsua_var.vid_caps[id] & cap) != 0) { 301 status = pjmedia_vid_dev_param_get_cap(&pjsua_var.vid_param[id], 302 cap, pval); 303 } else { 304 status = PJ_ENOTFOUND; 305 } 306 } 307 308 return status; 251 309 } 252 310 … … 614 672 vp_param.active = PJ_TRUE; 615 673 vp_param.vidparam.dir = PJMEDIA_DIR_CAPTURE; 616 if (fmt) 674 675 /* Update the video setting with user preference */ 676 #define update_param(cap, field) \ 677 if ((pjsua_var.vid_caps[cap_id] & cap) && (vdi.caps & cap)) { \ 678 vp_param.vidparam.flags |= cap; \ 679 pj_memcpy(&vp_param.vidparam.field, \ 680 &pjsua_var.vid_param[cap_id].field, \ 681 sizeof(vp_param.vidparam.field)); \ 682 } 683 684 if (fmt) { 617 685 vp_param.vidparam.fmt = *fmt; 686 } else { 687 update_param(PJMEDIA_VID_DEV_CAP_FORMAT, fmt); 688 } 689 690 update_param(PJMEDIA_VID_DEV_CAP_ORIENTATION, orient); 691 692 #undef update_param 618 693 619 694 status = pjmedia_vid_port_create(w->pool, &vp_param, &w->vp_cap);
Note: See TracChangeset
for help on using the changeset viewer.