diff options
-rwxr-xr-x | .gitignore | 26 | ||||
-rwxr-xr-x | CMakeLists.txt | 8 | ||||
-rwxr-xr-x | capi-media-camera.pc.in | 2 | ||||
-rwxr-xr-x | debian/changelog | 8 | ||||
-rwxr-xr-x | debian/control | 6 | ||||
-rwxr-xr-x | include/camera.h | 129 | ||||
-rwxr-xr-x | include/camera_private.h | 2 | ||||
-rwxr-xr-x | packaging/capi-media-camera.spec | 8 | ||||
-rwxr-xr-x | src/camera.c | 110 | ||||
-rwxr-xr-x | test/multimedia_camera_test.c | 59 |
10 files changed, 251 insertions, 107 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100755 index f884ceb..0000000 --- a/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -CMakeCache.txt -*/CMakeFiles/* -*.cmake -CMakeFiles* -*.a -*.so -Testing -cmake.depends -cmake.check_depends -cmake.check_cache -core -core.* -gmon.out -install_manifest.txt -*~ -.kdev_include_paths -src.kdev4 -.cproject -.project -tet_captured -tet_lock -*.pc -*-test -*-test_* -*tester.c -TC/config diff --git a/CMakeLists.txt b/CMakeLists.txt index 39df7eb..0a35b5a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,10 +24,7 @@ SET(submodule "camera") # for package file SET(dependents "dlog mm-camcorder capi-base-common") -# for deb -SET(deb_dependents "libdlog libmm-camcorder") - - +SET(pc_dependents "capi-base-common") SET(fw_name "${project_prefix}-${service}-${submodule}") @@ -80,9 +77,8 @@ INSTALL( ) SET(PC_NAME ${fw_name}) -SET(PC_REQUIRED ${dependents}) +SET(PC_REQUIRED ${pc_dependents}) SET(PC_LDFLAGS -l${fw_name}) -SET(PC_CFLAGS -I\${includedir}/${service}) CONFIGURE_FILE( ${fw_name}.pc.in diff --git a/capi-media-camera.pc.in b/capi-media-camera.pc.in index 773d667..5d02f8d 100755 --- a/capi-media-camera.pc.in +++ b/capi-media-camera.pc.in @@ -11,5 +11,5 @@ Description: @PACKAGE_DESCRIPTION@ Version: @VERSION@ Requires: @PC_REQUIRED@ Libs: -L${libdir} @PC_LDFLAGS@ -Cflags: -I${includedir} @PC_CFLAGS@ +Cflags: -I${includedir} diff --git a/debian/changelog b/debian/changelog index 70d79d5..af53b4f 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -capi-media-camera (0.1.0-8) unstable; urgency=low +capi-media-camera (0.1.0-11) unstable; urgency=low - * add so version + * update camrea API * Git: slp-source.sec.samsung.net:slp/api/camera - * Tag: capi-media-camera_0.1.0-8 + * Tag: capi-media-camera_0.1.0-11 - -- Seungkeun Lee <sngn.lee@samsung.com> Tue, 14 Feb 2012 16:43:04 +0900 + -- Seungkeun Lee <sngn.lee@samsung.com> Wed, 14 Mar 2012 11:38:20 +0900 capi-media-camera (0.0.1-1) unstable; urgency=low diff --git a/debian/control b/debian/control index 758069a..e1e354b 100755 --- a/debian/control +++ b/debian/control @@ -3,16 +3,16 @@ Source: capi-media-camera Section: libs Priority: extra Maintainer: Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com> -Build-Depends: debhelper (>= 5), libmm-camcorder-dev, libmm-common-dev, libmm-session-dev, capi-base-common-dev +Build-Depends: debhelper (>= 5), dlog-dev, libmm-camcorder-dev, libmm-common-dev, libmm-session-dev, capi-base-common-dev Package: capi-media-camera Architecture: any -Depends: ${shilbs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} Description: A Camera library in Tizen Native API Package: capi-media-camera-dev Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-camera (= ${Source-Version}), dlog-dev, capi-base-common-dev, libmm-camcorder-dev +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-camera (= ${Source-Version}), capi-base-common-dev Description: A Camera library in Tizen Native API (DEV) Package: capi-media-camera-dbg diff --git a/include/camera.h b/include/camera.h index c86e0f3..998249f 100755 --- a/include/camera.h +++ b/include/camera.h @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and -* limitations under the License. +* limitations under the License. */ @@ -104,7 +104,7 @@ typedef enum /** * @brief Enumerations of the camera display type. - */ + */ typedef enum { CAMERA_DISPLAY_TYPE_X11 = 0, /**< X surface display */ @@ -129,7 +129,7 @@ typedef void *camera_display_h; #ifndef GET_DISPLAY /** - * @brief Gets a display handle from x window id or evas object + * @brief Gets a display handle from x window id or evas object */ #define GET_DISPLAY(x) (void*)(x) @@ -147,15 +147,27 @@ typedef void *camera_display_h; /** - * @brief Enumerations of the camera display rotation type. + * @brief Enumerations of the camera rotation type. + */ +typedef enum +{ + CAMERA_ROTATION_NONE, /**< No rotation */ + CAMERA_ROTATION_90, /**< 90 degree rotation */ + CAMERA_ROTATION_180, /**< 180 degree rotation */ + CAMERA_ROTATION_270, /**< 270 degree rotation */ +} camera_rotation_e; + + +/** + * @brief Enumerations of the camera flip type. */ typedef enum { - CAMERA_DISPLAY_ROTATION_NONE, /**< No rotation of the display */ - CAMERA_DISPLAY_ROTATION_90, /**< 90 degree rotation */ - CAMERA_DISPLAY_ROTATION_180, /**< 180 degree rotation */ - CAMERA_DISPLAY_ROTATION_270, /**< 270 degree rotation */ -} camera_display_rotation_e; + CAMERA_FLIP_NONE, /**< No Flip */ + CAMERA_FLIP_HORIZONTAL, /**< Horizontal flip */ + CAMERA_FLIP_VERTICAL, /**< Vertical flip */ + CAMERA_FLIP_BOTH /** Horizontal and vertical flip */ +}camera_flip_e; /** * @brief Enumerations of the camera display mode. @@ -419,7 +431,7 @@ typedef void (*camera_preview_cb)(void *stream_buffer, int buffer_size, int widt /** - * @brief Called to get information about image data taken by the camera once per frame while capturing. + * @brief Called to get information about image data taken by the camera once per frame while capturing. * * @remarks This function is issued in the context of gstreamer (video source thread) so you should not directly invoke UI update code. * You must not call camera_stop_preview() within this callback. @@ -645,10 +657,10 @@ int camera_stop_preview(camera_h camera); * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation * * @pre The camera state must be #CAMERA_STATE_PREVIEW. \n - * If needed, modify capture resolution(camera_set_capture_resolution()), + * If needed, modify capture resolution(camera_set_capture_resolution()), * capture format(camera_set_capture_format()), or image quality(camera_attr_set_image_quality()) * @post If it succeeds the camera state will be #CAMERA_STATE_CAPTURED. - * + * * @see camera_start_preview() * @see camera_set_capturing_cb() * @see camera_set_capture_completed_cb() @@ -710,7 +722,7 @@ int camera_start_focusing(camera_h camera); * @pre The camera state should be #CAMERA_STATE_PREVIEW * * @see camera_start_focusing() - * @see camera_focus_changed_cb() + * @see camera_focus_changed_cb() */ int camera_cancel_focusing(camera_h camera); @@ -819,17 +831,17 @@ int camera_foreach_supported_preview_resolution(camera_h camera, * @retval #CAMERA_ERROR_NONE Successful * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_INVALID_OPERATION Display type is not X11 + * @retval #CAMERA_ERROR_INVALID_OPERATION Display type is not X11 * * @see camera_start_preview() * @see camera_get_x11_display_rotation() */ -int camera_set_x11_display_rotation(camera_h camera, camera_display_rotation_e rotation); +int camera_set_x11_display_rotation(camera_h camera, camera_rotation_e rotation); /** * @brief Gets the display rotation. * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE - * + * * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_X11. * * @param[in] camera The handle to the camera @@ -840,7 +852,7 @@ int camera_set_x11_display_rotation(camera_h camera, camera_display_rotation_e r * * @see camera_set_x11_display_rotation() */ -int camera_get_x11_display_rotation(camera_h camera, camera_display_rotation_e *rotation); +int camera_get_x11_display_rotation(camera_h camera, camera_rotation_e *rotation); /** * @brief Sets the visible property for X11 display. @@ -1223,7 +1235,7 @@ int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callbac int camera_unset_state_changed_cb(camera_h camera); /** - * @brief Registers a callback function to be called when auto-focus state changes. + * @brief Registers a callback function to be called when auto-focus state changes. * * @param[in] camera The handle to the camera * @param[in] callback The callback function to register @@ -1256,7 +1268,7 @@ int camera_unset_focus_changed_cb(camera_h camera); /** - * @brief Registers a callback function to be called when capture completes. + * @brief Registers a callback function to be called when capture completes. * * @param[in] camera The handle to the camera * @param[in] callback The callback function to register @@ -1288,7 +1300,7 @@ int camera_unset_capture_completed_cb(camera_h camera); /** - * @brief Registers a callback function to be called when an asynchronous operation error occurred. + * @brief Registers a callback function to be called when an asynchronous operation error occurred. * * @param[in] camera The handle to the camera * @param[in] callback The callback function to register @@ -1497,7 +1509,7 @@ int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE * @{ */ - + /** * @brief Sets the image quality. * @@ -1540,7 +1552,7 @@ int camera_attr_get_image_quality(camera_h camera, int *quality); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * * @see camera_attr_get_zoom() - * @see camera_attr_get_zoom_range() + * @see camera_attr_get_zoom_range() */ int camera_attr_set_zoom(camera_h camera, int zoom); @@ -1563,7 +1575,7 @@ int camera_attr_get_zoom(camera_h camera, int *zoom); * * @param[in] camera The handle to the camera * @param[out] min The minimum zoom level - * @param[out] max The maximum zoom level + * @param[out] max The maximum zoom level * @return 0 on success, otherwise a negative error value. * @retval #CAMERA_ERROR_NONE Successful * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter @@ -1676,7 +1688,7 @@ int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e * * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE * @{ */ - + /** * @brief Retrieves all supported exposure modes by invoking callback function once for each supported exposure mode. * @@ -1735,7 +1747,7 @@ int camera_attr_get_exposure(camera_h camera, int *value); * * @param[in] camera The handle to the camera * @param[out] min The minimum exposure value - * @param[out] max The maximum exposure value + * @param[out] max The maximum exposure value * @return 0 on success, otherwise a negative error value. * @retval #CAMERA_ERROR_NONE Successful * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter @@ -1843,7 +1855,7 @@ int camera_attr_get_brightness(camera_h camera, int *level); * * @param[in] camera The handle to the camera * @param[out] min The minimum brightness level - * @param[out] max The maximum brightness level + * @param[out] max The maximum brightness level * @return 0 on success, otherwise a negative error value. * @retval #CAMERA_ERROR_NONE Successful * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter @@ -1887,7 +1899,7 @@ int camera_attr_get_contrast(camera_h camera, int *level); * * @param[in] camera The handle to the camera * @param[out] min The minimum contrast level - * @param[out] max The maximum contrast level + * @param[out] max The maximum contrast level * @return 0 on success, otherwise a negative error value. * @retval #CAMERA_ERROR_NONE Successful * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter @@ -2356,6 +2368,69 @@ int camera_attr_get_lens_orientation(camera_h camera, int *angle); /** + * @brief Sets stream rotation + * + * @param[in] camera The handle to the camera + * @param[in] rotation The stream rotation + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_get_stream_rotation() + */ +int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation); + +/** + * @brief Gets stream rotation + * + * @param[in] camera The handle to the camera + * @param[out] rotation The stream rotation + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_set_stream_rotation() + */ +int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation); + + + +/** + * @brief Sets stream flip + * + * @param[in] camera The handle to the camera + * @param[in] flip The stream flip + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_set_stream_rotation() + */ +int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip); + +/** + * @brief Gets stream flip + * + * @param[in] camera The handle to the camera + * @param[out] flip The stream flip + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_set_stream_rotation() + */ +int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip); + + +/** * @} */ #ifdef __cplusplus diff --git a/include/camera_private.h b/include/camera_private.h index 9897663..9630da3 100755 --- a/include/camera_private.h +++ b/include/camera_private.h @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and -* limitations under the License. +* limitations under the License. */ diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 782159d..b0f0ef1 100755 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -29,9 +29,8 @@ Requires: %{name} = %{version}-%{release} %build -FULLVER=%{version} -MAJORVER=`echo ${FULLVER} | cut -d '.' -f 1` -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER} +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} make %{?jobs:-j%jobs} @@ -46,10 +45,11 @@ rm -rf %{buildroot} %files -%{_libdir}/libcapi-media-camera.so* +%{_libdir}/libcapi-media-camera.so.* %files devel %{_includedir}/media/camera.h %{_libdir}/pkgconfig/*.pc +%{_libdir}/libcapi-media-camera.so diff --git a/src/camera.c b/src/camera.c index 78ee6b5..581a00f 100755 --- a/src/camera.c +++ b/src/camera.c @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and -* limitations under the License. +* limitations under the License. */ @@ -187,7 +187,7 @@ int __mm_camera_message_callback(int message, void *param, void *user_data){ camera_s * handle = (camera_s*)user_data; MMMessageParamType *m = (MMMessageParamType*)param; - camera_state_e previous_state; + camera_state_e previous_state; switch(message){ @@ -246,7 +246,7 @@ int __mm_camera_message_callback(int message, void *param, void *user_data){ } break; } - case MM_MESSAGE_CAMCORDER_ERROR: + case MM_MESSAGE_CAMCORDER_ERROR: { int errorcode = m->code; errorcode = __convert_camera_error_code("NOTIFY", errorcode); @@ -299,14 +299,14 @@ int camera_create( camera_device_e device, camera_h* camera){ char *error; - ret = mm_camcorder_set_attributes(handle->mm_handle, &error, - MMCAM_MODE , MM_CAMCORDER_MODE_IMAGE, + ret = mm_camcorder_set_attributes(handle->mm_handle, &error, + MMCAM_MODE , MM_CAMCORDER_MODE_IMAGE, MMCAM_CAMERA_FORMAT, preview_format, - MMCAM_IMAGE_ENCODER , MM_IMAGE_CODEC_JPEG, + MMCAM_IMAGE_ENCODER , MM_IMAGE_CODEC_JPEG, MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED , - MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_NULL, - MMCAM_DISPLAY_ROTATION, rotation, - MMCAM_CAPTURE_COUNT, 1, + MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_NULL, + MMCAM_DISPLAY_ROTATION, rotation, + MMCAM_CAPTURE_COUNT, 1, (void*)NULL); handle->display_type = CAMERA_DISPLAY_TYPE_NONE; @@ -470,8 +470,8 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ handle->display_type = type; ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD, - MMCAM_DISPLAY_SURFACE ,type, - MMCAM_DISPLAY_HANDLE , type == CAMERA_DISPLAY_TYPE_X11 ? &handle->display_handle : display , sizeof(display) , + MMCAM_DISPLAY_SURFACE ,type, + MMCAM_DISPLAY_HANDLE , type == CAMERA_DISPLAY_TYPE_X11 ? &handle->display_handle : display , sizeof(display) , NULL); return __convert_camera_error_code(__func__, ret); } @@ -487,13 +487,13 @@ int camera_set_preview_resolution(camera_h camera, int width, int height){ return __convert_camera_error_code(__func__, ret); } -int camera_set_x11_display_rotation(camera_h camera, camera_display_rotation_e rotation){ +int camera_set_x11_display_rotation(camera_h camera, camera_rotation_e rotation){ if( camera == NULL){ LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( rotation < CAMERA_DISPLAY_ROTATION_NONE || rotation > CAMERA_DISPLAY_ROTATION_270 ) + if( rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270 ) return CAMERA_ERROR_INVALID_PARAMETER; int ret; @@ -549,7 +549,7 @@ int camera_get_preview_resolution(camera_h camera, int *width, int *height){ } -int camera_get_x11_display_rotation( camera_h camera, camera_display_rotation_e *rotation){ +int camera_get_x11_display_rotation( camera_h camera, camera_rotation_e *rotation){ if( camera == NULL || rotation == NULL ){ LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; @@ -1008,17 +1008,17 @@ int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode){ case CAMERA_ATTR_AF_NONE: ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , MM_CAMCORDER_FOCUS_MODE_NONE , MMCAM_CAMERA_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_NORMAL , NULL); - break; + break; case CAMERA_ATTR_AF_NORMAL: - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , MM_CAMCORDER_FOCUS_MODE_AUTO , + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , MM_CAMCORDER_FOCUS_MODE_AUTO , MMCAM_CAMERA_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_NORMAL , NULL); break; case CAMERA_ATTR_AF_MACRO: - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , MM_CAMCORDER_FOCUS_MODE_AUTO , + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , MM_CAMCORDER_FOCUS_MODE_AUTO , MMCAM_CAMERA_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_MACRO , NULL); break; case CAMERA_ATTR_AF_FULL: - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , MM_CAMCORDER_FOCUS_MODE_AUTO , + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , MM_CAMCORDER_FOCUS_MODE_AUTO , MMCAM_CAMERA_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_FULL , NULL); break; @@ -1034,7 +1034,7 @@ int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int maptable[] = {MM_CAMCORDER_AUTO_EXPOSURE_OFF, //CAMCORDER_EXPOSURE_MODE_OFF + int maptable[] = {MM_CAMCORDER_AUTO_EXPOSURE_OFF, //CAMCORDER_EXPOSURE_MODE_OFF MM_CAMCORDER_AUTO_EXPOSURE_ALL, //CAMCORDER_EXPOSURE_MODE_ALL MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1, //CAMCORDER_EXPOSURE_MODE_CENTER MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1, //CAMCORDER_EXPOSURE_MODE_SPOT @@ -1780,7 +1780,7 @@ int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_ } int maptable[] = { CAMERA_ATTR_EFFECT_NONE, //MM_CAMCORDER_COLOR_TONE_NONE - CAMERA_ATTR_EFFECT_MONO, //MM_CAMCORDER_COLOR_TONE_MONO, + CAMERA_ATTR_EFFECT_MONO, //MM_CAMCORDER_COLOR_TONE_MONO, CAMERA_ATTR_EFFECT_SEPIA, //MM_CAMCORDER_COLOR_TONE_SEPIA, /**< Sepia */ CAMERA_ATTR_EFFECT_NEGATIVE, //MM_CAMCORDER_COLOR_TONE_NEGATIVE, //, /**< Negative */ CAMERA_ATTR_EFFECT_BLUE, //MM_CAMCORDER_COLOR_TONE_BLUE, /**< Blue */ @@ -1894,5 +1894,75 @@ int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps } +int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation){ + if( camera == NULL){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270 ) + return CAMERA_ERROR_INVALID_PARAMETER; + + int ret; + camera_s * handle = (camera_s*)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_ROTATION , rotation, NULL); + return __convert_camera_error_code(__func__, ret); +} + +int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation){ + if( camera == NULL || rotation == NULL ){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_ROTATION , rotation, NULL); + return __convert_camera_error_code(__func__, ret); +} +int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip){ + if( camera == NULL){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH ) + return CAMERA_ERROR_INVALID_PARAMETER; + + int ret; + camera_s * handle = (camera_s*)camera; + int vflip = 0; + int hflip = 0; + vflip = (flip & CAMERA_FLIP_VERTICAL) == CAMERA_FLIP_VERTICAL; + hflip = (flip & CAMERA_FLIP_HORIZONTAL) == CAMERA_FLIP_HORIZONTAL; + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, "" , hflip , "" , vflip , NULL); + return __convert_camera_error_code(__func__, ret); +} + +int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip){ + if( camera == NULL || flip == NULL ){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + int vflip =0; + int hflip = 0; + int result = 0; + char *error; + ret = mm_camcorder_get_attributes(handle->mm_handle ,&error, "" , &hflip , "" , &vflip , NULL); + + if( ret == 0){ + if( vflip) + result = result | CAMERA_FLIP_VERTICAL; + if( hflip ) + result = result | CAMERA_FLIP_HORIZONTAL; + *flip = result; + } + return __convert_camera_error_code(__func__, ret); + +} diff --git a/test/multimedia_camera_test.c b/test/multimedia_camera_test.c index 7bf3baf..d9cf40c 100755 --- a/test/multimedia_camera_test.c +++ b/test/multimedia_camera_test.c @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and -* limitations under the License. +* limitations under the License. */ @@ -84,7 +84,7 @@ int stillshot_test(){ camera_attr_set_image_quality(camera, 100); camera_set_capturing_cb(camera, capturing_cb, "/mnt/nfs/test.jpg"); camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); camera_attr_set_tag_orientation(camera,6); //camera_attr_set_tag_orientation(camera,CAMERA_ATTR_TAG_ORT_0R_VT_0C_VR); //camera_attr_enable_tag(camera, true); @@ -210,7 +210,7 @@ int zoom_test(camera_h camera){ return 0; } -bool g_af_test_pass ; +bool g_af_test_pass ; bool _af_mode_test_cb(camera_attr_af_mode_e mode, void *user_data){ camera_h camera = (camera_h) user_data; int ret; @@ -536,7 +536,7 @@ int camera_attribute_test(){ camera_h camera ; camera_create(CAMERA_DEVICE_CAMERA0 , &camera); camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); printf("-----------------------create camera-----------------------------\n"); preview_fps_test(camera); @@ -600,7 +600,7 @@ int camera_preview_test(){ camera_create(CAMERA_DEVICE_CAMERA0 , &camera); camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); camera_set_preview_cb(camera, _camera_preview_test_cb , &preview_test_data); ret = camera_foreach_supported_preview_format(camera, _preview_format_test_cb,enable_preview_format); @@ -667,7 +667,7 @@ int camera_state_change_test(){ camera_create(CAMERA_DEVICE_CAMERA0 , &camera); camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); camera_set_state_changed_cb(camera, _state_change_test_cb, &data); camera_set_capturing_cb(camera,_capture_test_cb, NULL); @@ -740,7 +740,7 @@ int capture_test(){ camera_create(CAMERA_DEVICE_CAMERA0 , &camera); camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); camera_set_capturing_cb(camera,_capture_test2_cb, &iscalled); camera_start_preview(camera); iscalled = 0; @@ -804,7 +804,7 @@ int capture_resolution_test(){ camera_create(CAMERA_DEVICE_CAMERA0 , &camera); camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); resolution_list.count = 0; camera_foreach_supported_capture_resolution(camera, capture_resolution_test_cb, &resolution_list); //camera_set_state_changed_cb(camera, state_cb, NULL); @@ -852,7 +852,7 @@ bool preview_resolution_cb(int width, int height, void *user_data) void preview_test(){ - camera_h camera ; + camera_h camera ; camera_create(CAMERA_DEVICE_CAMERA0, &camera); camera_set_display(camera, CAMERA_DISPLAY_TYPE_EVAS,img); //camera_foreach_supported_preview_resolution(camera,preview_resolution_cb, NULL); @@ -866,19 +866,19 @@ void rotation_test(){ ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); printf("camera_create %d\n", ret); camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11 , GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_NONE); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_NONE); camera_start_preview(camera); sleep(3); printf("180\n"); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_180); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_180); sleep(3); printf("270\n"); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); sleep(3); printf("90\n"); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_90); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_90); sleep(10); camera_stop_preview(camera); @@ -901,7 +901,7 @@ void focus_test(){ ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); printf("camera_create %d\n", ret); camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11 , GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_DISPLAY_ROTATION_270); + camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); camera_set_focus_changed_cb(camera, _focus_changed_cb2, NULL); camera_start_preview(camera); @@ -962,9 +962,37 @@ void contrast_test2(){ camera_attr_set_contrast(camera, 1); } +void rotation_flip_test(){ + camera_h camera; + camera_flip_e flip; + camera_create(CAMERA_DEVICE_CAMERA0, &camera); + printf("flip in = %d\n", CAMERA_FLIP_HORIZONTAL); + camera_attr_set_stream_flip(camera, CAMERA_FLIP_HORIZONTAL); + camera_attr_get_stream_flip(camera, &flip); + printf("flip out = %d\n", flip); + + printf("flip in = %d\n", CAMERA_FLIP_NONE); + camera_attr_set_stream_flip(camera, CAMERA_FLIP_NONE); + camera_attr_get_stream_flip(camera, &flip); + printf("flip out = %d\n", flip); + + printf("flip in = %d\n", CAMERA_FLIP_VERTICAL); + camera_attr_set_stream_flip(camera, CAMERA_FLIP_VERTICAL); + camera_attr_get_stream_flip(camera, &flip); + printf("flip out = %d\n", flip); + + printf("flip in = %d\n", CAMERA_FLIP_BOTH); + camera_attr_set_stream_flip(camera, CAMERA_FLIP_BOTH); + camera_attr_get_stream_flip(camera, &flip); + printf("flip out = %d\n", flip); + + +} + int camera_test(){ int ret=0; + /* ret = camera_attribute_test(); ret += camera_preview_test(); ret += camera_state_change_test(); @@ -974,7 +1002,8 @@ int camera_test(){ camera_lens_rotation_test(); contrast_test2(); - + */ + rotation_flip_test(); return ret; } |