From dbaa384af07319b4f7bffe6909e3d470a0e0b672 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Thu, 30 Jul 2015 06:23:35 +0000 Subject: Fixed #1861: Add support for video capture orientation on Android git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5138 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/include/pjsua2/media.hpp | 33 +++++++++++++++++++++++++++++++++ pjsip/src/pjsua2/media.cpp | 22 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) (limited to 'pjsip') diff --git a/pjsip/include/pjsua2/media.hpp b/pjsip/include/pjsua2/media.hpp index c3bf6e2d..1f45e54e 100644 --- a/pjsip/include/pjsua2/media.hpp +++ b/pjsip/include/pjsua2/media.hpp @@ -1673,6 +1673,39 @@ public: */ const VideoDevInfoVector &enumDev() throw(Error); + /** + * Check whether the video capture device is currently active, i.e. if + * a video preview has been started or there is a video call using + * the device. + * + * @param dev_id The video device id + * + * @return True if it's active. + */ + bool isCaptureActive(int dev_id) const; + + /** + * This will configure video orientation of the video capture device. + * If the device is currently active (i.e. if there is a video call + * using the device or a video preview has been started), the method + * will forward the setting to the video device instance to be applied + * immediately, if it supports it. + * + * The setting will be saved for future opening of the video device, + * if the "keep" argument is set to true. If the video device is + * currently inactive, and the "keep" argument is false, this method + * will throw Error. + * + * @param dev_id The video device id + * @param orient The video orientation. + * @param keep Specify whether the setting is to be kept for + * future use. + * + */ + void setCaptureOrient(pjmedia_vid_dev_index dev_id, + pjmedia_orient orient, + bool keep=true) throw(Error); + private: VideoDevInfoVector videoDevList; diff --git a/pjsip/src/pjsua2/media.cpp b/pjsip/src/pjsua2/media.cpp index 46c60a46..6c8dbf0e 100644 --- a/pjsip/src/pjsua2/media.cpp +++ b/pjsip/src/pjsua2/media.cpp @@ -1306,6 +1306,28 @@ void VidDevManager::clearVideoDevList() #endif } +bool VidDevManager::isCaptureActive(int dev_id) const +{ +#if PJSUA_HAS_VIDEO + return (pjsua_vid_dev_is_active(dev_id) == PJ_TRUE? true: false); +#else + PJ_UNUSED_ARG(dev_id); + + return false; +#endif +} + +void VidDevManager::setCaptureOrient(pjmedia_vid_dev_index dev_id, + pjmedia_orient orient, + bool keep) throw(Error) +{ +#if PJSUA_HAS_VIDEO + PJSUA2_CHECK_EXPR(pjsua_vid_dev_set_setting(dev_id, + PJMEDIA_VID_DEV_CAP_ORIENTATION, &orient, keep)); +#endif +} + + VidDevManager::VidDevManager() { } -- cgit v1.2.3