diff options
author | ty83.chung <ty83.chung@samsung.com> | 2015-01-15 10:51:54 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2015-01-15 15:00:22 +0900 |
commit | 35c0cbe525ced1bc6dc4d2abc4a16c26247b2751 (patch) | |
tree | d403a7f94d0a9fd8e3ee076f49ad19f0abc5113a | |
parent | ee51fbcb94cc80c037acc9860e813dd95334cc57 (diff) | |
download | camera-tizen_3.0.2015.q1_common.tar.gz camera-tizen_3.0.2015.q1_common.tar.bz2 camera-tizen_3.0.2015.q1_common.zip |
1. Remove TC and test directoriessubmit/tizen_mobile/20150119.020413submit/tizen/20150115.085052accepted/tizen/wearable/20150116.010321accepted/tizen/tv/20150116.010654accepted/tizen/mobile/20150119.023402accepted/tizen/common/20150115.180942tizen_3.0.2015.q1_commontizen_3.0.2014.q4_common
2. Remove face_zoom API
3. Remove deprecated APIs related to hdr_capture
4. Add or fix comments of APIs on header files
5. Add new APIs to support media packet
6. Fix build error on 64bit build
Change-Id: Ia3742af9a162f59fe81c88ab63ca93fb6467c6d8
-rwxr-xr-x | CMakeLists.txt | 6 | ||||
-rwxr-xr-x | TC/_export_env.sh | 8 | ||||
-rwxr-xr-x | TC/_export_target_env.sh | 7 | ||||
-rwxr-xr-x | TC/build.sh | 16 | ||||
-rwxr-xr-x | TC/clean.sh | 11 | ||||
-rw-r--r-- | TC/config.default | 3 | ||||
-rwxr-xr-x | TC/execute.sh | 15 | ||||
-rwxr-xr-x | TC/testcase/Makefile | 28 | ||||
-rw-r--r-- | TC/testcase/tslist | 5 | ||||
-rwxr-xr-x | TC/testcase/utc_media_camera_attr.c | 731 | ||||
-rwxr-xr-x | TC/testcase/utc_media_camera_lifecycle.c | 351 | ||||
-rwxr-xr-x | TC/testcase/utc_media_camera_setting.c | 753 | ||||
-rwxr-xr-x | TC/testcase/utc_media_camera_working.c | 906 | ||||
-rwxr-xr-x | TC/tet_scen | 7 | ||||
-rw-r--r-- | TC/tetbuild.cfg | 5 | ||||
-rw-r--r-- | TC/tetclean.cfg | 5 | ||||
-rw-r--r-- | TC/tetexec.cfg | 5 | ||||
-rw-r--r-- | doc/camera_doc.h | 341 | ||||
-rw-r--r-- | doc/images/capi_media_camera_state_diagram.png | bin | 0 -> 21187 bytes | |||
-rw-r--r--[-rwxr-xr-x] | include/camera.h | 3395 | ||||
-rw-r--r-- | include/camera_internal.h | 229 | ||||
-rw-r--r--[-rwxr-xr-x] | include/camera_private.h | 18 | ||||
-rwxr-xr-x | packaging/capi-media-camera.spec | 32 | ||||
-rw-r--r--[-rwxr-xr-x] | src/camera.c | 2408 | ||||
-rw-r--r-- | src/camera_internal.c | 100 | ||||
-rw-r--r-- | test/CMakeLists.txt | 21 | ||||
-rwxr-xr-x | test/multimedia_camera_test.c | 1582 |
27 files changed, 4238 insertions, 6750 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ba3e3..4909f31 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,8 +23,8 @@ SET(service "media") SET(submodule "camera") # for package file -SET(dependents "dlog audio-session-mgr mm-camcorder capi-base-common") -SET(pc_dependents "capi-base-common") +SET(dependents "dlog audio-session-mgr mm-camcorder capi-base-common capi-media-tool gstreamer-1.0 libtbm evas ecore elementary") +SET(pc_dependents "mm-camcorder capi-base-common capi-media-tool gstreamer-1.0 libtbm evas ecore elementary") SET(fw_name "${project_prefix}-${service}-${submodule}") @@ -43,7 +43,7 @@ FOREACH(flag ${${fw_name}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wcast-align -Wcast-qual -Wextra -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") IF("${ARCH}" STREQUAL "arm") diff --git a/TC/_export_env.sh b/TC/_export_env.sh deleted file mode 100755 index 72a11ec..0000000 --- a/TC/_export_env.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -. ./config -export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh deleted file mode 100755 index 5ddaa53..0000000 --- a/TC/_export_target_env.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -. ./config -export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh deleted file mode 100755 index 72aad6c..0000000 --- a/TC/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -c -p ./ -tcc -b -j $JOURNAL_RESULT -p ./ -grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh deleted file mode 100755 index 29743e0..0000000 --- a/TC/clean.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -RESULT_DIR=results - -tcc -c -p ./ # executing tcc, with clean option (-c) -rm -r $RESULT_DIR -rm -r tet_tmp_dir -rm testcase/tet_captured diff --git a/TC/config.default b/TC/config.default deleted file mode 100644 index 12ac1e2..0000000 --- a/TC/config.default +++ /dev/null @@ -1,3 +0,0 @@ -CAPI_PROJECT_ROOT=/home/abyss/capi -TET_INSTALL_HOST_PATH=/home/abyss/TETware -TET_INSTALL_TARGET_PATH=/mnt/nfs/TETware diff --git a/TC/execute.sh b/TC/execute.sh deleted file mode 100755 index a4f6095..0000000 --- a/TC/execute.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -. ./_export_target_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -e -j $JOURNAL_RESULT -p ./ -grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile deleted file mode 100755 index 49e33e0..0000000 --- a/TC/testcase/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -CC ?= gcc - -TCS = utc_media_camera_attr \ - utc_media_camera_lifecycle \ - utc_media_camera_setting \ - utc_media_camera_working \ - - -PKGS = capi-media-camera dlog glib-2.0 gthread-2.0 - -LDFLAGS = `pkg-config --libs $(PKGS)` -LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s - -CFLAGS = -I. `pkg-config --cflags $(PKGS)` -CFLAGS += -I$(TET_ROOT)/inc/tet3 -CFLAGS += -Wall -Werror - -all: $(TCS) - - -%: %.c - $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) - - -clean: - rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist deleted file mode 100644 index 3fb30e5..0000000 --- a/TC/testcase/tslist +++ /dev/null @@ -1,5 +0,0 @@ -/testcase/utc_media_camera_attr -/testcase/utc_media_camera_lifecycle -/testcase/utc_media_camera_setting -/testcase/utc_media_camera_working - diff --git a/TC/testcase/utc_media_camera_attr.c b/TC/testcase/utc_media_camera_attr.c deleted file mode 100755 index 6d3fb33..0000000 --- a/TC/testcase/utc_media_camera_attr.c +++ /dev/null @@ -1,731 +0,0 @@ -/* -* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* 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. -*/ - - - -#include <tet_api.h> -#include <media/camera.h> -#include <stdio.h> - -#define MY_ASSERT( fun , test , msg ) \ -{\ - if( !test ) \ - dts_fail(fun , msg ); \ -} - -static void startup(void); -static void cleanup(void); -static bool _cb_af_mode(camera_attr_af_mode_e mode, void *user_data); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_media_camera_attr_set_preview_fps_negative(void); -static void utc_media_camera_attr_set_preview_fps_positive(void); - -static void utc_media_camera_attr_set_image_quality_negative(void); -static void utc_media_camera_attr_set_image_quality_positive(void); - -static void utc_media_camera_attr_get_preview_fps_negative(void); -static void utc_media_camera_attr_get_preview_fps_positive(void); - -static void utc_media_camera_attr_get_image_quality_negative(void); -static void utc_media_camera_attr_get_image_quality_positive(void); - -static void utc_media_camera_attr_set_zoom_negative(void); -static void utc_media_camera_attr_set_zoom_positive(void); - -static void utc_media_camera_attr_set_af_mode_negative(void); -static void utc_media_camera_attr_set_af_mode_positive(void); - -static void utc_media_camera_attr_set_exposure_mode_negative(void); -static void utc_media_camera_attr_set_exposure_mode_positive(void); - -static void utc_media_camera_attr_set_exposure_negative(void); -static void utc_media_camera_attr_set_exposure_positive(void); - -static void utc_media_camera_attr_set_iso_negative(void); -static void utc_media_camera_attr_set_iso_positive(void); - -static void utc_media_camera_attr_set_brightness_negative(void); -static void utc_media_camera_attr_set_brightness_positive(void); - -static void utc_media_camera_attr_set_contrast_negative(void); -static void utc_media_camera_attr_set_contrast_positive(void); - -static void utc_media_camera_attr_set_whitebalance_negative(void); -static void utc_media_camera_attr_set_whitebalance_positive(void); - -static void utc_media_camera_attr_get_effect_negative(void); -static void utc_media_camera_attr_get_effect_positive(void); - -static void utc_media_camera_attr_get_scene_mode_negative(void); -static void utc_media_camera_attr_get_scene_mode_positive(void); - -static void utc_media_camera_attr_is_enable_tag_negative(void); -static void utc_media_camera_attr_is_enable_tag_positive(void); - -static void utc_media_camera_attr_get_tag_image_description_negative(void); -static void utc_media_camera_attr_get_tag_image_description_positive(void); - -static void utc_media_camera_attr_get_tag_orientation_negative(void); -static void utc_media_camera_attr_get_tag_orientation_positive(void); - -static void utc_media_camera_attr_get_tag_software_negative(void); -static void utc_media_camera_attr_get_tag_software_positive(void); - -static void utc_media_camera_attr_get_geotag_negative(void); -static void utc_media_camera_attr_get_geotag_positive(void); - -static void utc_media_camera_attr_get_flash_mode_negative(void); -static void utc_media_camera_attr_get_flash_mode_positive(void); - -static void utc_media_camera_attr_foreach_supported_af_mode_negative(void); -static void utc_media_camera_attr_foreach_supported_af_mode_positive(void); - -static void utc_media_camera_attr_foreach_supported_exposure_mode_negative(void); -static void utc_media_camera_attr_foreach_supported_exposure_mode_positive(void); - -static void utc_media_camera_attr_foreach_supported_iso_negative(void); -static void utc_media_camera_attr_foreach_supported_iso_positive(void); - -static void utc_media_camera_attr_foreach_supported_whitebalance_negative(void); -static void utc_media_camera_attr_foreach_supported_whitebalance_positive(void); - -static void utc_media_camera_attr_foreach_supported_effect_negative(void); -static void utc_media_camera_attr_foreach_supported_effect_positive(void); - -static void utc_media_camera_attr_foreach_supported_scene_mode_negative(void); -static void utc_media_camera_attr_foreach_supported_scene_mode_positive(void); - -static void utc_media_camera_attr_foreach_supported_flash_mode_negative(void); -static void utc_media_camera_attr_foreach_supported_flash_mode_positive(void); - -static void utc_media_camera_attr_foreach_supported_fps_negative(void); -static void utc_media_camera_attr_foreach_supported_fps_positive(void); - -static void utc_media_camera_attr_get_lens_orientation_negative(void); -static void utc_media_camera_attr_get_lens_orientation_positive(void); - - -struct tet_testlist tet_testlist[] = { - {utc_media_camera_attr_set_preview_fps_negative , 1}, - {utc_media_camera_attr_set_preview_fps_positive , 2 }, - {utc_media_camera_attr_set_image_quality_negative, 3 }, - {utc_media_camera_attr_set_image_quality_positive, 4}, - {utc_media_camera_attr_get_preview_fps_negative, 5}, - {utc_media_camera_attr_get_preview_fps_positive, 6}, - {utc_media_camera_attr_get_image_quality_negative, 7}, - {utc_media_camera_attr_get_image_quality_positive, 8}, - {utc_media_camera_attr_set_zoom_negative, 9}, - {utc_media_camera_attr_set_zoom_positive, 10}, - {utc_media_camera_attr_set_af_mode_negative, 11}, - {utc_media_camera_attr_set_af_mode_positive, 12}, - {utc_media_camera_attr_set_exposure_mode_negative, 13}, - {utc_media_camera_attr_set_exposure_mode_positive, 14}, - {utc_media_camera_attr_set_exposure_negative, 15}, - {utc_media_camera_attr_set_exposure_positive, 16}, - {utc_media_camera_attr_set_iso_negative, 17}, - {utc_media_camera_attr_set_iso_positive, 18}, - {utc_media_camera_attr_set_brightness_negative, 19}, - {utc_media_camera_attr_set_brightness_positive, 20}, - {utc_media_camera_attr_set_contrast_negative, 21}, - {utc_media_camera_attr_set_contrast_positive, 22}, - {utc_media_camera_attr_set_whitebalance_negative, 23}, - {utc_media_camera_attr_set_whitebalance_positive, 24}, - {utc_media_camera_attr_get_effect_negative, 25}, - {utc_media_camera_attr_get_effect_positive, 26}, - {utc_media_camera_attr_get_scene_mode_negative, 27}, - {utc_media_camera_attr_get_scene_mode_positive, 28}, - {utc_media_camera_attr_is_enable_tag_negative, 29}, - {utc_media_camera_attr_is_enable_tag_positive, 30}, - {utc_media_camera_attr_get_tag_image_description_negative, 31}, - {utc_media_camera_attr_get_tag_image_description_positive, 32}, - {utc_media_camera_attr_get_tag_orientation_negative, 33}, - {utc_media_camera_attr_get_tag_orientation_positive, 34}, - {utc_media_camera_attr_get_tag_software_negative, 35}, - {utc_media_camera_attr_get_tag_software_positive, 36}, - {utc_media_camera_attr_get_geotag_negative, 37}, - {utc_media_camera_attr_get_geotag_positive, 38}, - {utc_media_camera_attr_get_flash_mode_negative, 43}, - {utc_media_camera_attr_get_flash_mode_positive, 44}, - {utc_media_camera_attr_foreach_supported_af_mode_negative, 45}, - {utc_media_camera_attr_foreach_supported_af_mode_positive, 46}, - {utc_media_camera_attr_foreach_supported_exposure_mode_negative, 47}, - {utc_media_camera_attr_foreach_supported_exposure_mode_positive, 48}, - {utc_media_camera_attr_foreach_supported_iso_negative, 49}, - {utc_media_camera_attr_foreach_supported_iso_positive, 50}, - {utc_media_camera_attr_foreach_supported_whitebalance_negative, 51}, - {utc_media_camera_attr_foreach_supported_whitebalance_positive, 52}, - {utc_media_camera_attr_foreach_supported_effect_negative, 53}, - {utc_media_camera_attr_foreach_supported_effect_positive, 54}, - {utc_media_camera_attr_foreach_supported_scene_mode_negative, 55}, - {utc_media_camera_attr_foreach_supported_scene_mode_positive, 56}, - {utc_media_camera_attr_foreach_supported_flash_mode_negative, 57}, - {utc_media_camera_attr_foreach_supported_flash_mode_positive, 58}, - {utc_media_camera_attr_foreach_supported_fps_negative, 59}, - {utc_media_camera_attr_foreach_supported_fps_positive, 60}, - {utc_media_camera_attr_get_lens_orientation_negative, 61}, - {utc_media_camera_attr_get_lens_orientation_positive, 62}, - { NULL, 0 }, -}; - -camera_h camera; - -static void startup(void) -{ - fprintf(stderr, "%s test\n", __func__); - /* start of TC */ - int ret; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - if( ret != 0 ) - dts_fail("camera_create", "Could not create camera"); -} - -static void cleanup(void) -{ - /* end of TC */ - camera_destroy(camera); -} - -static void utc_media_camera_attr_set_preview_fps_negative(void) -{ - fprintf(stderr, "%s test\n", __func__); - int ret; - ret = camera_attr_set_preview_fps(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} -static void utc_media_camera_attr_set_preview_fps_positive(void) -{ - int ret; - ret = camera_attr_set_preview_fps(camera, CAMERA_ATTR_FPS_AUTO); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "CAMERA_ATTR_FPS_AUTO set is faild"); -} - -static void utc_media_camera_attr_set_image_quality_negative(void) -{ - int ret; - ret = camera_attr_set_image_quality(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); - -} - -static void utc_media_camera_attr_set_image_quality_positive(void) -{ - int ret; - ret = camera_attr_set_image_quality(camera, 100); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set 100 is faild"); - -} - -static void utc_media_camera_attr_get_preview_fps_negative(void) -{ - int ret; - ret = camera_attr_get_preview_fps(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} - -static void utc_media_camera_attr_get_preview_fps_positive(void) -{ - int ret; - camera_attr_fps_e value; - ret = camera_attr_get_preview_fps(camera, &value); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "fail get preview fps"); -} - -static void utc_media_camera_attr_get_image_quality_negative(void) -{ - int ret; - ret = camera_attr_get_image_quality(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} -static void utc_media_camera_attr_get_image_quality_positive(void) -{ - int ret; - int value; - ret = camera_attr_get_image_quality(camera, &value); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "fail get image quality"); -} - -static void utc_media_camera_attr_set_zoom_negative(void) -{ - int ret; - ret = camera_attr_set_zoom(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); - -} -static void utc_media_camera_attr_set_zoom_positive(void) -{ - int ret; - int min,max; - ret = camera_attr_get_zoom_range(camera, &min, &max); - - if( ret != 0 ) - dts_fail(__func__ , "Failed getting zoom range" ); - - if( max == -1 ) - dts_pass(__func__, "this target is not supported zoom"); - - ret = camera_attr_set_zoom(camera,min); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set 10 is failed"); -} - -static void utc_media_camera_attr_set_af_mode_negative(void) -{ - int ret; - ret = camera_attr_set_af_mode(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); - -} - -static void utc_media_camera_attr_set_af_mode_positive(void) -{ - int ret; - int af_mode = CAMERA_ATTR_AF_NONE; - - camera_attr_foreach_supported_af_mode(camera, _cb_af_mode, &af_mode); - ret = camera_attr_set_af_mode(camera, af_mode); - printf("camera_attr_set_af_mode %d ret=%x\n", af_mode, ret); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set af mode is faild"); - -} - -static void utc_media_camera_attr_set_exposure_mode_negative(void) -{ - int ret; - ret = camera_attr_set_exposure_mode(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); -} -static void utc_media_camera_attr_set_exposure_mode_positive(void) -{ - int ret; - ret = camera_attr_set_exposure_mode(camera, CAMERA_ATTR_EXPOSURE_MODE_ALL); - printf("camera_attr_set_exposure_mode %x\n", ret); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set CAMERA_ATTR_EXPOSURE_MODE_ALL is faild"); -} - -static void utc_media_camera_attr_set_exposure_negative(void) -{ - int ret; - ret = camera_attr_set_exposure(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); - -} -static void utc_media_camera_attr_set_exposure_positive(void) -{ - int ret; - int min,max; - ret = camera_attr_get_exposure_range(camera, &min, &max); - - if( ret != 0 ) - dts_fail(__func__ , "Failed getting exposure range" ); - - if( max == -1 ) - dts_pass(__func__, "this target is not supproted exposure "); - - - ret = camera_attr_set_exposure(camera, min); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set 1 is faild"); - -} - -static void utc_media_camera_attr_set_iso_negative(void) -{ - int ret; - ret = camera_attr_set_iso(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); -} -static void utc_media_camera_attr_set_iso_positive(void) -{ - int ret; - ret = camera_attr_set_iso(camera, CAMERA_ATTR_ISO_AUTO); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "CAMERA_ATTR_ISO_AUTO set is faild"); - -} - -static void utc_media_camera_attr_set_brightness_negative(void) -{ - int ret; - ret = camera_attr_set_brightness(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); - -} -static void utc_media_camera_attr_set_brightness_positive(void) -{ - int ret; - int min, max; - ret = camera_attr_get_brightness_range(camera, &min, &max); - if( ret != 0 ) - dts_fail(__func__ , "Failed getting brightness range" ); - - if( max == -1 ) - dts_pass(__func__, "this target is not supported brightness "); - ret = camera_attr_set_brightness(camera, min+1); - printf("camera_attr_set_brightness ret = %d, min = %d\n", ret, min); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set 1 is faild"); - -} - -static void utc_media_camera_attr_set_contrast_negative(void) -{ - int ret; - ret = camera_attr_set_contrast(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); -} -static void utc_media_camera_attr_set_contrast_positive(void) -{ - int ret; - int min, max; - ret = camera_attr_get_contrast_range(camera, &min, &max); - if( ret != 0 ) - dts_fail(__func__ , "Failed getting contrast range" ); - - if( max == -1 ) - dts_pass(__func__, "this target is not supported contrast "); - ret = camera_attr_set_contrast(camera, min); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set 1 is faild"); -} - -static void utc_media_camera_attr_set_whitebalance_negative(void) -{ - int ret; - ret = camera_attr_set_whitebalance(camera, -1); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "-1 is not allowed"); -} -static void utc_media_camera_attr_set_whitebalance_positive(void) -{ - int ret; - ret = camera_attr_set_whitebalance(camera, CAMERA_ATTR_WHITE_BALANCE_AUTOMATIC); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "set CAMERA_ATTR_WHITE_BALANCE_AUTOMATIC is faild"); - -} - -static void utc_media_camera_attr_get_effect_negative(void) -{ - int ret; - ret = camera_attr_get_effect(camera, 0); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} -static void utc_media_camera_attr_get_effect_positive(void) -{ - int ret; - camera_attr_effect_mode_e value; - ret = camera_attr_get_effect(camera, &value); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get is faild"); - -} - -static void utc_media_camera_attr_get_scene_mode_negative(void) -{ - int ret; - ret = camera_attr_get_scene_mode(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} -static void utc_media_camera_attr_get_scene_mode_positive(void) -{ - int ret; - camera_attr_scene_mode_e value; - ret = camera_attr_get_scene_mode(camera, &value); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get is faild"); - -} - -static void utc_media_camera_attr_is_enable_tag_negative(void) -{ - int ret; - ret = camera_attr_is_enabled_tag(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} -static void utc_media_camera_attr_is_enable_tag_positive(void) -{ - int ret; - bool enable; - ret = camera_attr_is_enabled_tag(camera, &enable); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get enable tag is faild"); -} - -static void utc_media_camera_attr_get_tag_image_description_negative(void) -{ - int ret; - ret = camera_attr_get_tag_image_description(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} -static void utc_media_camera_attr_get_tag_image_description_positive(void) -{ - int ret; - char *buffer; - ret = camera_attr_get_tag_image_description(camera, &buffer); - if( ret == 0) - free(buffer); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get is faild"); -} - -static void utc_media_camera_attr_get_tag_orientation_negative(void) -{ - int ret; - ret = camera_attr_get_tag_orientation(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} -static void utc_media_camera_attr_get_tag_orientation_positive(void) -{ - int ret; - camera_attr_tag_orientation_e value; - ret = camera_attr_get_tag_orientation(camera, &value); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get is faild"); -} - -static void utc_media_camera_attr_get_tag_software_negative(void) -{ - int ret; - ret = camera_attr_get_tag_software(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} -static void utc_media_camera_attr_get_tag_software_positive(void) -{ - int ret; - char *buffer; - ret = camera_attr_get_tag_software(camera, &buffer); - if(ret == 0 ) - free(buffer); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get is faild"); -} - -static void utc_media_camera_attr_get_geotag_negative(void) -{ - int ret; - ret = camera_attr_get_geotag(camera, NULL, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} -static void utc_media_camera_attr_get_geotag_positive(void) -{ - int ret; - double value1,value2, value3; - ret = camera_attr_get_geotag(camera, &value1, &value2, &value3); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get is faild"); - -} - - -static void utc_media_camera_attr_get_flash_mode_negative(void) -{ - int ret; - ret = camera_attr_get_flash_mode(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} -static void utc_media_camera_attr_get_flash_mode_positive(void) -{ - int ret; - camera_attr_flash_mode_e value; - ret = camera_attr_get_flash_mode(camera, &value); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "get is faild"); - -} - -static void utc_media_camera_attr_foreach_supported_af_mode_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_af_mode(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} - -static bool _cb_af_mode(camera_attr_af_mode_e mode, void *user_data) -{ - int *af_mode = NULL; - - af_mode = (int *)user_data; - if (af_mode) { - *af_mode = mode; - return false; - } - - return true; -} - -static void utc_media_camera_attr_foreach_supported_af_mode_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_af_mode(camera, _cb_af_mode, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "faild"); -} - -static void utc_media_camera_attr_foreach_supported_exposure_mode_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_exposure_mode(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} - -bool _cb_exposure_mode(camera_attr_exposure_mode_e mode , void *user_data) -{ - return false; -} - -static void utc_media_camera_attr_foreach_supported_exposure_mode_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_exposure_mode(camera, _cb_exposure_mode, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_foreach_supported_exposure_mode is failed"); - -} - -static void utc_media_camera_attr_foreach_supported_iso_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_iso(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} - -bool _cb_iso(camera_attr_iso_e iso , void *user_data) -{ - return false; -} - -static void utc_media_camera_attr_foreach_supported_iso_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_iso(camera, _cb_iso, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_foreach_supported_exposure_mode is faild"); -} - -static void utc_media_camera_attr_foreach_supported_whitebalance_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_whitebalance(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} - -bool _cb_whitebalance_cb(camera_attr_whitebalance_e wb , void *user_data) -{ - return false; -} - -static void utc_media_camera_attr_foreach_supported_whitebalance_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_whitebalance(camera, _cb_whitebalance_cb, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_foreach_supported_whitebalance is faild"); - -} - -static void utc_media_camera_attr_foreach_supported_effect_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_effect(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} - -bool _cb_effect_cb(camera_attr_effect_mode_e effect , void *user_data) -{ - return false; -} - -static void utc_media_camera_attr_foreach_supported_effect_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_effect(camera, _cb_effect_cb, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_foreach_supported_effect is faild"); - -} - -static void utc_media_camera_attr_foreach_supported_scene_mode_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_scene_mode(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} - -bool _cb_scene_mode_cb(camera_attr_scene_mode_e mode , void *user_data) -{ - return false; -} - -static void utc_media_camera_attr_foreach_supported_scene_mode_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_scene_mode(camera, _cb_scene_mode_cb, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_foreach_supported_scene_mode is faild"); - -} - -static void utc_media_camera_attr_foreach_supported_flash_mode_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_flash_mode(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} - -bool _cb_flash_mode_cb(camera_attr_flash_mode_e mode, void *user_data) -{ - return false; -} - -static void utc_media_camera_attr_foreach_supported_flash_mode_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_flash_mode(camera, _cb_flash_mode_cb, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_foreach_supported_flash_mode is faild"); - -} - -static void utc_media_camera_attr_foreach_supported_fps_negative(void) -{ - int ret; - ret = camera_attr_foreach_supported_fps(camera, NULL, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} - -bool _cb_fps_cb(camera_attr_fps_e fps, void *user_data) -{ - return false; -} - -static void utc_media_camera_attr_foreach_supported_fps_positive(void) -{ - int ret; - ret = camera_attr_foreach_supported_fps(camera, _cb_fps_cb, NULL); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_foreach_supported_fps is faild"); - -} - - -static void utc_media_camera_attr_get_lens_orientation_negative(void) -{ - int ret; - ret = camera_attr_get_lens_orientation(camera, NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); - -} -static void utc_media_camera_attr_get_lens_orientation_positive(void) -{ - int ret; - int rotate; - ret = camera_attr_get_lens_orientation(camera, &rotate); - dts_check_eq(__func__, ret, CAMERA_ERROR_NONE, "camera_attr_get_lens_orientation is faild"); -} - diff --git a/TC/testcase/utc_media_camera_lifecycle.c b/TC/testcase/utc_media_camera_lifecycle.c deleted file mode 100755 index f2ee9a7..0000000 --- a/TC/testcase/utc_media_camera_lifecycle.c +++ /dev/null @@ -1,351 +0,0 @@ -/* -* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* 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. -*/ - - - -#include <tet_api.h> -#include <media/camera.h> -#include <stdio.h> -#include <glib.h> -#include <pthread.h> - - -#define MY_ASSERT( fun , test , msg ) \ -{\ - if( !test ) \ - dts_fail(fun , msg ); \ -} - -static GMainLoop *g_mainloop = NULL; -static GThread *event_thread; - - - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_media_camera_create_negative(void); -static void utc_media_camera_create_positive(void); - -static void utc_media_camera_destroy_negative(void); -static void utc_media_camera_destroy_positive(void); - -static void utc_media_camera_start_preview_negative(void); -static void utc_media_camera_start_preview_positive(void); - -static void utc_media_camera_stop_preview_negative(void); -static void utc_media_camera_stop_preview_positive(void); - -static void utc_media_camera_start_capture_negative(void); -static void utc_media_camera_start_capture_positive(void); - -static void utc_media_camera_get_state_negative(void); -static void utc_media_camera_get_state_positive(void); - -static void utc_media_camera_start_focusing_negative(void); -static void utc_media_camera_start_focusing_positive(void); - -static void utc_media_camera_cancel_focusing_negative(void); -static void utc_media_camera_cancel_focusing_positive(void); - -struct tet_testlist tet_testlist[] = { - - {utc_media_camera_create_negative , 1}, - {utc_media_camera_create_positive , 2}, - {utc_media_camera_destroy_negative , 3}, - {utc_media_camera_destroy_positive , 4}, - {utc_media_camera_start_preview_negative , 5}, - {utc_media_camera_start_preview_positive , 6}, - {utc_media_camera_stop_preview_negative , 7}, - {utc_media_camera_stop_preview_positive , 8}, - {utc_media_camera_get_state_negative , 9}, - {utc_media_camera_get_state_positive , 10}, - {utc_media_camera_start_focusing_negative ,11}, - {utc_media_camera_start_focusing_positive , 12}, - {utc_media_camera_cancel_focusing_negative , 13}, - {utc_media_camera_cancel_focusing_positive , 14}, - {utc_media_camera_start_capture_negative , 15}, - {utc_media_camera_start_capture_positive , 16}, - - { NULL, 0 }, -}; - - -gpointer GmainThread(gpointer data){ - g_mainloop = g_main_loop_new (NULL, 0); - g_main_loop_run (g_mainloop); - - return NULL; -} - - -static void startup(void) -{ - if( !g_thread_supported() ) - { - g_thread_init(NULL); - } - - GError *gerr = NULL; - event_thread = g_thread_create(GmainThread, NULL, 1, &gerr); -} - -static void cleanup(void) -{ - g_main_loop_quit (g_mainloop); - g_thread_join(event_thread); -} - -static void utc_media_camera_create_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - - int ret ; - ret = camera_create(CAMERA_DEVICE_CAMERA0, NULL); - - MY_ASSERT(__func__ , ret != 0 , "NULL is not allowed"); - - dts_pass(__func__, "PASS"); -} -static void utc_media_camera_create_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret ; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - - MY_ASSERT(__func__ , ret == 0 , "create fail"); - - camera_destroy(camera); - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_destroy_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - ret = camera_destroy(NULL); - MY_ASSERT(__func__ , ret != 0 , "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} -static void utc_media_camera_destroy_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret ; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - MY_ASSERT(__func__ , ret == 0 , "camera create fail"); - ret = camera_destroy(camera); - MY_ASSERT(__func__ , ret == 0 , "camera destroy is faild"); - - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_start_preview_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret ; - ret = camera_start_preview(NULL); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} - -static void utc_media_camera_start_preview_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera create is faild"); - ret = camera_start_preview(camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera start preview is faild"); - camera_stop_preview(camera); - camera_destroy(camera); - - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_stop_preview_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera create is faild"); - - ret = camera_stop_preview(camera); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "invalid state"); - - camera_destroy(camera); - - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_stop_preview_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_start_preview(camera); - printf("------------ camera_start_preview %x\n", ret); - MY_ASSERT(__func__ , ret == CAMERA_ERROR_NONE, "camera start preview is faild"); - - ret = camera_stop_preview(camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera_stop_preview is faild"); - - camera_destroy(camera); - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_start_capture_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera create is faild"); - ret = camera_start_capture(camera, NULL, NULL, NULL); - MY_ASSERT(__func__, ret !=CAMERA_ERROR_NONE, "invalid state"); - ret = camera_destroy(camera); - printf("---------------utc_media_camera_start_capture_negative-------------camera_destroy ret = %x\n", ret); - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_start_capture_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11,0); - ret = camera_start_preview(camera); - printf("------------ camera_start_preview %x\n", ret); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera start preview is faild"); - ret = camera_start_capture(camera, NULL, NULL, NULL); - MY_ASSERT(__func__, ret==CAMERA_ERROR_NONE, "camera_start_capture is faild"); - sleep(10); - camera_state_e state; - camera_get_state(camera, &state); - printf("----------camera state = %d\n", state); - ret = camera_start_preview(camera); - printf(" ---camera_start_preview %x\n", ret); - ret = camera_stop_preview(camera); - printf(" ---camera_stop_preview %x\n", ret); - ret = camera_destroy(camera); - printf(" ---camera_destroy %x\n", ret); - printf("---------------%s- end---------------------\n", __func__); - - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_get_state_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_get_state(camera, NULL); - MY_ASSERT(__func__, ret!=CAMERA_ERROR_NONE, "invalid state"); - camera_destroy(camera); - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_get_state_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - camera_state_e state; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_get_state(camera, &state); - MY_ASSERT(__func__, ret==CAMERA_ERROR_NONE, "camera_get_state fail"); - camera_destroy(camera); - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_start_focusing_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_start_focusing(camera, false); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "invalid state"); - printf("-------------camera_start_focusing %x\n", ret); - ret = camera_destroy(camera); - printf("-------------camera_destroy %x\n", ret); - dts_pass(__func__, "PASS"); - -} - -static void utc_media_camera_start_focusing_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_start_preview(camera); - printf("-------------------------- camera_start_preview ret = %x\n", ret); - - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "create camera fail"); - ret = camera_start_focusing(camera, false); - printf("-------------------------- camera_start_focusing ret = %x\n", ret); - MY_ASSERT(__func__, ret==CAMERA_ERROR_NONE, "fail focusing"); - ret = camera_stop_preview(camera); - printf("--------- camera_stop_preview %x\n", ret); - ret = camera_destroy(camera); - printf("--------- camera_destroy %x\n", ret); - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_cancel_focusing_negative(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "create camera fail"); - ret = camera_cancel_focusing(camera); - printf("---- camera_cancel_focusing %x\n", ret); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "invalid state"); - camera_destroy(camera); - dts_pass(__func__, "PASS"); -} - -static void utc_media_camera_cancel_focusing_positive(void) -{ - fprintf(stderr, "--------------- %s - START --------------\n", __func__); - int ret; - camera_h camera; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - printf("------ camera_create %x\n", ret); - ret = camera_start_preview(camera); - printf("------ camera_start_preview %x\n", ret); - ret = camera_start_focusing(camera, false); - printf("------ camera_start_focusing %x\n", ret); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "prepare fail"); - - ret = camera_cancel_focusing(camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "cancel focusing fail"); - camera_stop_preview(camera); - camera_destroy(camera); - dts_pass(__func__, "PASS"); -} diff --git a/TC/testcase/utc_media_camera_setting.c b/TC/testcase/utc_media_camera_setting.c deleted file mode 100755 index 9543faa..0000000 --- a/TC/testcase/utc_media_camera_setting.c +++ /dev/null @@ -1,753 +0,0 @@ -/* -* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* 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. -*/ - - - -#include <tet_api.h> -#include <media/camera.h> -#include <stdio.h> -#include <glib.h> -#include <pthread.h> - - -#define MY_ASSERT( fun , test , msg ) \ -{\ - if( !test ) \ - dts_fail(fun , msg ); \ -} - -static GMainLoop *g_mainloop = NULL; - - -static void utc_camera_set_display_negative(void); -static void utc_camera_set_display_positive(void); - -static void utc_camera_set_preview_resolution_negative(void); -static void utc_camera_set_preview_resolution_positive(void); - -static void utc_camera_set_display_rotation_negative(void); -static void utc_camera_set_display_rotation_positive(void); - -static void utc_camera_set_capture_resolution_negative(void); -static void utc_camera_set_capture_resolution_positive(void); - -static void utc_camera_set_capture_format_negative(void); -static void utc_camera_set_capture_format_positive(void); - -static void utc_camera_set_preview_format_negative(void); -static void utc_camera_set_preview_format_positive(void); - -static void utc_camera_get_preview_resolution_negative(void); -static void utc_camera_get_preview_resolution_positive(void); - -static void utc_camera_get_display_rotation_negative(void); -static void utc_camera_get_display_rotation_positive(void); - -static void utc_camera_get_capture_resolution_negative(void); -static void utc_camera_get_capture_resolution_positive(void); - -static void utc_camera_get_preview_format_negative(void); -static void utc_camera_get_preview_format_positive(void); - -static void utc_camera_set_preview_cb_negative(void); -static void utc_camera_set_preview_cb_positive(void); - -static void utc_camera_unset_preview_cb_negative(void); -static void utc_camera_unset_preview_cb_positive(void); - -static void utc_camera_set_state_changed_cb_negative(void); -static void utc_camera_set_state_changed_cb_positive(void); - -static void utc_camera_unset_state_changed_cb_negative(void); -static void utc_camera_unset_state_changed_cb_positive(void); - -static void utc_camera_set_focus_changed_cb_negative(void); -static void utc_camera_set_focus_changed_cb_positive(void); - -static void utc_camera_unset_focus_changed_cb_negative(void); -static void utc_camera_unset_focus_changed_cb_positive(void); - -static void utc_camera_foreach_supported_preview_resolution_negative(void); -static void utc_camera_foreach_supported_preview_resolution_positive(void); - -static void utc_camera_foreach_supported_capture_resolution_negative(void); -static void utc_camera_foreach_supported_capture_resolution_positive(void); - -static void utc_camera_foreach_supported_capture_format_negative(void); -static void utc_camera_foreach_supported_capture_format_positive(void); - -static void utc_camera_foreach_supported_preview_format_negative(void); -static void utc_camera_foreach_supported_preview_format_positive(void); - -static void utc_camera_set_x11_display_visible_positive(void); -static void utc_camera_set_x11_display_visible_negative(void); - -static void utc_camera_is_x11_display_visible_positive(void); -static void utc_camera_is_x11_display_visible_negative(void); - - -static void utc_camera_set_x11_display_mode_positive(void); -static void utc_camera_set_x11_display_mode_negative(void); - -static void utc_camera_get_x11_display_mode_positive(void); -static void utc_camera_get_x11_display_mode_negative(void); - - -static void utc_camera_get_capture_format_positive(void); -static void utc_camera_get_capture_format_negative(void); - -static void utc_camera_set_error_cb_positive(void); -static void utc_camera_set_error_cb_negative(void); - -static void utc_camera_unset_error_cb_positive(void); -static void utc_camera_unset_error_cb_negative(void); - - - - - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -struct tet_testlist tet_testlist[] = { - {utc_camera_set_display_negative , 1 }, - {utc_camera_set_display_positive , 2 }, - - {utc_camera_set_preview_resolution_negative , 3 }, - {utc_camera_set_preview_resolution_positive , 4 }, - - {utc_camera_set_display_rotation_negative , 5 }, - {utc_camera_set_display_rotation_positive , 6 }, - - {utc_camera_set_capture_resolution_negative , 7 }, - {utc_camera_set_capture_resolution_positive, 8 }, - - {utc_camera_set_capture_format_negative, 9 }, - {utc_camera_set_capture_format_positive, 10 }, - - {utc_camera_set_preview_format_negative, 11 }, - {utc_camera_set_preview_format_positive, 12 }, - - {utc_camera_get_preview_resolution_negative, 13 }, - {utc_camera_get_preview_resolution_positive, 14 }, - - {utc_camera_get_display_rotation_negative, 15 }, - {utc_camera_get_display_rotation_positive, 16 }, - - {utc_camera_get_capture_resolution_negative, 17 }, - {utc_camera_get_capture_resolution_positive, 18 }, - - {utc_camera_get_preview_format_negative, 19 }, - {utc_camera_get_preview_format_positive, 20 }, - - {utc_camera_set_preview_cb_negative, 21 }, - {utc_camera_set_preview_cb_positive, 22 }, - - {utc_camera_unset_preview_cb_negative, 23 }, - {utc_camera_unset_preview_cb_positive, 24 }, - - {utc_camera_set_state_changed_cb_negative, 29 }, - {utc_camera_set_state_changed_cb_positive, 30 }, - - {utc_camera_unset_state_changed_cb_negative, 31 }, - {utc_camera_unset_state_changed_cb_positive, 32 }, - - {utc_camera_set_focus_changed_cb_negative, 33 }, - {utc_camera_set_focus_changed_cb_positive, 34 }, - - {utc_camera_unset_focus_changed_cb_negative, 35 }, - {utc_camera_unset_focus_changed_cb_positive, 36 }, - - {utc_camera_foreach_supported_preview_resolution_negative, 41 }, - {utc_camera_foreach_supported_preview_resolution_positive, 42 }, - - {utc_camera_foreach_supported_capture_resolution_negative, 43 }, - {utc_camera_foreach_supported_capture_resolution_positive, 44 }, - - {utc_camera_foreach_supported_capture_format_negative, 45 }, - {utc_camera_foreach_supported_capture_format_positive, 46 }, - - {utc_camera_foreach_supported_preview_format_negative, 47 }, - {utc_camera_foreach_supported_preview_format_positive, 48 }, - - { utc_camera_set_x11_display_visible_negative , 49 }, - { utc_camera_set_x11_display_visible_positive , 50 }, - - { utc_camera_is_x11_display_visible_negative , 51 }, - { utc_camera_is_x11_display_visible_positive , 52 }, - - { utc_camera_set_x11_display_mode_negative , 53 }, - { utc_camera_set_x11_display_mode_positive , 54 }, - - { utc_camera_get_x11_display_mode_negative , 55 }, - { utc_camera_get_x11_display_mode_positive , 56 }, - - { utc_camera_get_capture_format_positive , 57 }, - { utc_camera_get_capture_format_negative , 58 }, - - { utc_camera_set_error_cb_positive , 59 }, - { utc_camera_set_error_cb_negative , 60 }, - - { utc_camera_unset_error_cb_positive , 61 }, - { utc_camera_unset_error_cb_negative , 62 }, - - - { NULL, 0 }, -}; - - -gpointer GmainThread(gpointer data){ - g_mainloop = g_main_loop_new (NULL, 0); - g_main_loop_run (g_mainloop); - - return NULL; -} - -camera_h camera; - - -static void startup(void) -{ - fprintf(stderr, "%s test\n", __func__); - /* start of TC */ - int ret; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - if( ret != 0 ) - dts_fail("camera_create", "Could not create camera"); -} - -static void cleanup(void) -{ - /* end of TC */ - camera_destroy(camera); -} - - -static void utc_camera_set_display_negative(void) -{ - fprintf(stderr, "%s test\n", __func__); - int ret; - ret = camera_set_display(NULL, CAMERA_DISPLAY_TYPE_X11, 0); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} -static void utc_camera_set_display_positive(void) -{ - int ret; - ret = camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11, 0); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "set display handle fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_set_preview_resolution_negative(void) -{ - int ret; - ret = camera_set_preview_resolution(NULL,0, 0); - dts_check_ne(__func__, ret, CAMERA_ERROR_NONE, "NULL is not allowed"); -} - - -bool _preview_resolution_cb(int width, int height, void *user_data ) -{ - int *resolution = (int*)user_data; - resolution[0] = width; - resolution[1] = height; - return false; -} - -static void utc_camera_set_preview_resolution_positive(void) -{ - int ret; - int resolution[2]; - - camera_foreach_supported_preview_resolution(camera, _preview_resolution_cb, resolution) ; - ret = camera_set_preview_resolution(camera,resolution[0], resolution[1]); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "set preview resolution is faild"); - - dts_pass(__func__, "PASS"); -} - -static void utc_camera_set_display_rotation_negative(void) -{ - int ret; - ret = camera_set_x11_display_rotation(camera, -1); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow -1"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_set_display_rotation_positive(void) -{ - int ret; - ret = camera_set_x11_display_rotation(camera, CAMERA_ROTATION_NONE); - MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_display_rotation fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_set_capture_resolution_negative(void) -{ - int ret; - ret = camera_set_capture_resolution(NULL, 0,0); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow NULL"); - dts_pass(__func__, "PASS"); -} - -bool _capture_resolution_cb(int width, int height, void *user_data) -{ - int *resolution = (int*) user_data; - resolution[0] = width; - resolution[1] = height; - return false; -} - -static void utc_camera_set_capture_resolution_positive(void) -{ - int ret; - int resolution[2]; - - camera_foreach_supported_capture_resolution(camera, _capture_resolution_cb, resolution); - ret = camera_set_capture_resolution(camera, resolution[0],resolution[1]); - - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "camera_set_capture_resolution fail"); - dts_pass(__func__, "PASS"); - -} -static void utc_camera_set_capture_format_negative(void) -{ - int ret; - ret = camera_set_capture_format(camera, -1); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow -1"); - - dts_pass(__func__, "PASS"); -} - -bool _capture_format_cb(camera_pixel_format_e format , void *user_data) -{ - int *ret = (int*) user_data; - *ret = format; - return false; -} - -static void utc_camera_set_capture_format_positive(void) -{ - int ret; - int value; - camera_foreach_supported_capture_format(camera, _capture_format_cb, &value); - ret = camera_set_capture_format(camera, value); - MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_capture_format fail"); - - dts_pass(__func__, "PASS"); -} - -static void utc_camera_set_preview_format_negative(void) -{ - int ret ; - ret = camera_set_preview_format(camera, -1); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "-1 is not allowed"); - dts_pass(__func__, "PASS"); -} - -bool _preview_format_cb(camera_pixel_format_e format , void *user_data) -{ - camera_pixel_format_e * ret = (camera_pixel_format_e*)user_data; - *ret = format; - return false; -} - -static void utc_camera_set_preview_format_positive(void) -{ - int ret; - camera_pixel_format_e format; - camera_foreach_supported_preview_format(camera, _preview_format_cb, &format); - ret = camera_set_preview_format(camera, format); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE,"set preview format fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_get_preview_resolution_negative(void) -{ - int ret ; - ret = camera_get_preview_resolution(NULL, NULL,NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - - dts_pass(__func__, "PASS"); -} -static void utc_camera_get_preview_resolution_positive(void) -{ - int ret; - int value1; - int value2; - ret = camera_get_preview_resolution(camera, &value1,&value2); - MY_ASSERT(__func__,ret == CAMERA_ERROR_NONE, "get preview resolution fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_get_display_rotation_negative(void) -{ - int ret ; - ret = camera_get_x11_display_rotation(NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - - dts_pass(__func__, "PASS"); - -} -static void utc_camera_get_display_rotation_positive(void) -{ - int ret; - camera_rotation_e value; - ret = camera_get_x11_display_rotation(camera, &value); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail get display rotation"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_get_capture_resolution_negative(void) -{ - int ret ; - ret = camera_get_capture_resolution(NULL, NULL,NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_get_capture_resolution_positive(void) -{ - int ret; - int value1, value2; - ret = camera_get_capture_resolution(camera,&value1, &value2); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "get capture resolution fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_get_preview_format_negative(void) -{ - int ret ; - ret = camera_get_preview_format(NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - - dts_pass(__func__, "PASS"); -} -static void utc_camera_get_preview_format_positive(void) -{ - int ret; - int value; - ret= camera_get_preview_format(camera, &value); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "get preview format fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_set_preview_cb_negative(void) -{ - int ret ; - ret = camera_set_preview_cb(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - -void _preview_cb(void* stream_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data) -{ -} - -static void utc_camera_set_preview_cb_positive(void) -{ - int ret; - ret = camera_set_preview_cb(camera,_preview_cb,NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "set preview cb fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_unset_preview_cb_negative(void) -{ - int ret ; - ret = camera_unset_preview_cb(NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_unset_preview_cb_positive(void) -{ - int ret; - ret = camera_unset_preview_cb(camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "unset preview cb fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_set_state_changed_cb_negative(void) -{ - int ret ; - ret = camera_set_state_changed_cb(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); - -} - -void _changed_cb(camera_state_e previous , camera_state_e current , bool by_asm, void *user_data) -{ -} - -static void utc_camera_set_state_changed_cb_positive(void) -{ - int ret; - ret = camera_set_state_changed_cb(camera, _changed_cb, NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE , "set state change cb fail"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_unset_state_changed_cb_negative(void) -{ - int ret ; - ret = camera_unset_state_changed_cb(NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_unset_state_changed_cb_positive(void) -{ - int ret ; - ret = camera_unset_state_changed_cb(camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "camera_unset_state_changed_cb fail"); - - dts_pass(__func__, "PASS"); -} -static void utc_camera_set_focus_changed_cb_negative(void) -{ - int ret ; - ret = camera_set_focus_changed_cb(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - -void _focus_changed_cb(camera_focus_state_e state, void *user_data) -{ -} - -static void utc_camera_set_focus_changed_cb_positive(void) -{ - int ret; - ret = camera_set_focus_changed_cb(camera, _focus_changed_cb, NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - - dts_pass(__func__, "PASS"); -} -static void utc_camera_unset_focus_changed_cb_negative(void) -{ - int ret ; - ret = camera_unset_focus_changed_cb(NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_unset_focus_changed_cb_positive(void) -{ - int ret ; - ret = camera_unset_focus_changed_cb(camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_foreach_supported_preview_resolution_negative(void) -{ - int ret ; - ret = camera_foreach_supported_preview_resolution(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - -bool _preview_resolution_cb2(int width, int height, void *user_data ) -{ - return false; -} - -static void utc_camera_foreach_supported_preview_resolution_positive(void) -{ - int ret ; - ret = camera_foreach_supported_preview_resolution(camera, _preview_resolution_cb2, NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_foreach_supported_capture_resolution_negative(void) -{ - int ret ; - ret = camera_foreach_supported_capture_resolution(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - -bool _capture_resolution_cb2(int width, int height, void *user_data) -{ - return false; -} - -static void utc_camera_foreach_supported_capture_resolution_positive(void) -{ - int ret ; - ret = camera_foreach_supported_capture_resolution(camera, _capture_resolution_cb2, NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_foreach_supported_capture_format_negative(void) -{ - int ret ; - ret = camera_foreach_supported_capture_format(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - -bool _capture_format_cb2(camera_pixel_format_e format , void *user_data) -{ - return false; -} - -static void utc_camera_foreach_supported_capture_format_positive(void) -{ - int ret ; - ret = camera_foreach_supported_capture_format(camera, _capture_format_cb2, NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_foreach_supported_preview_format_negative(void) -{ - int ret ; - ret = camera_foreach_supported_preview_format(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - -bool _preview_format_cb2(camera_pixel_format_e format , void *user_data) -{ - return false; -} - -static void utc_camera_foreach_supported_preview_format_positive(void) -{ - int ret ; - ret = camera_foreach_supported_preview_format(camera, _preview_format_cb2,NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - - -static void utc_camera_set_x11_display_visible_positive(void){ - int ret; - ret = camera_set_x11_display_visible(camera, true); - MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_x11_display_visible fail"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_set_x11_display_visible_negative(void){ - int ret; - ret = camera_set_x11_display_visible(NULL, 0); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow NULL"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_is_x11_display_visible_positive(void){ - int ret; - bool value; - ret = camera_is_x11_display_visible(camera, &value); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail camera_is_x11_display_visible"); - dts_pass(__func__, "PASS"); - -} -static void utc_camera_is_x11_display_visible_negative(void){ - int ret ; - ret = camera_is_x11_display_visible(NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - - dts_pass(__func__, "PASS"); -} - - -static void utc_camera_set_x11_display_mode_positive(void){ - int ret; - ret = camera_set_x11_display_mode(camera, CAMERA_DISPLAY_MODE_LETTER_BOX); - MY_ASSERT(__func__, ret== CAMERA_ERROR_NONE , "camera_set_x11_display_mode fail"); - dts_pass(__func__, "PASS"); - -} -static void utc_camera_set_x11_display_mode_negative(void){ - int ret; - ret = camera_set_x11_display_mode(NULL, 0); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE , "not allow NULL"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_get_x11_display_mode_positive(void){ - int ret; - camera_display_mode_e value; - ret = camera_get_x11_display_mode(camera, &value); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail camera_set_x11_display_mode"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_get_x11_display_mode_negative(void){ - int ret ; - ret = camera_get_x11_display_mode(NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - - dts_pass(__func__, "PASS"); -} - - - -static void utc_camera_get_capture_format_positive(void) -{ - int ret; - camera_pixel_format_e value; - ret = camera_get_capture_format(camera, &value); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail camera_get_capture_format"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_get_capture_format_negative(void) -{ - int ret ; - ret = camera_get_capture_format(NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "NULL is not allowed"); - dts_pass(__func__, "PASS"); -} - - - -void _error_cb(int error, camera_state_e current_state, void *user_data) -{ -} - -static void utc_camera_set_error_cb_positive(void) -{ - int ret; - ret = camera_set_error_cb(camera, _error_cb, NULL); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_set_error_cb_negative(void) -{ - int ret; - ret = camera_set_error_cb(NULL, NULL, NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - -static void utc_camera_unset_error_cb_positive(void) -{ - int ret; - ret = camera_unset_error_cb(camera); - MY_ASSERT(__func__, ret == CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} -static void utc_camera_unset_error_cb_negative(void) -{ - int ret; - ret = camera_unset_error_cb(NULL); - MY_ASSERT(__func__, ret != CAMERA_ERROR_NONE, "fail"); - dts_pass(__func__, "PASS"); -} - diff --git a/TC/testcase/utc_media_camera_working.c b/TC/testcase/utc_media_camera_working.c deleted file mode 100755 index 3695c9f..0000000 --- a/TC/testcase/utc_media_camera_working.c +++ /dev/null @@ -1,906 +0,0 @@ -/* -* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* 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. -*/ - - - -#include <tet_api.h> -#include <media/camera.h> -#include <stdio.h> -#include <glib.h> - -#define MY_ASSERT( fun , test , msg ) \ -{\ - if( !test ) \ - dts_fail(fun , msg ); \ -} - -static GMainLoop *g_mainloop = NULL; -static GThread *event_thread; -int preview_win = 0; - - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_media_camera_attribute_test(void); -static void utc_media_camera_preview_test(void); -static void utc_media_camera_state_change_test(void); -static void utc_media_camera_capture_test(void); -static void utc_media_capture_resolution_test(void); - -struct tet_testlist tet_testlist[] = { - { utc_media_camera_attribute_test , 1 }, - { utc_media_camera_preview_test, 2} , - { utc_media_camera_state_change_test , 3 }, - { utc_media_camera_capture_test , 4 }, - { utc_media_capture_resolution_test , 5 }, - { NULL, 0 }, -}; - - -gpointer GmainThread(gpointer data){ - g_mainloop = g_main_loop_new (NULL, 0); - g_main_loop_run (g_mainloop); - - return NULL; -} - - -static void startup(void) -{ - if( !g_thread_supported() ) - { - g_thread_init(NULL); - } - - GError *gerr = NULL; - event_thread = g_thread_create(GmainThread, NULL, 1, &gerr); -} - -static void cleanup(void) -{ - g_main_loop_quit (g_mainloop); - g_thread_join(event_thread); -} - - -void state_cb(camera_state_e previous , camera_state_e current , int by_asm, void *user_data){ - char *state_table[] ={ - "CAMERA_STATE_NONE", /**< camera is not created yet */ - "CAMERA_STATE_CREATED", /**< camera is created, but not initialized yet */ - "CAMERA_STATE_PREVIEW", /**< camera is prepared to capture (Preview) */ - "CAMERA_STATE_CAPTURING", /**< While capturing*/ - "CAMERA_STATE_CAPTURED", /**< camera is now recording */ - "CAMERA_STATE_NUM", /**< Number of camera states */ - }; - printf("%s\n", state_table[current]); -} - -void capture_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data) -{ - char * filepath = (char*)user_data; - FILE* f = fopen(filepath, "w+"); - bool ret; - if(f!=NULL && image_buffer !=NULL) - { - fwrite(image_buffer,1, buffer_size, f); - printf("capture(%s) %dx%d, buffer_size=%d\n", filepath, width, height, buffer_size); - ret = TRUE; - } - else - { - ret = FALSE; - } - - fclose(f); -} - -int capture_complete(void *user_data){ - camera_h cam = (camera_h)user_data; - - printf("capture_complete!!\n"); - - camera_start_preview(cam); - - return 1; -} - - -bool g_preview_fps_pass; -bool _preview_fps_cb(camera_attr_fps_e fps, void *user_data){ - int ret; - camera_attr_fps_e get_fps; - camera_h camera = (camera_h) user_data; - ret = camera_attr_set_preview_fps(camera, fps); - printf("-set preview fps %d\tret=%x\n", fps, ret); - ret = camera_attr_get_preview_fps(camera, &get_fps); - printf("-get preview fps %d\tret=%x", get_fps, ret); - - if(get_fps == fps) - printf("\t\t\tpass\n"); - else{ - printf("\t\t\tfail\n"); - g_preview_fps_pass = false; - return false; - } - return true; -} - - -int preview_fps_test(camera_h camera) -{ - g_preview_fps_pass = true; - printf("------------- PREVIEW FPS TEST -------------\n"); - camera_attr_foreach_supported_fps(camera, _preview_fps_cb,(void*)camera); - printf("--------------------------------------------\n"); - if( g_preview_fps_pass ){ - printf("PREVIEW FPS TEST PASS\n\n"); - return 0; - }else{ - printf("PREVIEW FPS TEST FAIL\n\n"); - return -1; - } -} - -int image_quality_test(camera_h camera){ - int ret1; - int ret2; - int i; - printf("------------- IMAGE QUALITY TEST -------------\n"); - for( i =-10; i <= 110 ; i+=10){ - int quality; - ret1 = camera_attr_set_image_quality(camera,i); - printf("-set image quality %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_image_quality(camera,&quality); - printf("-get image quality %d\tret=%x",quality,ret2); - - if( i >=0 && i <= 100){ - if( quality == i ){ - printf("\t\t\tpass\n"); - }else - { - printf("\t\t\tfail\n"); - return -1; - } - }else{ //out of bound error - if( ret1 == 0){ - printf("\t\t\tfail\n"); - return -1; - }else{ - printf("\t\t\tpass\n"); - } - } - - } - printf("--------------------------------------------\n"); - printf("IMAGE QUALITY TEST PASS\n\n"); - - return 0; -} - -int zoom_test(camera_h camera){ - int ret1 ; - int ret2 ; - int i; - int min, max; - printf("------------- ZOOM TEST -------------\n"); - camera_attr_get_zoom_range(camera, &min, &max); - if(max == -1 ) - return 0; - for( i = min ; i <= max; i+=5 ){ - int zoom; - ret1 = camera_attr_set_zoom(camera, i); - printf("-set zoom %d\tret=%x\n",i, ret1); - ret2 = camera_attr_get_zoom(camera,&zoom); - printf("-get zoom %d\tret=%x",zoom, ret2); - - if( i >=min && i <= max ){ - if( i == zoom ) - printf("\t\t\tpass\n"); - else{ - printf("\t\t\tfail\n"); - return -1; - } - }else{ - if( ret1 == 0 ){ - printf("\t\t\tfail\n"); - return -1; - }else{ - printf("\t\t\tpass\n"); - } - } - } - printf("--------------------------------------------\n"); - printf("ZOOM TEST PASS\n\n"); - - camera_attr_set_zoom(camera, 10); - return 0; -} - -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; - camera_attr_af_mode_e get_mode; - ret= camera_attr_set_af_mode(camera, mode); - printf("-set af mode %d\tret=%x\n", mode, ret); - ret= camera_attr_get_af_mode(camera, &get_mode); - printf("-get af mode %d\tret=%x", get_mode, ret); - if( mode != get_mode ){ - printf("\t\t\tFAIL\n"); - g_af_test_pass= false; - return false; - }else - printf("\t\t\tPASS\n"); - return true; -} - -int af_mode_test(camera_h camera){ - g_af_test_pass = true; - camera_attr_foreach_supported_af_mode(camera, _af_mode_test_cb, camera); - return g_af_test_pass ? 0 : -1; -} - -bool g_exposure_mode_pass; -bool _exposure_mode_test_cb(camera_attr_exposure_mode_e mode, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - camera_attr_exposure_mode_e get_mode; - - ret = camera_attr_set_exposure_mode(camera, mode); - printf("-set exposure mode %d\tret=%x\n", mode,ret); - ret = camera_attr_get_exposure_mode(camera,&get_mode); - printf("-get exposure mode %d\tret=%x\n", get_mode,ret); - if( get_mode != mode ){ - g_exposure_mode_pass = false; - return false; - } - return true; -} - -int exposure_mode_test(camera_h camera){ - g_exposure_mode_pass = true; - camera_attr_foreach_supported_exposure_mode(camera,_exposure_mode_test_cb, camera); - camera_attr_set_exposure_mode(camera, CAMERA_ATTR_EXPOSURE_MODE_ALL); - - return g_exposure_mode_pass ? 0 : -1; -} - -int exposure_test(camera_h camera){ - int i; - int ret1, ret2; - int default_value; - int min,max; - ret1 = camera_attr_get_exposure(camera, &default_value ); - camera_attr_get_exposure_range(camera, &min, &max); - printf("exposure range %d~%d\n", min, max); - if(max == -1 ) - return 0; - for( i = 1; i < 13 ; i++ ){ - int value; - ret1 = camera_attr_set_exposure(camera, i ); - printf("-set exposure %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_exposure(camera, &value); - printf("-get exposure %d\tret=%x\n",value,ret2); - if( i >= min && i <= max ){ - if( value != i) - return -1; - }else{ // out of bound error - if( ret1 == 0 ) - return -1; - } - } - ret1 = camera_attr_set_exposure(camera, default_value ); - return 0; -} - -bool g_iso_test_pass ; -bool _iso_test_cb(camera_attr_iso_e iso, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - camera_attr_iso_e get_iso; - ret = camera_attr_set_iso(camera, iso); - printf("-set iso %d\tret=%x\n", iso, ret); - ret = camera_attr_get_iso(camera,&get_iso); - printf("-get iso %d\tret=%x\n", get_iso, ret); - if( get_iso != iso ){ - g_iso_test_pass = false; - return false; - } - return true; -} - -int iso_test(camera_h camera){ - g_iso_test_pass = true; - camera_attr_foreach_supported_iso(camera,_iso_test_cb, camera); - return g_iso_test_pass ? 0 : -1; -} - -int brightness_test(camera_h camera){ - int i; - int ret1,ret2; - int default_value; - int min,max; - ret1 = camera_attr_get_brightness(camera, &default_value ); - camera_attr_get_brightness_range(camera, &min, &max); - if(max == -1 ) - return 0; - for( i = 1; i < 13 ; i++ ){ - int value; - ret1 = camera_attr_set_brightness(camera, i ); - printf("-set brightness %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_brightness(camera, &value); - printf("-get brightness %d\tret=%x\n",value,ret2); - - if( i >= min && i <= max ){ - if( value != i) - return -1; - }else{ // out of bound error - if( ret1 == 0 ) - return -1; - } - - } - ret1 = camera_attr_set_brightness(camera, default_value ); - return 0; - -} - -int contrast_test(camera_h camera){ - int i; - int ret1,ret2; - int default_value; - int min,max; - ret1 = camera_attr_get_contrast (camera, &default_value ); - camera_attr_get_contrast_range(camera, &min, &max); - if(max == -1 ) - return 0; - for( i = 1; i < 13 ; i++ ){ - int value; - ret1 = camera_attr_set_contrast (camera, i ); - printf("-set contrast %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_contrast (camera, &value); - printf("-get contrast %d\tret=%x\n",value,ret2); - - if( i >= min && i <= max ){ - if( value != i) - return -1; - }else{ // out of bound error - if( ret1 == 0 ) - return -1; - } - } - ret1 = camera_attr_set_contrast (camera, default_value ); - return 0; -} - -bool _whitebalance_test_cb(camera_attr_whitebalance_e wb, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_whitebalance(camera, wb); - printf("-set whitebalance %d\tret=%x\n", wb,ret); - ret = camera_attr_get_whitebalance(camera,&wb); - printf("-get whitebalance %d\tret=%x\n", wb,ret); - return true; -} - - -int whitebalance_test(camera_h camera){ - camera_attr_foreach_supported_whitebalance(camera, _whitebalance_test_cb ,camera); - return 0; -} - -bool _effect_test_cb(camera_attr_effect_mode_e effect, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_effect(camera, effect); - printf("-set effect %d\tret=%x\n", effect,ret); - ret = camera_attr_get_effect(camera,&effect); - printf("-get effect %d\tret=%x\n", effect,ret); - return true; -} - - -int effect_test(camera_h camera){ - camera_attr_foreach_supported_effect(camera, _effect_test_cb, camera); - return 0; -} - - -bool _scene_mode_test_cb (camera_attr_scene_mode_e mode, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_scene_mode(camera, mode); - printf("-set scene %d\tret=%x\n", mode,ret); - ret = camera_attr_get_scene_mode(camera,&mode); - printf("-get scene %d\tret=%x\n", mode,ret); - return true; -} - -int scene_mode_test(camera_h camera){ - camera_attr_foreach_supported_scene_mode(camera, _scene_mode_test_cb, camera); - return 0; -} - -int tag_enable_test(camera_h camera){ - int ret; - bool enable; - ret = camera_attr_enable_tag(camera, true); - printf("-set enable tag true\tret=%x\n",ret); - ret = camera_attr_is_enabled_tag(camera, &enable); - printf("-get enable tag %d\tret=%x\n",enable, ret); - return 0; -} - -int tag_orientation_test(camera_h camera){ - int ret; - camera_attr_tag_orientation_e orientation; - - ret = camera_attr_set_tag_orientation(camera, 1); - printf("-set tag orientation %d\tret=%x\n",1 ,ret); - ret= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - - ret |= camera_attr_set_tag_orientation(camera, 2 ); - printf("-set tag orientation %d\tret=%x\n",2 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 3 ); - printf("-set tag orientation %d\tret=%x\n",3 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 4 ); - printf("-set tag orientation %d\tret=%x\n",4 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 5 ); - printf("-set tag orientation %d\tret=%x\n",5 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 6 ); - printf("-set tag orientation %d\tret=%x\n",6 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 7 ); - printf("-set tag orientation %d\tret=%x\n",7 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 8 ); - printf("-set tag orientation %d\tret=%x\n",8 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - return ret == 0 ? 0 : -1; - -} - -int tag_image_description_test(camera_h camera){ - char *buffer; - int ret; - ret = camera_attr_set_tag_image_description(camera, "hello capi"); - printf("-set tag image description \"hello capi\"\tret=%x\n", ret); - ret = camera_attr_get_tag_image_description(camera, &buffer); - printf("-get tag image description \"%s\"\tret=%x\n", buffer, ret); - free(buffer); - ret = camera_attr_set_tag_image_description(camera, "12345678901234567890"); - printf("-set tag image description \"12345678901234567890\"\tret=%x\n", ret); - ret = camera_attr_get_tag_image_description(camera, &buffer); - printf("-get tag image description \"%s\"\tret=%x\n", buffer, ret); - free(buffer); - return 0; -} - -int tag_software_test(camera_h camera){ - char *buffer; - int ret; - ret = camera_attr_set_tag_software(camera, "hello capi"); - printf("-set tag software \"hello capi\"\tret=%x\n", ret); - ret = camera_attr_get_tag_software(camera, &buffer); - printf("-get tag software \"%s\"\tret=%x\n", buffer, ret); - free(buffer); - - ret = camera_attr_set_tag_software(camera, "12345678901234567890"); - printf("-set tag software \"12345678901234567890\"\tret=%x\n", ret); - ret = camera_attr_get_tag_software(camera, &buffer); - printf("-get tag software \"%s\"\tret=%x\n", buffer, ret); - free(buffer); - return 0; -} - - -bool _flash_mode_test_cb(camera_attr_flash_mode_e mode, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_flash_mode(camera, mode); - printf("-set flash mode %d\tret=%x\n", mode,ret); - ret = camera_attr_get_flash_mode(camera,&mode); - printf("-get flash mode %d\tret=%x\n", mode,ret); - return true; -} - - -int flash_mode_test(camera_h camera){ - camera_attr_foreach_supported_flash_mode(camera, _flash_mode_test_cb,camera); - return 0; -} - -int gps_test(camera_h camera){ - double lng = 1.12; - double lat = 1.13; - double alt = 1.14; - int ret; - ret = camera_attr_set_geotag(camera, lat, lng , alt ); - if( ret != 0) - return -1; - ret = camera_attr_get_geotag(camera, &lat , &lng , &alt); - if( ret != 0 ) - return -1; - return 0; -} - - -void utc_media_camera_attribute_test(void) -{ - int ret; - camera_h camera ; - int ret2; - 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_ROTATION_270); - printf("-----------------------create camera-----------------------------\n"); - - ret = preview_fps_test(camera); - printf("preview_fps_test %d\n", ret); - ret += image_quality_test(camera); - printf("image_quality_test %d\n", ret); - - ret2 = camera_start_preview(camera); - printf("--------------------------preview-started----------%x-------------------------\n", ret2); - ret += zoom_test(camera); - printf("zoom_test %d\n", ret); - ret += af_mode_test(camera); - printf("af_mode_test %d\n", ret); - ret += exposure_mode_test(camera); - printf("exposure_mode_test %d\n", ret); - ret += exposure_test(camera); - printf("exposure_test %d\n", ret); - ret += iso_test(camera); - printf("iso_test %d\n", ret); - ret += brightness_test(camera); - printf("brightness_test %d\n", ret); - ret += contrast_test(camera); - printf("contrast_test %d\n", ret); - ret += whitebalance_test(camera); - printf("whitebalance_test %d\n", ret); - ret += effect_test(camera); - printf("effect_test %d\n", ret); - ret += scene_mode_test(camera); - printf("scene_mode_test %d\n", ret); - ret += tag_enable_test(camera); - printf("tag_enable_test %d\n", ret); - ret += tag_orientation_test(camera); - printf("tag_orientation_test %d\n", ret); - ret += tag_image_description_test(camera); - printf("tag_image_description_test %d\n", ret); - ret += tag_software_test(camera); - printf("tag_software_test %d\n", ret); - ret += flash_mode_test(camera); - printf("flash_mode_test %d\n", ret); - ret += gps_test(camera); - printf("gps_test %d\n", ret); - - camera_stop_preview(camera); - camera_destroy(camera); - - MY_ASSERT(__func__, ret == 0 , "error attribute get set test"); - dts_pass(__func__, "PASS"); - -} - - -typedef struct { - camera_h camera; - camera_pixel_format_e in_format; - bool iscalled; - bool result; -} camera_preview_test_s; - - void _camera_preview_test_cb(void *stream_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){ - camera_preview_test_s * data = (camera_preview_test_s*)user_data; - data->iscalled = true; - if( format == data->in_format ) - data->result = true; - -} - -bool _preview_format_test_cb(camera_pixel_format_e format, void *user_data){ - int *table = (int*)user_data; - table[format] = 1; - return true; -} - - -void utc_media_camera_preview_test(void) -{ - int ret; - camera_h camera ; - int i; - camera_preview_test_s preview_test_data; - int enable_preview_format[CAMERA_PIXEL_FORMAT_JPEG+1] = {0,}; - - - 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_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); - - printf("-----------------------PREVIEW FORMAT TEST-----------------------------\n"); - - for(i =0; i<= CAMERA_PIXEL_FORMAT_JPEG ; i++){ - if( enable_preview_format[i] ){ - preview_test_data.in_format = i; - preview_test_data.camera = camera; - preview_test_data.iscalled = false; - preview_test_data.result = false; - camera_set_preview_format(camera, i); - printf("-------------PREVIEW FORMAT %d TEST--------------------\n", i); - camera_start_preview(camera); - sleep(1); - camera_stop_preview(camera); - if( preview_test_data.iscalled && preview_test_data.result ){ - printf("PASS\n"); - }else{ - printf("FAIL\n"); - camera_destroy(camera); - dts_fail("CAMERA_PREVIEW_TEST", "preview cb is not called"); - return; - } - - } - } - - camera_destroy(camera); - - dts_pass(__func__,"PASS"); - return; - - -} - - -typedef struct{ - bool iscalled; - bool ispreviewed; - bool iscapturing; - bool iscaptured; - camera_state_e state; -} state_change_data; - -void _state_change_test_cb(camera_state_e previous , camera_state_e current , bool by_asm, void *user_data){ - state_change_data * data = (state_change_data*)user_data; - data->iscalled = true; - if( current == CAMERA_STATE_PREVIEW ) - data->ispreviewed = true; - if( current == CAMERA_STATE_CAPTURED ) - data->iscaptured = true; - if( current == CAMERA_STATE_CAPTURING ) - data->iscapturing = true; - data->state = current; -} - -void _capture_test_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - -} - - -void utc_media_camera_state_change_test(void){ - camera_h camera ; - state_change_data data; - bool ispass = true; - - 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_ROTATION_270); - camera_set_state_changed_cb(camera, _state_change_test_cb, &data); - - printf("------------------- PREVIEW STATE Change test------------------\n"); - data.iscalled = false; - data.state = 0; - camera_start_preview(camera); - sleep(1); - if( data.iscalled && data.state == CAMERA_STATE_PREVIEW ) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - - printf("------------------- CREATED STATE Change test------------------\n"); - - data.iscalled = false; - data.state = 0; - camera_stop_preview(camera); - sleep(1); - if( data.iscalled && data.state == CAMERA_STATE_CREATED) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - - printf("------------------- CAPTURED STATE Change test------------------\n"); - - camera_start_preview(camera); - sleep(1); - data.iscalled = false; - data.state = 0; - data.iscaptured = false; - data.ispreviewed= false; - data.iscapturing = false; - camera_start_capture(camera, _capture_test_cb, NULL, NULL); - sleep(3); - if( data.iscalled && data.iscaptured && data.iscapturing && data.state == CAMERA_STATE_CAPTURED) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - camera_start_preview(camera); - camera_stop_preview(camera); - camera_destroy(camera); - MY_ASSERT(__func__, ispass , "camera_state_change_test FAIL"); - dts_pass(__func__, "PASS"); - -} - -void _capture_test2_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - int *iscalled = (int*)user_data; - *iscalled = 1; -} - -void utc_media_camera_capture_test(void){ - camera_h camera ; - int iscalled; - camera_state_e state ; - bool ispass = true; - int timeout = 5; - - printf("---------------------CAPTURE Test -----------------\n"); - - 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_ROTATION_270); - camera_start_preview(camera); - iscalled = 0; - camera_start_capture(camera, _capture_test2_cb,NULL, &iscalled); - - while( timeout-- >0 && camera_get_state(camera, &state ) == 0 && state != CAMERA_STATE_CAPTURED) - sleep(1); - - if( iscalled == 1 ) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - - camera_start_preview(camera); - camera_stop_preview(camera); - camera_destroy(camera); - - MY_ASSERT(__func__, ispass,"capture test fail"); - dts_pass(__func__, "PASS"); - - -} - - -typedef struct{ - int width[100]; - int height[100]; - int count; -} resolution_stack; - - -bool capture_resolution_test_cb(int width, int height, void *user_data){ - resolution_stack *data = (resolution_stack*)user_data; - data->width[data->count] = width; - data->height[data->count] = height; - data->count++; - - printf("%dx%d\n",width, height); - - return true; -} - -typedef struct{ - int expected_width; - int expected_height; - bool ispass; -}preview_test_data; -void _capture_test3_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - preview_test_data *data = (preview_test_data*)user_data; - if( data->expected_height == image->height && data->expected_width == image->width ) - data->ispass = true; - -} - - -void utc_media_capture_resolution_test(void){ - camera_h camera ; - resolution_stack resolution_list; - int i; - camera_state_e state ; - int ret = 0; - - 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_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); - - printf("-----------------CAPTURE RESOLUTION TEST---------------------\n"); - - for(i =0 ; i < resolution_list.count ; i++){ - preview_test_data data; - data.ispass = false; - data.expected_width = resolution_list.width[i]; - data.expected_height = resolution_list.height[i]; - int timeout=5; - - printf("-----------------CAPTURE RESOLUTION (%dx%d)---------------------\n",data.expected_width ,data.expected_height); - - printf("resolution set test %x\n", (unsigned int)camera_set_capture_resolution(camera,data.expected_width ,data.expected_height)); - - camera_start_preview(camera); - - camera_start_capture(camera, _capture_test3_cb, NULL , &data); - - while( timeout-- > 0 && camera_get_state(camera, &state ) == 0 && state != CAMERA_STATE_CAPTURED ){ - sleep(1); - } - - camera_start_preview(camera); - camera_stop_preview(camera); - if( !data.ispass ){ - ret += -1; - printf("FAIL\n"); - }else{ - printf("PASS\n"); - } - } - - MY_ASSERT(__func__,ret == 0, "capture resolution test fail"); - dts_pass(__func__, "PASS"); -} - diff --git a/TC/tet_scen b/TC/tet_scen deleted file mode 100755 index 03f029a..0000000 --- a/TC/tet_scen +++ /dev/null @@ -1,7 +0,0 @@ -all - ^TEST -##### Scenarios for TEST ##### - -# Test scenario -TEST - :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg deleted file mode 100644 index f7eda55..0000000 --- a/TC/tetbuild.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option for build operation checking -TET_BUILD_TOOL=make # build with using make command -TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build -TET_API_COMPLIANT=True # use TET API in Test Case ? -TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg deleted file mode 100644 index 02d7030..0000000 --- a/TC/tetclean.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option -TET_CLEAN_TOOL= make clean # clean tool -TET_CLEAN_FILE= Makefile # file for clean -TET_API_COMPLIANT=True # TET API useage -TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg deleted file mode 100644 index ef3e452..0000000 --- a/TC/tetexec.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capturing execution or not -TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional -TET_EXEC_FILE= # ex) exectool : execution file/ Optional -TET_API_COMPLIANT=True # Test case or Tool usesTET API? -TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/doc/camera_doc.h b/doc/camera_doc.h new file mode 100644 index 0000000..3f47021 --- /dev/null +++ b/doc/camera_doc.h @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * 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. + */ + + +#ifndef __TIZEN_MEDIA_CAMERA_DOC_H__ +#define __TIZEN_MEDIA_CAMERA_DOC_H__ + + +/** + * @file camera_doc.h + * @brief This file contains high level documentation for the Camera API. + */ + +/** + * @ingroup CAPI_MEDIA_FRAMEWORK + * @defgroup CAPI_MEDIA_CAMERA_MODULE Camera + * @brief The @ref CAPI_MEDIA_CAMERA_MODULE API provides functions for camera preview, capture, and focusing. + * + * @section CAPI_MEDIA_CAMERA_MODULE_HEADER Required Header + * \#include <camera.h> + * + * @section CAPI_MEDIA_CAMERA_MODULE_OVERVIEW Overview + * The Camera API allows application developers to support using the camera. It includes functions that capture photos and support setting up + * notifications for state changes of capturing, previewing, focusing, information about resolution and binary data format, and functions for artistic + * picture manipulations like sepia, negative, sketch, and many more. + * + * The Camera API allows creation of components required in taking pictures including: + * - selecting proper exposure parameters + * - selecting a proper output format + * - displaying a photo preview + * - triggering the capture phase + * - controlling and displaying the camera state + * - getting supported formats and picture resolutions + * - getting a preview format and a resolution + * + * The Camera API also notifies you (by callback mechanism) when a significant picture parameter changes e.g. focus. + * + * @subsection CAPI_MEDIA_CAMERA_LIFE_CYCLE_STATE_DIAGRAM State Diagram + * @image html capi_media_camera_state_diagram.png + * + * @subsection CAPI_MEDIA_CAMERA_LIFE_CYCLE_STATE_TRANSITIONS State Transitions + * <div><table class="doxtable" > + * <tr> + * <th><b>FUNCTION</b></th> + * <th><b>PRE-STATE</b></th> + * <th><b>POST-STATE</b></th> + * <th><b>SYNC TYPE</b></th> + * </tr> + * <tr> + * <td> camera_create() </td> + * <td> NONE </td> + * <td> CREATED </td> + * <td> SYNC </td> + * </tr> + * <tr> + * <td> camera_destroy() </td> + * <td> CREATED </td> + * <td> NONE </td> + * <td> SYNC </td> + * </tr> + * <tr> + * <td> camera_start_preview() </td> + * <td> CREATED/CAPTURED </td> + * <td> PREVIEW </td> + * <td> SYNC </td> + * </tr> + * <tr> + * <td> camera_stop_preview() </td> + * <td> PREVIEW </td> + * <td> CREATED </td> + * <td> SYNC </td> + * </tr> + * <tr> + * <td> camera_start_capture() </td> + * <td> PREVIEW </td> + * <td> CAPTURING -> CAPTURED* </td> + * <td> SYNC </td> + * </tr> + * </table></div> + * + * (*) The transition from the CAPTURING state to the CAPTURED state will be processed automatically. \n + * + * @subsection CAPI_MEDIA_CAMERA_LIFE_CYCLE_CALLBACK_OPERATIONS Callback(Event) Operations + * The callback mechanism is used to notify the application about significant camera events. + * <div><table class="doxtable" > + * <tr> + * <th><b>REGISTER</b></th> + * <th><b>UNREGISTER</b></th> + * <th><b>CALLBACK</b></th> + * <th><b>DESCRIPTION</b></th> + * </tr> + * <tr> + * <td>camera_set_preview_cb()</td> + * <td>camera_unset_preview_cb()</td> + * <td>camera_preview_cb()</td> + * <td>This callback is used to display the preview (it delivers copies of previous frames) </td> + * </tr> + * <tr> + * <td>camera_set_state_changed_cb()</td> + * <td>camera_unset_state_changed_cb()</td> + * <td>camera_state_changed_cb()</td> + * <td>This callback is used to notify that the camera state has changed. Not executed in the recorder mode </td> + * </tr> + * <tr> + * <td>camera_set_focus_changed_cb()</td> + * <td>camera_unset_focus_changed_cb()</td> + * <td>camera_focus_changed_cb()</td> + * <td>This callback is used to notify that the camera has changed focus (and it is ready to shoot) </td> + * </tr> + * <tr> + * <td>camera_set_error_cb()</td> + * <td>camera_unset_error_cb()</td> + * <td>camera_error_cb()</td> + * <td>This callback is used to notify that an error has occurred</td> + * </tr> + *</table></div> + * + * @subsection CAPI_MEDIA_CAMERA_FOREACH_OPERATIONS Foreach Operations + * <div><table class="doxtable" > + * <tr> + * <th><b>FOREACH</b></th> + * <th><b>CALLBACK</b></th> + * <th><b>DESCRIPTION</b></th> + * </tr> + * <tr> + * <td>camera_foreach_supported_preview_resolution()</td> + * <td>camera_supported_preview_resolution_cb()</td> + * <td>Supported preview resolutions</td> + * </tr> + * <tr> + * <td>camera_foreach_supported_capture_resolution()</td> + * <td>camera_supported_capture_resolution_cb()</td> + * <td>Supported camera capture resolutions</td> + * </tr> + * <tr> + * <td>camera_foreach_supported_capture_format()</td> + * <td>camera_supported_capture_format_cb()</td> + * <td>Supported camera capture formats</td> + * </tr> + * <tr> + * <td>camera_foreach_supported_preview_format()</td> + * <td>camera_supported_preview_format_cb()</td> + * <td>Supported camera preview format</td> + * </tr> + *</table></div> + * + * @section CAPI_MEDIA_CAMERA_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/camera\n + * - http://tizen.org/feature/camera.back\n + * - http://tizen.org/feature/camera.back.flash\n + * - http://tizen.org/feature/camera.front\n + * - http://tizen.org/feature/camera.front.flash + * + * It is recommended to design feature related codes in your application for reliability.\n + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> + * + */ + + +/** + * @ingroup CAPI_MEDIA_CAMERA_MODULE + * @defgroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE Attributes + * @brief The @ref CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE API provides functions to fetch camera attributes. + * + * @section CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE_HEADER Required Header + * \#include <camera.h> + * + * @section CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE_OVERVIEW Overview + * The Camera Attributes API provides functions to get/set basic camera attributes. + * + * With the Camera Attributes API you are able to set and get camera attributes like: + * <ul> + * <li>Preview frame rate</li> + * <li>Supported FPS</li> + * <li>Image quality</li> + * <li>Zoom level</li> + * <li>Auto focus mode</li> + * <li>Supported auto focus mode</li> + * <li>Exposure mode</li> + * <li>Supported exposure mode</li> + * <li>Exposure value</li> + * <li>ISO level</li> + * <li>Supported ISO</li> + * <li>Brightness level</li> + * <li>Contrast level</li> + * <li>White balance mode</li> + * <li>Supported white balance</li> + * <li>Effect mode</li> + * <li>Supported effect mode</li> + * <li>Scene mode</li> + * <li>Supported scene mode</li> + * <li>On/off camera information</li> + * <li>Image description</li> + * <li>Orientation information</li> + * <li>Software tag</li> + * <li>GPS latitude data</li> + * <li>GPS longitude data</li> + * <li>GPS altitude data</li> + * <li>Flash mode</li> + * <li>Supported flash mode</li> + * </ul> + * + * @subsection CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE_FOREACH_OPERATIONS Foreach Operations + * <div><table class="doxtable" > + * <tr> + * <th><b>FOREACH</b></th> + * <th><b>CALLBACK</b></th> + * <th><b>DESCRIPTION</b></th> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_fps()</td> + * <td>camera_attr_supported_fps_cb()</td> + * <td>Supported FPS</td> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_af_mode()</td> + * <td>camera_attr_supported_af_mode_cb()</td> + * <td>Supported auto focus mode</td> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_exposure_mode()</td> + * <td>camera_attr_supported_exposure_mode_cb()</td> + * <td>Supported exposure mode</td> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_iso()</td> + * <td>camera_attr_supported_iso_cb()</td> + * <td>Supported ISO</td> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_whitebalance()</td> + * <td>camera_attr_supported_whitebalance_cb()</td> + * <td>Supported whitebalance</td> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_effect()</td> + * <td>camera_attr_supported_effect_cb()</td> + * <td>Supported effect mode</td> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_scene_mode()</td> + * <td>camera_attr_supported_scene_mode_cb()</td> + * <td>Supported scene mode</td> + * </tr> + * <tr> + * <td>camera_attr_foreach_supported_flash_mode()</td> + * <td>camera_attr_supported_flash_mode_cb()</td> + * <td>Supported flash mode</td> + * </tr> + *</table></div> + * + * @section CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/camera\n + * - http://tizen.org/feature/camera.back\n + * - http://tizen.org/feature/camera.back.flash\n + * - http://tizen.org/feature/camera.front\n + * - http://tizen.org/feature/camera.front.flash + * + * It is recommended to design feature related codes in your application for reliability.\n + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> + * + */ + +/** + * @ingroup CAPI_MEDIA_CAMERA_MODULE + * @defgroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE Capability + * @brief The @ref CAPI_MEDIA_CAMERA_CAPABILITY_MODULE API provides capability information of the camera. + * @section CAPI_MEDIA_CAMERA_CAPABILITY_MODULE_HEADER Required Header + * \#include <camera.h> + * + * @section CAPI_MEDIA_CAMERA_CAPABILITY_MODULE_OVERVIEW Overview + * The Camera Capability API provides functions to obtain capability information of the camera device. + * + * @section CAPI_MEDIA_CAMERA_CAPABILITY_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/camera\n + * - http://tizen.org/feature/camera.back\n + * - http://tizen.org/feature/camera.back.flash\n + * - http://tizen.org/feature/camera.front\n + * - http://tizen.org/feature/camera.front.flash + * + * It is recommended to design feature related codes in your application for reliability.\n + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> + * + */ + +/** + * @ingroup CAPI_MEDIA_CAMERA_MODULE + * @defgroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE Display + * @brief The @ref CAPI_MEDIA_CAMERA_DISPLAY_MODULE API provides functions to control display. + * @section CAPI_MEDIA_CAMERA_DISPLAY_MODULE_HEADER Required Header + * \#include <camera.h> + * + * @section CAPI_MEDIA_CAMERA_DISPLAY_MODULE_OVERVIEW Overview + * The Display API allows you to manage display for the camera. This API provides you with + * functions that set and get various display properties : + * <ul> + * <li>rotation</li> + * <li>display visibility</li> + * <li>display mode</li> + * </ul> + * + * @section CAPI_MEDIA_CAMERA_DISPLAY_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/camera\n + * - http://tizen.org/feature/camera.back\n + * - http://tizen.org/feature/camera.back.flash\n + * - http://tizen.org/feature/camera.front\n + * - http://tizen.org/feature/camera.front.flash + * + * It is recommended to design feature related codes in your application for reliability.\n + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a> + * + */ + +#endif /* __TIZEN_MEDIA_CAMERA_DOC_H__ */ + + diff --git a/doc/images/capi_media_camera_state_diagram.png b/doc/images/capi_media_camera_state_diagram.png Binary files differnew file mode 100644 index 0000000..c6558ab --- /dev/null +++ b/doc/images/capi_media_camera_state_diagram.png diff --git a/include/camera.h b/include/camera.h index 0261436..8c730f1 100755..100644 --- a/include/camera.h +++ b/include/camera.h @@ -14,35 +14,32 @@ * limitations under the License. */ - - #ifndef __TIZEN_MULTIMEDIA_CAMERA_H__ #define __TIZEN_MULTIMEDIA_CAMERA_H__ #include <tizen.h> +#include <media_packet.h> #ifdef __cplusplus extern "C" { #endif - -#define CAMERA_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x00 - - /** * @file camera.h - * @brief This file contains the Camera API, related structures and enumerations + * @brief This file contains the Camera API, related structures and enumerations. + * @since_tizen 2.3 */ - /** * @addtogroup CAPI_MEDIA_CAMERA_MODULE * @{ */ +#define CAMERA_ERROR_CLASS TIZEN_ERROR_CAMERA | 0x00 /** - * @brief Enumerations of the error code for Camera. + * @brief Enumeration for the error codes of Camera. + * @since_tizen 2.3 */ typedef enum { @@ -54,28 +51,31 @@ typedef enum CAMERA_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Internal error */ CAMERA_ERROR_SOUND_POLICY = CAMERA_ERROR_CLASS | 0x06, /**< Blocked by Audio Session Manager */ CAMERA_ERROR_SECURITY_RESTRICTED = CAMERA_ERROR_CLASS | 0x07, /**< Restricted by security system policy */ - CAMERA_ERROR_DEVICE_BUSY = CAMERA_ERROR_CLASS | 0x08, /**< The device is using in other applications or working some operation */ + CAMERA_ERROR_DEVICE_BUSY = CAMERA_ERROR_CLASS | 0x08, /**< The device is using another application or working on some operation */ CAMERA_ERROR_DEVICE_NOT_FOUND = CAMERA_ERROR_CLASS | 0x09, /**< No camera device */ CAMERA_ERROR_SOUND_POLICY_BY_CALL = CAMERA_ERROR_CLASS | 0x0a, /**< Blocked by Audio Session Manager - CALL */ CAMERA_ERROR_SOUND_POLICY_BY_ALARM = CAMERA_ERROR_CLASS | 0x0b, /**< Blocked by Audio Session Manager - ALARM */ + CAMERA_ERROR_ESD = CAMERA_ERROR_CLASS | 0x0c, /**< ESD situation */ + CAMERA_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< The access to the resources can not be granted*/ + CAMERA_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */ } camera_error_e; - /** - * @brief Enumerations of the camera state. + * @brief Enumeration for the camera state. + * @since_tizen 2.3 */ typedef enum { - CAMERA_STATE_NONE, /**< Before create */ + CAMERA_STATE_NONE, /**< Before creating */ CAMERA_STATE_CREATED, /**< Created, but not initialized yet */ CAMERA_STATE_PREVIEW, /**< Preview */ CAMERA_STATE_CAPTURING, /**< While capturing */ CAMERA_STATE_CAPTURED /**< After capturing */ } camera_state_e; - /** - * @brief Enumerations of the camera device. + * @brief Enumeration for the camera device. + * @since_tizen 2.3 */ typedef enum { @@ -83,13 +83,13 @@ typedef enum CAMERA_DEVICE_CAMERA1 /**< Secondary camera */ } camera_device_e; - /** - * @brief Enumerations of the camera pixel format. + * @brief Enumeration for the camera pixel format. + * @since_tizen 2.3 */ typedef enum { - CAMERA_PIXEL_FORMAT_INVALID = -1, /**< Invalid pixel format */ + CAMERA_PIXEL_FORMAT_INVALID = -1, /**< Invalid pixel format */ CAMERA_PIXEL_FORMAT_NV12, /**< NV12 pixel format */ CAMERA_PIXEL_FORMAT_NV12T, /**< NV12 Tiled pixel format */ CAMERA_PIXEL_FORMAT_NV16, /**< NV16 pixel format */ @@ -106,53 +106,33 @@ typedef enum CAMERA_PIXEL_FORMAT_JPEG, /**< Encoded pixel format */ } camera_pixel_format_e; - /** - * @brief Enumerations of the camera display type. + * @brief Enumeration for the camera display type. + * @since_tizen 2.3 */ typedef enum { - CAMERA_DISPLAY_TYPE_X11 = 0, /**< X surface display */ - CAMERA_DISPLAY_TYPE_EVAS = 1, /**< Evas object surface display */ - CAMERA_DISPLAY_TYPE_NONE = 3 /**< This disposes of buffers */ + CAMERA_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */ + CAMERA_DISPLAY_TYPE_EVAS, /**< Evas object surface display */ + CAMERA_DISPLAY_TYPE_NONE /**< This disposes off buffers */ } camera_display_type_e; - -/** - * @brief The handle to the camera. - * @see recorder_create_videorecorder() - */ -typedef struct camera_s *camera_h; - - -/** - * @brief The handle to the camera display. - */ -typedef void *camera_display_h; - - -#ifndef GET_DISPLAY - -/** - * @brief Gets a display handle from x window id or evas object - */ -#define GET_DISPLAY(x) (void*)(x) - -#endif - -/** - * @} - */ - - /** - * @addtogroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE - * @{ + * @brief Enumeration for the camera policy. + * @since_tizen 2.3 */ - +typedef enum +{ + CAMERA_POLICY_NONE = 0, /**< None */ + CAMERA_POLICY_SOUND, /**< Sound policy */ + CAMERA_POLICY_SOUND_BY_CALL, /**< Sound policy by CALL */ + CAMERA_POLICY_SOUND_BY_ALARM, /**< Sound policy by ALARM */ + CAMERA_POLICY_SECURITY /**< Security policy */ +} camera_policy_e; /** - * @brief Enumerations of the camera rotation type. + * @brief Enumeration for the camera rotation type. + * @since_tizen 2.3 */ typedef enum { @@ -164,155 +144,188 @@ typedef enum /** - * @brief Enumerations of the camera flip type. + * @brief Enumeration for the camera flip type. + * @since_tizen 2.3 */ typedef enum { - CAMERA_FLIP_NONE, /**< No Flip */ - CAMERA_FLIP_HORIZONTAL, /**< Horizontal flip */ - CAMERA_FLIP_VERTICAL, /**< Vertical flip */ + 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; +} camera_flip_e; /** - * @brief Enumerations of the camera display mode. + * @brief Enumeration for the camera focus state. + * @since_tizen 2.3 */ typedef enum { - CAMERA_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box*/ - CAMERA_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size*/ - CAMERA_DISPLAY_MODE_FULL, /**< full screen*/ - CAMERA_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full screen*/ -} camera_display_mode_e; - -/** - * @brief Enumerations of the camera policy. - */ -typedef enum -{ - CAMERA_POLICY_NONE = 0, /**< None */ - CAMERA_POLICY_SOUND, /**< Sound policy */ - CAMERA_POLICY_SOUND_BY_CALL, /**< Sound policy by CALL */ - CAMERA_POLICY_SOUND_BY_ALARM, /**< Sound policy by ALARM */ - CAMERA_POLICY_SECURITY /**< Security policy */ -} camera_policy_e; - + CAMERA_FOCUS_STATE_RELEASED = 0, /**< Focus released */ + CAMERA_FOCUS_STATE_ONGOING, /**< Focus in progress */ + CAMERA_FOCUS_STATE_FOCUSED, /**< Focus succeeded */ + CAMERA_FOCUS_STATE_FAILED, /**< Focus failed */ +} camera_focus_state_e; /** - * @brief Struct of the image data + * @brief The structure type of the image data. + * @since_tizen 2.3 */ typedef struct { - unsigned char *data; /**< The image buffer */ - unsigned int size; /**< The size of buffer */ - int width; /**< The width of image */ - int height; /**< The height of image */ - camera_pixel_format_e format; /**< The format of image pixel */ - unsigned char *exif; /**< The exif raw data */ - unsigned int exif_size; /**< The size of exif data */ -}camera_image_data_s; - + unsigned char *data; /**< The image buffer */ + unsigned int size; /**< The size of the buffer */ + int width; /**< The width of the image */ + int height; /**< The height of the image */ + camera_pixel_format_e format; /**< The format of the image pixel */ + unsigned char *exif; /**< The exif raw data */ + unsigned int exif_size; /**< The size of the exif data */ +} camera_image_data_s; /** - * @brief Struct of the face detection + * @brief The structure type for face detection. + * @since_tizen 2.3 */ typedef struct { - int id; /**< The id of each face */ - int score; /**< The confidence level for the detection of the face */ - int x; /**< The x coordinates of face */ - int y; /**< The y coordinates of face */ - int width; /**< The width of face */ - int height; /**< The height of face */ -}camera_detected_face_s; - + int id; /**< The ID of each face */ + int score; /**< The confidence level for the detection of the face */ + int x; /**< The x coordinates of the face */ + int y; /**< The y coordinates of the face */ + int width; /**< The width of the face */ + int height; /**< The height of the face */ +} camera_detected_face_s; /** - * @brief Struct of the preview stream data + * @brief The structure type to preview stream data. + * @since_tizen 2.3 */ typedef struct { - camera_pixel_format_e format; /**< The format of frame pixel */ - int width; /**< The width of frame */ - int height; /**< The height of frame */ - int num_of_planes; /**< The number of planes */ - unsigned int timestamp; /**< The timestamp of frame */ + camera_pixel_format_e format; /**< The format of the frame pixel */ + int width; /**< The width of the frame */ + int height; /**< The height of the frame */ + int num_of_planes; /**< The number of planes */ + unsigned int timestamp; /**< The timestamp of the frame */ union { struct { - unsigned char *yuv; /**< The yuv data pointer*/ - unsigned int size; /**< The size of data*/ - } single_plane; /**< single plane frame data */ + unsigned char *yuv; /**< The yuv data pointer */ + unsigned int size; /**< The size of data */ + } single_plane; /**< single plane frame data */ struct { - unsigned char *y; /**< The y data pointer*/ - unsigned char *uv; /**< The uv data pointer*/ - unsigned int y_size; /**< The size of y data*/ - unsigned int uv_size; /**< The size of uv data*/ - } double_plane; /**< double plane frame data */ + unsigned char *y; /**< The y data pointer */ + unsigned char *uv; /**< The uv data pointer */ + unsigned int y_size; /**< The size of y data */ + unsigned int uv_size; /**< The size of uv data */ + } double_plane; /**< double plane frame data */ struct { - unsigned char *y; /**< The y data pointer*/ - unsigned char *u; /**< The u data pointer*/ - unsigned char *v; /**< The v data pointer*/ - unsigned int y_size; /**< The size of y data*/ - unsigned int u_size; /**< The size of u data*/ - unsigned int v_size; /**< The size of v data*/ - } triple_plane; /**< triple plane frame data */ + unsigned char *y; /**< The y data pointer */ + unsigned char *u; /**< The u data pointer */ + unsigned char *v; /**< The v data pointer */ + unsigned int y_size; /**< The size of y data */ + unsigned int u_size; /**< The size of u data */ + unsigned int v_size; /**< The size of v data */ + } triple_plane; /**< triple plane frame data */ } data; -}camera_preview_data_s; +} camera_preview_data_s; +/** + * @brief The Camera handle. + * @since_tizen 2.3 + * @see recorder_create_videorecorder() + */ +typedef struct camera_s *camera_h; + +/** + * @brief The Camera display handle. + * @since_tizen 2.3 + */ +typedef void *camera_display_h; + +#ifndef GET_DISPLAY + +/** + * @brief Gets a display handle. + * @since_tizen 2.3 + */ +#define GET_DISPLAY(x) (void*)(x) + +#endif /** * @} */ +/** + * @addtogroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE + * @{ + */ + +/** + * @brief Enumeration for the camera display mode. + * @since_tizen 2.3 + */ +typedef enum +{ + CAMERA_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box */ + CAMERA_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size */ + CAMERA_DISPLAY_MODE_FULL, /**< Full screen */ + CAMERA_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full screen */ +} camera_display_mode_e; + +/** + * @} + */ /** * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE * @{ */ - /** - * @brief Enumerations of the color tone which provides an impression of looking through a tinted glass. + * @brief Enumeration for the color tone, which provides the impression of looking through a tinted glass. + * @since_tizen 2.3 */ typedef enum { - CAMERA_ATTR_EFFECT_NONE = 0, /**< None */ - CAMERA_ATTR_EFFECT_MONO, /**< Mono */ - CAMERA_ATTR_EFFECT_SEPIA, /**< Sepia */ - CAMERA_ATTR_EFFECT_NEGATIVE, /**< Negative */ - CAMERA_ATTR_EFFECT_BLUE, /**< Blue */ - CAMERA_ATTR_EFFECT_GREEN, /**< Green */ - CAMERA_ATTR_EFFECT_AQUA, /**< Aqua */ - CAMERA_ATTR_EFFECT_VIOLET, /**< Violet */ - CAMERA_ATTR_EFFECT_ORANGE, /**< Orange */ - CAMERA_ATTR_EFFECT_GRAY, /**< Gray */ - CAMERA_ATTR_EFFECT_RED, /**< Red */ - CAMERA_ATTR_EFFECT_ANTIQUE, /**< Antique */ - CAMERA_ATTR_EFFECT_WARM, /**< Warm */ - CAMERA_ATTR_EFFECT_PINK, /**< Pink */ - CAMERA_ATTR_EFFECT_YELLOW, /**< Yellow */ - CAMERA_ATTR_EFFECT_PURPLE, /**< Purple */ - CAMERA_ATTR_EFFECT_EMBOSS, /**< Emboss */ - CAMERA_ATTR_EFFECT_OUTLINE, /**< Outline */ - CAMERA_ATTR_EFFECT_SOLARIZATION, /**< Solarization */ - CAMERA_ATTR_EFFECT_SKETCH, /**< Sketch */ - CAMERA_ATTR_EFFECT_WASHED, /**< Washed */ - CAMERA_ATTR_EFFECT_VINTAGE_WARM, /**< Vintage warm */ - CAMERA_ATTR_EFFECT_VINTAGE_COLD, /**< Vintage cold */ - CAMERA_ATTR_EFFECT_POSTERIZATION, /**< Posterization */ - CAMERA_ATTR_EFFECT_CARTOON, /**< Cartoon */ - CAMERA_ATTR_EFFECT_SELECTIVE_RED, /**< Selective color - Red */ - CAMERA_ATTR_EFFECT_SELECTIVE_GREEN, /**< Selective color - Green */ - CAMERA_ATTR_EFFECT_SELECTIVE_BLUE, /**< Selective color - Blue */ - CAMERA_ATTR_EFFECT_SELECTIVE_YELLOW, /**< Selective color - Yellow */ - CAMERA_ATTR_EFFECT_SELECTIVE_RED_YELLOW, /**< Selective color - Red and Yellow */ + CAMERA_ATTR_EFFECT_NONE = 0, /**< None */ + CAMERA_ATTR_EFFECT_MONO, /**< Mono */ + CAMERA_ATTR_EFFECT_SEPIA, /**< Sepia */ + CAMERA_ATTR_EFFECT_NEGATIVE, /**< Negative */ + CAMERA_ATTR_EFFECT_BLUE, /**< Blue */ + CAMERA_ATTR_EFFECT_GREEN, /**< Green */ + CAMERA_ATTR_EFFECT_AQUA, /**< Aqua */ + CAMERA_ATTR_EFFECT_VIOLET, /**< Violet */ + CAMERA_ATTR_EFFECT_ORANGE, /**< Orange */ + CAMERA_ATTR_EFFECT_GRAY, /**< Gray */ + CAMERA_ATTR_EFFECT_RED, /**< Red */ + CAMERA_ATTR_EFFECT_ANTIQUE, /**< Antique */ + CAMERA_ATTR_EFFECT_WARM, /**< Warm */ + CAMERA_ATTR_EFFECT_PINK, /**< Pink */ + CAMERA_ATTR_EFFECT_YELLOW, /**< Yellow */ + CAMERA_ATTR_EFFECT_PURPLE, /**< Purple */ + CAMERA_ATTR_EFFECT_EMBOSS, /**< Emboss */ + CAMERA_ATTR_EFFECT_OUTLINE, /**< Outline */ + CAMERA_ATTR_EFFECT_SOLARIZATION, /**< Solarization */ + CAMERA_ATTR_EFFECT_SKETCH, /**< Sketch */ + CAMERA_ATTR_EFFECT_WASHED, /**< Washed */ + CAMERA_ATTR_EFFECT_VINTAGE_WARM, /**< Vintage warm */ + CAMERA_ATTR_EFFECT_VINTAGE_COLD, /**< Vintage cold */ + CAMERA_ATTR_EFFECT_POSTERIZATION, /**< Posterization */ + CAMERA_ATTR_EFFECT_CARTOON, /**< Cartoon */ + CAMERA_ATTR_EFFECT_SELECTIVE_RED, /**< Selective color - Red */ + CAMERA_ATTR_EFFECT_SELECTIVE_GREEN, /**< Selective color - Green */ + CAMERA_ATTR_EFFECT_SELECTIVE_BLUE, /**< Selective color - Blue */ + CAMERA_ATTR_EFFECT_SELECTIVE_YELLOW, /**< Selective color - Yellow */ + CAMERA_ATTR_EFFECT_SELECTIVE_RED_YELLOW, /**< Selective color - Red and Yellow */ + CAMERA_ATTR_EFFECT_OTHER_GRAPHICS, /**< Other Graphic effects */ } camera_attr_effect_mode_e; - /** - * @brief Enumerations of the white balance levels of the camera. + * @brief Enumeration for the white balance levels of the camera. + * @since_tizen 2.3 */ typedef enum { @@ -328,10 +341,10 @@ typedef enum CAMERA_ATTR_WHITE_BALANCE_CUSTOM, /**< Custom */ } camera_attr_whitebalance_e; - /** - * @brief Enumerations of the scene mode. - * The mode of operation can be in daylight, night and back-light. + * @brief Enumeration for the scene mode. + * @details The mode of operation can be in daylight, night, or back-light. + * @since_tizen 2.3 */ typedef enum { @@ -350,126 +363,120 @@ typedef enum CAMERA_ATTR_SCENE_MODE_SHOW_WINDOW, /**< Show window */ CAMERA_ATTR_SCENE_MODE_CANDLE_LIGHT, /**< Candle light */ CAMERA_ATTR_SCENE_MODE_BACKLIGHT, /**< Backlight */ + CAMERA_ATTR_SCENE_MODE_AQUA, /**< Aqua */ } camera_attr_scene_mode_e; - /** - * @brief Enumerations of the auto focus mode. + * @brief Enumeration for the auto focus mode. + * @since_tizen 2.3 */ typedef enum { CAMERA_ATTR_AF_NONE = 0, /**< auto-focus is not set */ - CAMERA_ATTR_AF_NORMAL, /**< auto-focus normally */ - CAMERA_ATTR_AF_MACRO, /**< auto-focus in macro mode(close distance) */ - CAMERA_ATTR_AF_FULL, /**< auto-focus in full mode(all range scan, limited by dev spec) */ + CAMERA_ATTR_AF_NORMAL, /**< auto-focus in the normal mode */ + CAMERA_ATTR_AF_MACRO, /**< auto-focus in the macro mode(close distance) */ + CAMERA_ATTR_AF_FULL, /**< auto-focus in the full mode(all range scan, limited by device spec) */ } camera_attr_af_mode_e; - -/** - * @brief Enumerations of the camera focus state. - */ -typedef enum -{ - CAMERA_FOCUS_STATE_RELEASED = 0, /**< Focus released.*/ - CAMERA_FOCUS_STATE_ONGOING, /**< Focus in progress*/ - CAMERA_FOCUS_STATE_FOCUSED, /**< Focus success*/ - CAMERA_FOCUS_STATE_FAILED, /**< Focus failed*/ -} camera_focus_state_e; - - /** - * @brief Enumerations for the ISO levels of the camera. + * @brief Enumeration for the ISO levels of the camera. + * @since_tizen 2.3 */ typedef enum { - CAMERA_ATTR_ISO_AUTO = 0, /**< ISO auto mode*/ - CAMERA_ATTR_ISO_50, /**< ISO 50*/ - CAMERA_ATTR_ISO_100, /**< ISO 100*/ - CAMERA_ATTR_ISO_200, /**< ISO 200*/ - CAMERA_ATTR_ISO_400, /**< ISO 400*/ - CAMERA_ATTR_ISO_800, /**< ISO 800*/ - CAMERA_ATTR_ISO_1600, /**< ISO 1600*/ - CAMERA_ATTR_ISO_3200, /**< ISO 3200*/ + CAMERA_ATTR_ISO_AUTO = 0, /**< ISO auto mode */ + CAMERA_ATTR_ISO_50, /**< ISO 50 */ + CAMERA_ATTR_ISO_100, /**< ISO 100 */ + CAMERA_ATTR_ISO_200, /**< ISO 200 */ + CAMERA_ATTR_ISO_400, /**< ISO 400 */ + CAMERA_ATTR_ISO_800, /**< ISO 800 */ + CAMERA_ATTR_ISO_1600, /**< ISO 1600 */ + CAMERA_ATTR_ISO_3200, /**< ISO 3200 */ } camera_attr_iso_e; - /** - * @brief Enumerations of the camera exposure modes. + * @brief Enumeration for the camera exposure modes. + * @since_tizen 2.3 */ typedef enum { - CAMERA_ATTR_EXPOSURE_MODE_OFF = 0, /**< Off*/ - CAMERA_ATTR_EXPOSURE_MODE_ALL, /**< All mode*/ - CAMERA_ATTR_EXPOSURE_MODE_CENTER, /**< Center mode*/ - CAMERA_ATTR_EXPOSURE_MODE_SPOT, /**< Spot mode*/ - CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /**< Custom mode*/ + CAMERA_ATTR_EXPOSURE_MODE_OFF = 0, /**< Off */ + CAMERA_ATTR_EXPOSURE_MODE_ALL, /**< All mode */ + CAMERA_ATTR_EXPOSURE_MODE_CENTER, /**< Center mode */ + CAMERA_ATTR_EXPOSURE_MODE_SPOT, /**< Spot mode */ + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /**< Custom mode */ } camera_attr_exposure_mode_e; - /** - * @brief Enumerations for the orientation values of tag. + * @brief Enumeration for the orientation values of tag. + * @since_tizen 2.3 */ typedef enum { - CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT = 1, /**< Row #0 is top, Column #0 is left */ - CAMERA_ATTR_TAG_ORIENTATION_TOP_RIGHT = 2, /**< Row #0 is top, Column #0 is right (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_RIGHT = 3, /**< Row #0 is bottom, Column #0 is right */ - CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_LEFT = 4, /**< Row #0 is bottom, Column #0 is left (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_LEFT_TOP = 5, /**< Row #0 is left, Column #0 is top (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_RIGHT_TOP = 6, /**< Row #0 is right, Column #0 is top */ - CAMERA_ATTR_TAG_ORIENTATION_RIGHT_BOTTOM = 7, /**< Row #0 is right, Column #0 is bottom (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM = 8, /**< Row #0 is left, Column #0 is bottom */ + CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT = 1, /**< Row #0 is at the top, Column #0 is to the left */ + CAMERA_ATTR_TAG_ORIENTATION_TOP_RIGHT = 2, /**< Row #0 is at the top, Column #0 is to the right (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_RIGHT = 3, /**< Row #0 is at the bottom, Column #0 is to the right */ + CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_LEFT = 4, /**< Row #0 is at the bottom, Column #0 is to the left (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_LEFT_TOP = 5, /**< Row #0 is to the left, Column #0 is at the top (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_RIGHT_TOP = 6, /**< Row #0 is to the right, Column #0 is at the top */ + CAMERA_ATTR_TAG_ORIENTATION_RIGHT_BOTTOM = 7, /**< Row #0 is to the right, Column #0 is at the bottom (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM = 8, /**< Row #0 is to the left, Column #0 is at the bottom */ } camera_attr_tag_orientation_e; - /** - * @brief Enumerations of the flash mode. + * @brief Enumeration for the flash mode. + * @since_tizen 2.3 */ typedef enum { CAMERA_ATTR_FLASH_MODE_OFF = 0, /**< Always off */ CAMERA_ATTR_FLASH_MODE_ON, /**< Always splashes */ - CAMERA_ATTR_FLASH_MODE_AUTO, /**< Depending on intensity of light, strobe starts to flash. */ - CAMERA_ATTR_FLASH_MODE_REDEYE_REDUCTION, /**< Red eye reduction. Multiple flash before capturing. */ - CAMERA_ATTR_FLASH_MODE_SLOW_SYNC, /**< Slow sync curtain synchronization*/ - CAMERA_ATTR_FLASH_MODE_FRONT_CURTAIN, /**< Front curtain synchronization. */ - CAMERA_ATTR_FLASH_MODE_REAR_CURTAIN, /**< Rear curtain synchronization. */ - CAMERA_ATTR_FLASH_MODE_PERMANENT, /**< keep turned on until turning off */ + CAMERA_ATTR_FLASH_MODE_AUTO, /**< Depending on intensity of light, strobe starts to flash */ + CAMERA_ATTR_FLASH_MODE_REDEYE_REDUCTION, /**< Red eye reduction. Multiple flash before capturing */ + CAMERA_ATTR_FLASH_MODE_SLOW_SYNC, /**< Slow sync curtain synchronization */ + CAMERA_ATTR_FLASH_MODE_FRONT_CURTAIN, /**< Front curtain synchronization */ + CAMERA_ATTR_FLASH_MODE_REAR_CURTAIN, /**< Rear curtain synchronization */ + CAMERA_ATTR_FLASH_MODE_PERMANENT, /**< Keep turned on until turning off */ } camera_attr_flash_mode_e; - /** - * @brief Enumerations of the preview fps. + * @brief Enumeration to preview FPS. + * @since_tizen 2.3 */ typedef enum { CAMERA_ATTR_FPS_AUTO = 0, /**< AUTO FPS */ + CAMERA_ATTR_FPS_7 = 7, /**< 7 FPS */ CAMERA_ATTR_FPS_8 = 8, /**< 8 FPS */ CAMERA_ATTR_FPS_15 = 15, /**< 15 FPS */ + CAMERA_ATTR_FPS_20 = 20, /**< 20 FPS */ CAMERA_ATTR_FPS_24 = 24, /**< 24 FPS */ CAMERA_ATTR_FPS_25 = 25, /**< 25 FPS */ CAMERA_ATTR_FPS_30 = 30, /**< 30 FPS */ CAMERA_ATTR_FPS_60 = 60, /**< 60 FPS */ + CAMERA_ATTR_FPS_90 = 90, /**< 90 FPS */ CAMERA_ATTR_FPS_120 = 120 /**< 120 FPS */ } camera_attr_fps_e; /** - * @brief Enumerations of the theater mode + * @brief Enumeration for the theater mode. + * @since_tizen 2.3 */ typedef enum { - CAMERA_ATTR_THEATER_MODE_DISABLE = 0, /**< Disable theater mode - External display show same image with device display. */ - CAMERA_ATTR_THEATER_MODE_ENABLE = 2, /**< Enable theater mode - Preview image is displayed on external display with full screen mode. But preview image is not shown on device display. */ - CAMERA_ATTR_THEATER_MODE_CLONE = 1 /**< Clone mode - Preview image is displayed on external display with full screen mode. Also preview image is shown with UI on device display*/ + CAMERA_ATTR_THEATER_MODE_DISABLE = 0, /**< Disable theater mode - External display shows same image as device display */ + CAMERA_ATTR_THEATER_MODE_ENABLE = 2, /**< Enable theater mode - Preview image is displayed on external display with full screen mode, but preview image is not shown on device display */ + CAMERA_ATTR_THEATER_MODE_CLONE = 1 /**< Clone mode - Preview image is displayed on external display with full screen mode. Also preview image is shown by the UI on device display */ } camera_attr_theater_mode_e; /** - * @brief Enumerations of HDR capture mode + * @brief Enumeration for HDR capture mode. + * @since_tizen 2.3 */ typedef enum { - CAMERA_ATTR_HDR_MODE_DISABLE = 0, /**< Disable HDR capture */ - CAMERA_ATTR_HDR_MODE_ENABLE, /**< Enable HDR capture */ + CAMERA_ATTR_HDR_MODE_DISABLE = 0, /**< Disable HDR capture */ + CAMERA_ATTR_HDR_MODE_ENABLE, /**< Enable HDR capture */ CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL /**< Enable HDR capture and keep original image data */ } camera_attr_hdr_mode_e; @@ -483,45 +490,45 @@ typedef enum * @{ */ - /** - * @brief Called when the camera state changes. + * @brief Called when the camera state is changed. + * @since_tizen 2.3 * - * @param[in] previous The previous state of the camera - * @param[in] current The current state of the camera - * @param[in] by_policy @c true if the state is changed by policy, otherwise @c false - * @param[in] user_data The user data passed from the callback registration function + * @param[in] previous The previous state of the camera + * @param[in] current The current state of the camera + * @param[in] by_policy If @c true the state is changed by policy, otherwise @c false + * @param[in] user_data The user data passed from the callback registration function * @pre camera_start_preview(), camera_start_capture() or camera_stop_preview() - * will invoke this callback if you registers this callback unsing camera_set_state_changed_cb(). + * will invoke this callback if you register this callback using camera_set_state_changed_cb(). * @see camera_set_state_changed_cb() */ typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data); /** - * @brief Called when the camera interrupted by policy + * @brief Called when the camera is interrupted by policy. + * @since_tizen 2.3 * - * @param[in] policy The policy that interrupting the camera - * @param[in] previous The previous state of the camera - * @param[in] current The current state of the camera - * @param[in] user_data The user data passed from the callback registration function + * @param[in] policy The policy that interrupted the camera + * @param[in] previous The previous state of the camera + * @param[in] current The current state of the camera + * @param[in] user_data The user data passed from the callback registration function * @see camera_set_interrupted_cb() */ typedef void (*camera_interrupted_cb)(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data); - - /** - * @brief Called when the camera focus state changes. + * @brief Called when the camera focus state is changed. * @details When the camera auto focus completes or a change to the focus state occurs, - * this callback is invoked. \n \n - * Changes of focus state are as follows: \n - * #CAMERA_FOCUS_STATE_RELEASED -> start focusing -> #CAMERA_FOCUS_STATE_ONGOING -> working -> - * #CAMERA_FOCUS_STATE_FOCUSED or #CAMERA_FOCUS_STATE_FAILED + * this callback is invoked. \n \n + * Changes of focus state are as follows: \n + * #CAMERA_FOCUS_STATE_RELEASED -> start focusing -> #CAMERA_FOCUS_STATE_ONGOING -> working -> + * #CAMERA_FOCUS_STATE_FOCUSED or #CAMERA_FOCUS_STATE_FAILED. + * @since_tizen 2.3 * - * @param[in] state The current state of the auto-focus - * @param[in] user_data The user data passed from the callback registration function - * @pre camera_start_focusing() will invoke this callback if you register it using camera_set_focus_changed_cb (). + * @param[in] state The current state of the auto-focus + * @param[in] user_data The user data passed from the callback registration function + * @pre camera_start_focusing() will invoke this callback if you register it using camera_set_focus_changed_cb(). * @see camera_set_focus_changed_cb() * @see camera_unset_focus_changed_cb() * @see camera_start_focusing() @@ -529,15 +536,15 @@ typedef void (*camera_interrupted_cb)(camera_policy_e policy, camera_state_e pre */ typedef void (*camera_focus_changed_cb)(camera_focus_state_e state, void *user_data); - /** - * @brief Called to be notified for delivering copy of new preview frame when every preview frame is displayed. + * @brief Called to register for notifications about delivering a copy of the new preview frame when every preview frame is displayed. + * @since_tizen 2.3 * - * @remarks This function is issued in the context of gstreamer (video sink thread) so you should not directly invoke UI update code.\n - * When camera is used as a recorder then this callback function won't be called. + * @remarks This function is issued in the context of gstreamer so the UI update code should not be directly invoked.\n + * If the camera is used as a recorder then this callback function won't be called. * - * @param[in] frame Reference pointer to preview stream data - * @param[in] user_data The user data passed from the callback registration function + * @param[in] frame The reference pointer to preview stream data + * @param[in] user_data The user data passed from the callback registration function * @pre camera_start_preview() will invoke this callback function if you register this callback using camera_set_preview_cb(). * @see camera_start_preview() * @see camera_set_preview_cb() @@ -546,68 +553,81 @@ typedef void (*camera_focus_changed_cb)(camera_focus_state_e state, void *user_d typedef void (*camera_preview_cb)(camera_preview_data_s *frame, void *user_data); /** - * @brief Called to get information about image data taken by the camera once per frame while capturing. + * @brief Called to register for notifications about delivering media packet when every preview frame is displayed. + * @since_tizen 2.3 + * + * @remarks This function is issued in the context of gstreamer so the UI update code should not be directly invoked.\n + * If the camera is used as a recorder then this callback function won't be called.\n + * and the packet should be released by media_packet_destroy() after use. + * + * @param[in] pkt Reference pointer to media packet + * @param[in] user_data The user data passed from the callback registration function + * @pre camera_start_preview() will invoke this callback function if you register this callback using camera_set_media_packet_preview_cb(). + * @see camera_start_preview() + * @see camera_set_media_packet_preview_cb() + * @see camera_unset_media_packet_preview_cb() + */ +typedef void (*camera_media_packet_preview_cb)(media_packet_h pkt, void *user_data); + +/** + * @brief Called to get information about image data taken by the camera once per frame while capturing. + * @since_tizen 2.3 * - * @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_start_preview() within this callback. + * @remarks This function is issued in the context of gstreamer (video source thread) so the UI update code should not be directly invoked. + * You must not call camera_start_preview() within this callback. * - * @param[in] image The image data of captured picture - * @param[in] postview The image data of postvew - * @param[in] thumbnail The image data of thumbnail ( It could be NULL, if available thumbnail data is not existed. ) - * @param[in] user_data The user data passed from the callback registration function - * @pre camera_start_capture() or camera_start_continuous_capture() will invoke this callback function if you register this callback using camera_start_capture() or camera_start_continuous_capture() + * @param[in] image The image data of the captured picture + * @param[in] postview The image data of the postview + * @param[in] thumbnail The image data of the thumbnail (it should be @c NULL if the available thumbnail data does not exist) + * @param[in] user_data The user data passed from the callback registration function + * @pre camera_start_capture() or camera_start_continuous_capture() will invoke this callback function if it is registered using camera_start_capture() or camera_start_continuous_capture(). * @see camera_start_capture() * @see camera_start_continuous_capture() * @see camera_capture_completed_cb() */ typedef void (*camera_capturing_cb)(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data); - - /** - * @brief Called when the camera capturing completes. - * - * @remarks The callback is called after end of camera_capturing_cb().\n - * If you want to show the user preview after finishing capturing, an application can use camera_start_preview() after calling this callback. + * @brief Called when the camera capturing completes. + * @since_tizen 2.3 * - * @param[in] user_data The user data passed from the callback registration function + * @remarks The callback is called after camera_capturing_cb() is completed.\n + * If you want to show the user a preview after capturing is finished, an application can use camera_start_preview() after calling this callback. * - * @pre This callback function is invoked if you register this callback using camera_start_capture() or camera_start_continuous_capture(). + * @param[in] user_data The user data passed from the callback registration function + * @pre This callback function is invoked if it is registered using camera_start_capture() or camera_start_continuous_capture(). * @see camera_start_capture() * @see camera_start_continuous_capture() * @see camera_capturing_cb() */ typedef void (*camera_capture_completed_cb)(void *user_data); - /** - * @brief Called when the error occurred. - * - * @remarks - * This callback inform critical error situation.\n - * When invoked this callback, user should release the resource and terminate application.\n - * These error code will be occurred\n - * #CAMERA_ERROR_DEVICE\n - * #CAMERA_ERROR_INVALID_OPERATION\n - * #CAMERA_ERROR_OUT_OF_MEMORY\n + * @brief Called when an error occurs. + * @since_tizen 2.3 * - * @param[in] error The error code - * @param[in] current_state The current state of the camera - * @param[in] user_data The user data passed from the callback registration function + * @remarks This callback informs about a critical error situation.\n + * When this callback is invoked, the user should release the resource and terminate the application.\n + * In case of errors, one of these codes occur:\n + * #CAMERA_ERROR_DEVICE,\n + * #CAMERA_ERROR_INVALID_OPERATION,\n + * #CAMERA_ERROR_OUT_OF_MEMORY.\n * - * @pre This callback function is invoked if you register this callback using camera_set_error_cb(). + * @param[in] error The error code + * @param[in] current_state The current state of the camera + * @param[in] user_data The user data passed from the callback registration function + * @pre This callback function is invoked if it is registered using camera_set_error_cb(). * @see camera_set_error_cb() * @see camera_unset_error_cb() */ typedef void (*camera_error_cb)(camera_error_e error, camera_state_e current_state, void *user_data); /** - * @brief Called when face detected in the preview frame - * + * @brief Called when a face is detected in the preview frame. + * @since_tizen 2.3 * @param[in] faces The detected face array - * @param[in] count The length of array + * @param[in] count The length of the array * @param[in] user_data The user data passed from the callback registration function - * * @see camera_start_face_detection() */ typedef void (*camera_face_detected_cb)(camera_detected_face_s *faces, int count, void *user_data); @@ -622,56 +642,48 @@ typedef void (*camera_face_detected_cb)(camera_detected_face_s *faces, int count */ /** - * @brief Called once for each supported preview resolution. - * - * @param[in] width The preview image width - * @param[in] height The preview image height - * @param[in] user_data The user data passed from the foreach function - * - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_foreach_supported_preview_resolution() will invoke this callback. - * + * @brief Called once for each supported preview resolution. + * @since_tizen 2.3 + * @param[in] width The preview image width + * @param[in] height The preview image height + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_foreach_supported_preview_resolution() will invoke this callback. * @see camera_foreach_supported_preview_resolution() */ typedef bool (*camera_supported_preview_resolution_cb)(int width, int height, void *user_data); - /** - * @brief Called once for each supported capture resolution. - * - * @param[in] width The capture resolution width - * @param[in] height The capture resolution height - * @param[in] user_data The user data passed from the foreach function - * - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_foreach_supported_capture_resolution() will invoke this callback. - * + * @brief Called once for each supported capture resolution. + * @since_tizen 2.3 + * @param[in] width The capture resolution width + * @param[in] height The capture resolution height + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_foreach_supported_capture_resolution() will invoke this callback. * @see camera_foreach_supported_capture_resolution() */ typedef bool (*camera_supported_capture_resolution_cb)(int width, int height, void *user_data); - /** - * @brief Called once for the pixel format of each supported capture format. - * - * @param[in] format The supported pixel format - * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_foreach_supported_capture_format() will invoke this callback. - * + * @brief Called once for the pixel format of each supported capture format. + * @since_tizen 2.3 + * @param[in] format The supported pixel format + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_foreach_supported_capture_format() will invoke this callback. * @see camera_foreach_supported_capture_format() */ typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, void *user_data); /** - * @brief Called once for the pixel format of each supported preview format. - * - * @param[in] format The supported preview data format - * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_foreach_supported_preview_format() will invoke this callback. - * + * @brief Called once for the pixel format of each supported preview format. + * @since_tizen 2.3 + * @param[in] format The supported preview data format + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_foreach_supported_preview_format() will invoke this callback. * @see camera_foreach_supported_preview_format() */ typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, @@ -689,20 +701,24 @@ typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, /** * @brief Creates a new camera handle for controlling a camera. * - * @remarks You can create multiple handles on a context at the same time. However, - * camera cannot guarantee proper operation because of limitation of resources, such as - * camera device, audio device, and display device.\n - * a @a camera must be released with camera_destroy() by you. - * - * @param[in] device The hardware camera to access - * @param[out] camera A newly returned handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory - * @retval #CAMERA_ERROR_SOUND_POLICY Sound policy error - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * @post If it succeeds the camera state will be #CAMERA_STATE_CREATED. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks Multiple handles on a context at the same time are allowed to be created. However, + * camera cannot guarantee proper operation because of limited resources, such as + * camera device, audio device, and display device.\n. + * A @a camera must be released using camera_destroy(). + * @param[in] device The hardware camera to access + * @param[out] camera A newly returned handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CAMERA_ERROR_SOUND_POLICY Sound policy error + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post If it succeeds, the camera state will be #CAMERA_STATE_CREATED. * * @see camera_destroy() */ @@ -711,13 +727,17 @@ int camera_create(camera_device_e device, camera_h *camera); /** * @brief Destroys the camera handle and releases all its resources. * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_create() */ int camera_destroy(camera_h camera); @@ -725,25 +745,31 @@ int camera_destroy(camera_h camera); /** * @brief Starts capturing and drawing preview frames on the screen. * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_SOUND_POLICY Sound policy error - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * @retval #CAMERA_ERROR_DEVICE_BUSY The device is using in other applications or working some operation - * @retval #CAMERA_ERROR_DEVICE_NOT_FOUND No camera device - * @pre The camera state should be #CAMERA_STATE_CREATED, or #CAMERA_STATE_CAPTURED.\n - * You must set display handle. \n - * If needed, modify preview fps(camera_attr_set_preview_fps()), - * preview resolution(camera_set_preview_resolution()) or preview format(camera_set_preview_format()) + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_SOUND_POLICY Sound policy error + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_DEVICE_BUSY The device is being used in another application or is performing other operations + * @retval #CAMERA_ERROR_DEVICE_NOT_FOUND No camera device + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_CAPTURED.\n + * You must set the display handle. \n + * If needed, modify preview FPS(camera_attr_set_preview_fps()), + * preview resolution(camera_set_preview_resolution()), or preview format(camera_set_preview_format()). * @post If it succeeds, the camera state will be #CAMERA_STATE_PREVIEW.\n - * camera_preview_cb() will be called when preview image data becomes available. + * camera_preview_cb() will be called when preview image data becomes available. * * @see camera_stop_preview() * @see camera_set_display() * @see camera_set_preview_cb() + * @see camera_set_media_packet_preview_cb() * @see camera_foreach_supported_preview_resolution() * @see camera_set_preview_resolution() * @see camera_get_preview_resolution() @@ -757,45 +783,52 @@ int camera_destroy(camera_h camera); int camera_start_preview(camera_h camera); /** - * @brief Stops capturing and drawing preview frames. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * @pre The camera state should be #CAMERA_STATE_PREVIEW. - * @post The camera state will be #CAMERA_STATE_CREATED. - * + * @brief Stops capturing and drawing preview frames. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. + * @post The camera state will be #CAMERA_STATE_CREATED. * @see camera_start_preview() * @see camera_unset_preview_cb() + * @see camera_unset_media_packet_preview_cb() */ int camera_stop_preview(camera_h camera); /** * @brief Starts capturing of still images. * - * @remarks This function causes the transition of camera state from #CAMERA_STATE_CAPTURING to #CAMERA_STATE_CAPTURED automatically\n - * and the corresponding callback function camera_capturing_cb() and camera_capture_completed_cb() will be invoked\n - * Captured image will be delivered through camera_capturing_cb().\n - * You will be notified by camera_capture_completed_cb() callback when camera_capturing_cb() gets completed. \n - * You should restart camera's preview with calling camera_start_preview(). - * - * @param[in] camera The handle to the camera + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks This function causes the transition of the camera state from #CAMERA_STATE_CAPTURING to #CAMERA_STATE_CAPTURED automatically\n + * and the corresponding callback function camera_capturing_cb() and camera_capture_completed_cb() will be invoked\n + * The captured image will be delivered through camera_capturing_cb().\n + * camera_capture_completed_cb() callback notifies about completion of camera_capturing_cb(). \n + * The camera's preview should be restarted by calling camera_start_preview(). + * @param[in] camera The handle to the camera * @param[in] capturing_cb The callback for capturing data - * @param[in] completed_cb The callback for notification of completed + * @param[in] completed_cb The callback for notification of completion * @param[in] user_data The user data - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @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()), - * 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. + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. \n + * 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_start_continuous_capture(); @@ -811,28 +844,30 @@ int camera_stop_preview(camera_h camera); int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , camera_capture_completed_cb completed_cb , void *user_data); /** - * @brief Starts continuous capturing of still images. - * - * @remarks - * If not supported zero shutter lag. the capture resolution could be changed to the preview resolution.\n - * This function causes the transition of camera state from #CAMERA_STATE_CAPTURING to #CAMERA_STATE_CAPTURED automatically\n - * and the corresponding callback function camera_capturing_cb() and camera_capture_completed_cb() will be invoked\n - * Each Captured image will be delivered through camera_capturing_cb().\n - * You will be notified by camera_capture_completed_cb() callback when entire capture is completed.\n - * You should restart camera's preview with calling camera_start_preview().\n + * @brief Starts continuously capturing still images. * - * @param[in] camera The handle to the camera - * @param[in] count The number of still images - * @param[in] interval The interval of capture ( millisecond ) + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks If this is not supported zero shutter lag occurs. The capture resolution could be changed to the preview resolution.\n + * This function causes the transition of the camera state from #CAMERA_STATE_CAPTURING to #CAMERA_STATE_CAPTURED automatically\n + * and the corresponding callback function camera_capturing_cb() and camera_capture_completed_cb() will be invoked\n + * Each Captured image will be delivered through camera_capturing_cb().\n + * The camera_capture_completed_cb() callback notifies about the completion of an entire capture.\n + * The camera's preview should be restarted by calling camera_start_preview().\n. + * @param[in] camera The handle to the camera + * @param[in] count The number of still images + * @param[in] interval The interval of the capture (millisecond) * @param[in] capturing_cb The callback for capturing data - * @param[in] completed_cb The callback for notification of completed + * @param[in] completed_cb The callback for notification of completion * @param[in] user_data The user data - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post If it succeeds the camera state will be #CAMERA_STATE_CAPTURED. * * @see camera_start_preview() @@ -843,31 +878,37 @@ int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , cam int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data); /** - * @brief Abort continuous capturing. + * @brief Aborts continuous capturing. * - * @remarks The camera state will be changed to the #CAMERA_STATE_CAPTURED state - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * @pre The camera state should be #CAMERA_STATE_PREVIEW + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks The camera state will be changed to #CAMERA_STATE_CAPTURED. + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. * * @see camera_start_continuous_capture() */ int camera_stop_continuous_capture(camera_h camera); - /** * @brief Gets the state of the camera. * - * @param[in] camera The handle to the camera - * @param[out] state The current state of camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] state The current state of the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_create() * @see camera_start_preview() * @see camera_stop_preview() @@ -876,19 +917,23 @@ int camera_stop_continuous_capture(camera_h camera); int camera_get_state(camera_h camera, camera_state_e *state); /** - * @brief Starts camera auto-focusing, Asynchronously + * @brief Starts camera auto-focusing, asynchronously. * - * @remarks If continuous status is true, the camera continuously tries to focus - * - * @param[in] camera The handle to the camera - * @param[in] continuous The status of continuous focusing - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * @pre The camera state should be #CAMERA_STATE_PREVIEW - * @post The camera focus state will be #CAMERA_FOCUS_STATE_ONGOING. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks If continuous status is @c true, the camera continuously tries to focus. + * @param[in] camera The handle to the camera + * @param[in] continuous The status of continuous focusing + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. + * @post The camera focus state will be #CAMERA_FOCUS_STATE_ONGOING. * * @see camera_cancel_focusing() * @see camera_set_focus_changed_cb() @@ -899,14 +944,18 @@ int camera_start_focusing(camera_h camera, bool continuous); /** * @brief Stops camera auto focusing. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * @pre The camera state should be #CAMERA_STATE_PREVIEW + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. * * @see camera_start_focusing() * @see camera_focus_changed_cb() @@ -914,37 +963,43 @@ int camera_start_focusing(camera_h camera, bool continuous); int camera_cancel_focusing(camera_h camera); /** - * @brief Sets the display handle to show preview images + * @brief Sets the display handle to show preview images. * + * @since_tizen 2.3 * @remarks This function must be called before previewing (see camera_start_preview()). - * - * @param[in] camera The handle to the camera - * @param[in] type The display type - * @param[in] display The display handle from #GET_DISPLAY() - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @pre The camera state must be #CAMERA_STATE_CREATED + * @param[in] camera The handle to the camera + * @param[in] type The display type + * @param[in] display The display handle from #GET_DISPLAY + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * * @see camera_start_preview() - * @see GET_DISPLAY() + * @see #GET_DISPLAY */ int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display); /** - * @brief Sets the resolution of preview. - * - * @remarks This function should be called before previewing (camera_start_preview()). + * @brief Sets the resolution of the preview. * - * @param[in] camera The handle to the camera - * @param[in] width The preview width - * @param[in] height The preview height - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @pre The camera state must be #CAMERA_STATE_CREATED + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks This function should be called before previewing (camera_start_preview()). + * @param[in] camera The handle to the camera + * @param[in] width The preview width + * @param[in] height The preview height + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * * @see camera_start_preview() * @see camera_get_preview_resolution() @@ -953,57 +1008,62 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ int camera_set_preview_resolution(camera_h camera, int width, int height); /** - * @brief Gets the resolution of preview. - * - * @param[in] camera The handle to the camera - * @param[out] width The preview width - * @param[out] height The preview height - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Gets the resolution of the preview. * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] width The preview width + * @param[out] height The preview height + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_set_preview_resolution() * @see camera_foreach_supported_preview_resolution() */ int camera_get_preview_resolution(camera_h camera, int *width, int *height); /** - * @brief Gets the recommended preview resolution - * - * @remarks Depend on capture resolution aspect ratio and display resolution, the recommended preview resolution is determined. - * - * @param[in] camera The handle to the camera - * @param[out] width The preview width - * @param[out] height The preview height - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Gets the recommended preview resolution. * + * @since_tizen 2.3 + * @remarks Depending on the capture resolution aspect ratio and display resolution, the recommended preview resolution is determined. + * @param[in] camera The handle to the camera + * @param[out] width The preview width + * @param[out] height The preview height + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_set_preview_resolution() * @see camera_foreach_supported_preview_resolution() */ int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height); /** - * @brief Starts the face detection. - * @remarks - * This should be called after preview is started.\n - * The callback will invoked when face detected in preview frame.\n - * Internally starting continuous focus and focusing on detected face.\n - * When the face detection is running, camera_start_focusing(), camera_cancel_focusing(), camera_attr_set_af_mode(), camera_attr_set_af_area(), camera_attr_set_exposure_mode() and camera_attr_set_whitebalance() settings are ignored.\n - * If invoke camera_stop_preview(), face detection is stopped. and then resuming preview with camera_start_preview(), you should call this method again to resume face detection. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback for notify detected face - * @param[in] user_data The user data to be passed to the callback function - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Not preview state - * @retval #CAMERA_ERROR_INVALID_OPERATION Not supported this feature - * - * @pre The camera state must be #CAMERA_STATE_PREVIEW + * @brief Starts face detection. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks This should be called after the preview is started.\n + * This callback will be invoked when the face is detected in the preview frame.\n + * Internally it starts continuous focus and focusing on the detected face.\n + * When face detection is running, the camera_start_focusing(), camera_cancel_focusing(), camera_attr_set_af_mode(), camera_attr_set_af_area(), camera_attr_set_exposure_mode(), and camera_attr_set_whitebalance() settings are ignored.\n + * If camera_stop_preview() is invoked, face detection is stopped and then preview is resumed using camera_start_preview(), this method should be called again to resume face detection. + * @param[in] camera The handle to the camera + * @param[in] callback The callback to notify face detection + * @param[in] user_data The user data to be passed to the callback function + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Not preview state + * @retval #CAMERA_ERROR_INVALID_OPERATION Not supported this feature + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be #CAMERA_STATE_PREVIEW. * * @see camera_stop_face_detection() * @see camera_face_detected_cb() @@ -1012,14 +1072,18 @@ int camera_get_recommended_preview_resolution(camera_h camera, int *width, int * int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void * user_data); /** - * @brief Stops the face detection. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Stops face detection. * - * @pre This should be called after face detection was started. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre This should be called after face detection is started. * * @see camera_start_face_detection() * @see camera_is_supported_face_detection() @@ -1027,40 +1091,6 @@ int camera_start_face_detection(camera_h camera, camera_face_detected_cb callbac int camera_stop_face_detection(camera_h camera); /** - * @brief Zooming on the detected face - * - * @remarks The face id is getting from camera_face_detected_cb().\n - * - * @param[in] camera The handle to the camera - * @param[in] face_id The face id to zoom - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE face zoom was already enabled. - * @retval #CAMERA_ERROR_INVALID_OPERATION Not supported this feature - * - * @pre This should be called after face detection was started. - * - * @see camera_cancel_face_zoom() - * @see camera_start_face_detection() - */ -int camera_face_zoom(camera_h camera, int face_id); - -/** - * @brief Cancel zooming on the face - * - * @param[in] camera The handle to the camera - * - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_face_zoom() - * @see camera_start_face_detection() - */ -int camera_cancel_face_zoom(camera_h camera); - -/** * @} */ @@ -1070,15 +1100,33 @@ int camera_cancel_face_zoom(camera_h camera); */ /** - * @brief Retrieves all supported camera preview resolutions by invoking callback function once for each supported camera preview resolution. + * @brief Gets continuous capture feature's supported state. + * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return @c true on supported, otherwise false + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_supported_preview_resolution_cb() repeatly to retrieve each supported preview resolution. + */ + bool camera_is_supported_continuous_capture(camera_h camera); + +/** + * @brief Retrieves all supported camera preview resolutions by invoking the callback function once for each supported camera preview resolution. + * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be invoked + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_supported_preview_resolution_cb() repeatedly to retrieve each supported preview resolution. * * @see camera_set_preview_resolution() * @see camera_get_preview_resolution() @@ -1096,177 +1144,182 @@ int camera_foreach_supported_preview_resolution(camera_h camera, * @{ */ - /** + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Sets the display rotation. - * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE - * - * - * @remarks This function should be called before previewing (see camera_start_preview())\n - * This function is valid only for #CAMERA_DISPLAY_TYPE_X11 - * - * @param[in] camera The handle to the camera - * @param[in] rotation The display rotation - * @return 0 on success, otherwise a negative error value. - * @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 * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks This function should be called before previewing (see camera_start_preview()) + * @param[in] camera The handle to the camera + * @param[in] rotation The display rotation + * @return @c 0 on success, otherwise a negative error value + * @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 incorrect + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_start_preview() - * @see camera_get_x11_display_rotation() + * @see camera_get_display_rotation() */ -int camera_set_x11_display_rotation(camera_h camera, camera_rotation_e rotation); +int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation); /** + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @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 - * @param[out] rotation The display rotation - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_set_x11_display_rotation() + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] rotation The display rotation + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_display_rotation() */ -int camera_get_x11_display_rotation(camera_h camera, camera_rotation_e *rotation); +int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation); /** + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Sets the display flip. - * @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 + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera * @param[in] flip The display flip - * @return 0 on success, otherwise a negative error value. - * @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 - * - * @see camera_get_x11_display_flip() + * @return @c 0 on success, otherwise a negative error value + * @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 incorrect + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_get_display_flip() */ -int camera_set_x11_display_flip(camera_h camera, camera_flip_e flip); +int camera_set_display_flip(camera_h camera, camera_flip_e flip); /** + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Gets the display flip. - * @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 - * @param[out] flip The display flip - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * - * @see camera_set_x11_display_flip() + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] flip The display flip + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_display_flip() */ -int camera_get_x11_display_flip(camera_h camera, camera_flip_e *flip); - +int camera_get_display_flip(camera_h camera, camera_flip_e *flip); /** - * @brief Sets the visible property for X11 display. - * @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 - * @param[in] visible The display visibility property + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE + * @brief Sets the visible property for display. * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] visible The display visibility property * - * @see camera_is_x11_display_visible() + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_is_display_visible() */ -int camera_set_x11_display_visible(camera_h camera, bool visible); +int camera_set_display_visible(camera_h camera, bool visible); /** - * @brief Gets the visible property of X11 display. - * @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 - * @param[out] visible @c true if camera display is visible, otherwise @c false + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE + * @brief Gets the visible property of display. * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] visible @c true if camera display is visible, otherwise @c false * - * @see camera_set_x11_display_visible() + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_display_visible() */ -int camera_is_x11_display_visible(camera_h camera, bool *visible); - +int camera_is_display_visible(camera_h camera, bool *visible); /** - * @brief Sets the X11 display aspect ratio. - * @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 - * @param[in] ratio The display apect ratio + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE + * @brief Sets the display mode. * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] mode The display mode * - * @see camera_get_x11_display_mode() + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_get_display_mode() */ -int camera_set_x11_display_mode(camera_h camera , camera_display_mode_e mode); - +int camera_set_display_mode(camera_h camera , camera_display_mode_e mode); /** - * @brief Gets the X11 display aspect ratio. - * @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 - * @param[out] ratio The display apect ratio + * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE + * @brief Gets the display mode. * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] mode The display mode * - * @see camera_set_x11_display_mode() + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_display_mode() */ -int camera_get_x11_display_mode(camera_h camera, camera_display_mode_e *mode); - +int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode); /** - * @brief Sets the resolution of capture image. - * - * @param[in] camera The handle to the camera - * @param[in] width The capture width - * @param[in] height The capture height - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @pre The camera state must be #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. - * + * @brief Sets the resolution of the captured image. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] width The capture width + * @param[in] height The capture height + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * @see camera_start_capture() * @see camera_get_capture_resolution() * @see camera_foreach_supported_capture_resolution() */ int camera_set_capture_resolution(camera_h camera, int width, int height); - /** - * @brief Gets the resolution of capture image. - * - * - * @param[in] camera The handle to the camera - * @param[out] width The capture width - * @param[out] height The capture height - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the resolution of the captured image. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] width The capture width + * @param[out] height The capture height + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_set_capture_resolution() * @see camera_foreach_supported_capture_resolution() */ @@ -1282,16 +1335,18 @@ int camera_get_capture_resolution(camera_h camera, int *width, int *height); */ /** - * @brief Retrieves all supported camera capture resolutions by invoking the callback function once for each supported camera capture resolution. + * @brief Retrieves all supported camera captured resolutions by invoking the callback function once for each supported camera capture resolution. * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to register + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_supported_capture_resolution_cb() repeatly to retrieve each supported capture resolution. - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_supported_capture_resolution_cb() repeatedly to retrieve each supported capture resolution. * @see camera_set_capture_resolution() * @see camera_get_capture_resolution() * @see camera_supported_capture_resolution_cb() @@ -1308,22 +1363,20 @@ int camera_foreach_supported_capture_resolution(camera_h camera, * @{ */ - /** - * @brief Sets the format of an image to capture. - * - * @remarks This function should be called before capturing (see camera_start_capture()). - * - * @param[in] camera The handle to the camera - * @param[out] format The format of capture image - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * - * @pre The camera state must be CAMERA_STATE_CREATED or CAMERA_STATE_PREVIEW. + * @brief Sets the format of an image to be captured. * + * @since_tizen 2.3 + * @remarks This function should be called before capturing (see camera_start_capture()). + * @param[in] camera The handle to the camera + * @param[out] format The format of the image to be captured + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * @see camera_start_capture() * @see camera_get_capture_format() * @see camera_foreach_supported_capture_format() @@ -1331,14 +1384,16 @@ int camera_foreach_supported_capture_resolution(camera_h camera, int camera_set_capture_format(camera_h camera, camera_pixel_format_e format); /** - * @brief Gets the format of capture image to capture. - * - * @param[in] camera The handle to the camera - * @param[out] format The format of capture image - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Gets the format of the image to be captured. * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] format The format of the image to be captured + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_set_capture_format() * @see camera_foreach_supported_capture_format() */ @@ -1354,17 +1409,18 @@ int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format); */ /** - * @brief Retrieves all supported camera capture formats by invoking callback function once for each supported camera capture format. - * + * @brief Retrieves all supported camera capture formats by invoking the callback function once for each supported camera capture format. * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_supported_capture_format_cb() repeatdly to retrieve each supported capture format. - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_supported_capture_format_cb() repeatedly to retrieve each supported capture format. * @see camera_set_capture_format() * @see camera_get_capture_format() * @see camera_supported_capture_format_cb() @@ -1383,18 +1439,17 @@ int camera_foreach_supported_capture_format(camera_h camera, /** * @brief Sets the preview data format. - * - * - * @remarks This function should be called before previewing (see camera_start_preview()). - * - * @param[in] camera The handle to the camera - * @param[out] format The preview data format - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @pre The camera state must be CAMERA_STATE_CREATED - * + * @since_tizen 2.3 + * @remarks This function should be called before previewing (see camera_start_preview()). + * @param[in] camera The handle to the camera + * @param[in] format The preview data format + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see camera_start_preview() * @see camera_get_preview_format() * @see camera_foreach_supported_preview_format() @@ -1402,14 +1457,15 @@ int camera_foreach_supported_capture_format(camera_h camera, int camera_set_preview_format(camera_h camera, camera_pixel_format_e format); /** - * @brief Gets the format of preview stream. - * - * @param[in] camera The handle to the camera - * @param[out] format The preview data format - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the format of the preview stream. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] format The preview data format + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_set_preview_format() * @see camera_foreach_supported_preview_format() */ @@ -1425,16 +1481,17 @@ int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format); */ /** - * @brief Retrieves all supported camera preview formats by invoking callback function once for each supported camera preview format. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke + * @brief Retrieves all supported camera preview formats by invoking the callback function once for each supported camera preview format. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_supported_preview_format_cb() repeatly to retrieve each supported preview format. - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_supported_preview_format_cb() repeatly to retrieve each supported preview format. * @see camera_set_preview_format() * @see camera_get_preview_format() * @see camera_supported_preview_format_cb() @@ -1442,42 +1499,70 @@ int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format); int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb callback, void *user_data); - /** - * @biref Gets face detection feature supported state * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @param[in] camera The handle to the camera - * @return true on supported, otherwise false - * + * @brief Gets the face detection feature's supported state. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return @c true if supported, otherwise @c false * @see camera_start_face_detection() * @see camera_stop_face_detection() + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported */ bool camera_is_supported_face_detection(camera_h camera); /** - * @biref Gets zero shutter lag feature supported state + * @brief Gets the zero shutter lag feature's supported state. * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @remarks If supporting zero shutter lag, you can do continuous shot with full capture size - * @param[in] camera The handle to the camera - * @return true on supported, otherwise false + * @since_tizen 2.3 + * @remarks If supporting zero shutter lag, continuous shot can be done with full capture size. \n + * The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return @c true if supported, otherwise @c false + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * */ bool camera_is_supported_zero_shutter_lag(camera_h camera); /** - * @biref Gets camera device count * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @remarks If device supports primary and secondary camera, this returns 2. If 1 is returned, device supports only primary camera. - * @param[in] camera The handle to the camera - * @param[out] device count Device count - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Gets the camera device count. + * @since_tizen 2.3 + * @remarks If the device supports primary and secondary camera, this returns @c 2. If @c 1 is returned, the device only supports primary camera. + * @param[in] camera The handle to the camera + * @param[out] device_count The device count + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * */ int camera_get_device_count(camera_h camera, int *device_count); /** + * @brief Gets the media packet preview callback feature's supported state. + * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return @c true if supported, otherwise @c false + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * + */ +bool camera_is_supported_media_packet_preview_cb(camera_h camera); + +/** * @} */ @@ -1487,23 +1572,24 @@ int camera_get_device_count(camera_h camera, int *device_count); */ /** - * @brief Registers a callback function to be called once per frame when previewing. - * - * @remarks This callback does not work in video recorder mode.\n - * This function should be called before previewing (see camera_start_preview())\n - * registered callback is called on internal thread of camera.\n - * You can retrieve video frame using registered callback. - * The callback function holds the same buffer that will be drawn on the display device. - * So if you change the buffer, it will be displayed on the device. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * @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 should be #CAMERA_STATE_CREATED. - * + * @brief Registers a callback function to be called once per frame when previewing. + * @since_tizen 2.3 + * @remarks This callback does not work in the video recorder mode.\n + * This function should be called before previewing (see camera_start_preview()).\n + * A registered callback is called on the internal thread of the camera.\n + * A video frame can be retrieved using a registered callback.\n + * The callback function holds the same buffer that will be drawn on the display device.\n + * So if you change the buffer in a registerd callback, it will be displayed on the device\n + * and the buffer is only available in a registerd callback. + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be registered + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera's state must be set to #CAMERA_STATE_CREATED. * @see camera_start_preview() * @see camera_unset_preview_cb() * @see camera_preview_cb() @@ -1511,29 +1597,68 @@ int camera_get_device_count(camera_h camera, int *device_count); int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data); /** - * @brief Unregisters the callback function. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Unregisters the callback function. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_set_preview_cb() */ int camera_unset_preview_cb(camera_h camera); /** - * @brief Registers a callback function to be called when camera state changes. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function will invoke camera_state_changed_cb() when camera state changes. - * + * @brief Registers a media packet callback function to be called once per frame when previewing. + * @since_tizen 2.3 + * @remarks This callback does not work in video recorder mode.\n + * This function should be called before previewing (see camera_start_preview())\n + * A registered callback is called on the internal thread of the camera.\n + * A video frame can be retrieved using a registered callback as a media packet.\n + * The callback function holds the same buffer that will be drawn on the display device.\n + * So if you change the media packet in a registerd callback, it will be displayed on the device\n + * and the media packet is available until it's destroyed by media_packet_destroy(). + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be registered + * @param[in] user_data The user data to be passed to the callback function + * @return 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera's state should be #CAMERA_STATE_CREATED. + * @see camera_start_preview() + * @see camera_unset_media_packet_preview_cb() + * @see camera_media_packet_preview_cb() + */ +int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data); + +/** + * @brief Unregisters the media packet callback function. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_media_packet_preview_cb() + */ +int camera_unset_media_packet_preview_cb(camera_h camera); + +/** + * @brief Registers a callback function to be called when the camera state changes. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function will invoke camera_state_changed_cb() when the camera state changes. * @see camera_unset_state_changed_cb() * @see camera_state_changed_cb() */ @@ -1541,28 +1666,29 @@ int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callbac void *user_data); /** - * @brief Unregisters the callback function. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_set_state_changed_cb() + * @brief Unregisters the callback function. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_state_changed_cb() */ int camera_unset_state_changed_cb(camera_h camera); /** - * @brief Registers a callback function to be called when camera interrupted by policy. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Registers a callback function to be called when the camera is interrupted by policy. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_unset_interrupted_cb() * @see camera_interrupted_cb() */ @@ -1570,29 +1696,30 @@ int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data); /** - * @brief Unregisters the callback function. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_set_interrupted_cb() + * @brief Unregisters the callback function. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_interrupted_cb() */ int camera_unset_interrupted_cb(camera_h camera); - /** - * @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 + * @brief Registers a callback function to be called when the auto-focus state changes. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function will invoke camera_focus_changed_cb() when auto-focus state changes. - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function will invoke camera_focus_changed_cb() when the auto-focus state changes. * @see camera_start_focusing() * @see camera_cancel_focusing() * @see camera_unset_focus_changed_cb() @@ -1601,53 +1728,53 @@ int camera_unset_interrupted_cb(camera_h camera); int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data); - /** - * @brief Unregisters the callback function. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_set_focus_changed_cb() + * @brief Unregisters the callback function. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_focus_changed_cb() */ int camera_unset_focus_changed_cb(camera_h camera); /** - * @brief Registers a callback function to be called when an asynchronous operation error occurred. - * - * @remarks - * This callback inform critical error situation.\n - * When invoked this callback, user should release the resource and terminate application.\n - * These error code will be occurred\n - * #CAMERA_ERROR_DEVICE\n - * #CAMERA_ERROR_INVALID_OPERATION\n - * #CAMERA_ERROR_OUT_OF_MEMORY\n - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function will invoke camera_error_cb() when an asynchronous operation error occur. - * + * @brief Registers a callback function to be called when an asynchronous operation error occurs. + * @since_tizen 2.3 + * @remarks This callback informs about a critical error situation.\n + * When this callback is invoked, the user should release the resource and terminate the application.\n + * In case of errors, one of the following codes will occur:\n + * #CAMERA_ERROR_DEVICE,\n + * #CAMERA_ERROR_INVALID_OPERATION,\n + * #CAMERA_ERROR_OUT_OF_MEMORY. + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function will invoke camera_error_cb() when an asynchronous operation error occurs. + * @see camera_unset_error_cb() * @see camera_error_cb() */ int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data); - /** - * @brief Unregisters the callback function. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_set_error_cb() + * @brief Unregisters the callback function. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_error_cb() */ int camera_unset_error_cb(camera_h camera); @@ -1662,22 +1789,20 @@ int camera_unset_error_cb(camera_h camera); /** * @brief Called to get each supported auto-focus mode. - * * @param[in] mode The supported auto-focus mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_af_mode() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_af_mode() will invoke this callback. * @see camera_attr_foreach_supported_af_mode() */ typedef bool (*camera_attr_supported_af_mode_cb)(camera_attr_af_mode_e mode, void *user_data); /** * @brief Called to get each supported exposure mode. - * * @param[in] mode The supported exposure mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_exposure_mode() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_exposure_mode() will invoke this callback. * @see camera_attr_foreach_supported_exposure_mode() * @see #camera_attr_exposure_mode_e */ @@ -1686,22 +1811,20 @@ typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode /** * @brief Called to get each supported ISO mode. - * - * @param[in] iso The supported iso mode + * @param[in] iso The supported ISO mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_iso() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_iso() will invoke this callback. * @see camera_attr_foreach_supported_iso() */ typedef bool (*camera_attr_supported_iso_cb)(camera_attr_iso_e iso, void *user_data); /** * @brief Called to get each supported white balance. - * * @param[in] wb The supported white balance mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_whitebalance() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_whitebalance() will invoke this callback. * @see camera_attr_foreach_supported_whitebalance() * @see #camera_attr_whitebalance_e */ @@ -1710,11 +1833,10 @@ typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e /** * @brief Called to get each supported effect mode. - * - * @param[in] effect The supported effect mode + * @param[in] effect The supported effect mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_effect() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_effect() will invoke this callback. * @see camera_attr_foreach_supported_effect() */ typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect, @@ -1722,11 +1844,10 @@ typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect /** * @brief Called to get each supported scene mode. - * * @param[in] mode The supported scene mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_scene_mode() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_scene_mode() will invoke this callback. * @see camera_attr_foreach_supported_scene_mode() * @see #camera_attr_scene_mode_e */ @@ -1735,11 +1856,10 @@ typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mod /** * @brief Called to get each supported flash mode. - * * @param[in] mode The supported flash mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_flash_mode() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_flash_mode() will invoke this callback. * @see camera_attr_foreach_supported_flash_mode() */ typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mode, @@ -1747,16 +1867,45 @@ typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mod /** * @brief Called to get each supported FPS mode. - * * @param[in] mode The supported FPS mode * @param[in] user_data The user data passed from the foreach function - * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop. - * @pre camera_attr_foreach_supported_fps() will invoke this callback. + * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop + * @pre camera_attr_foreach_supported_fps() will invoke this callback. * @see camera_attr_foreach_supported_fps() */ typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_data); /** + * @brief Called to get each supported stream flip mode. + * @param[in] mode The supported stream flip mode + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop + * @pre camera_attr_foreach_supported_stream_flip() will invoke this callback. + * @see camera_attr_foreach_supported_stream_flip() + */ +typedef bool (*camera_attr_supported_stream_flip_cb)(camera_flip_e flip, void *user_data); + +/** + * @brief Called to get each supported stream rotation mode. + * @param[in] mode The supported stream rotation mode + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop + * @pre camera_attr_foreach_supported_stream_rotation() will invoke this callback. + * @see camera_attr_foreach_supported_stream_rotation() + */ +typedef bool (*camera_attr_supported_stream_rotation_cb)(camera_rotation_e rotation, void *user_data); + +/** + * @brief Called to get each supported theater mode. + * @param[in] mode The supported theater mode + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop + * @pre camera_attr_foreach_supported_theater_mode() will invoke this callback. + * @see camera_attr_foreach_supported_theater_mode() + */ +typedef bool (*camera_attr_supported_theater_mode_cb)(camera_attr_theater_mode_e mode, void *user_data); + +/** * @} */ @@ -1767,16 +1916,16 @@ typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_d /** * @brief Sets the preview frame rate. - * - * @remarks This function should be called before previewing (see camera_start_preview()). - * - * @param[in] camera The handle to the camera - * @param[in] fps The frame rate - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * + * @since_tizen 2.3 + * @remarks This function should be called before previewing (see camera_start_preview()). + * @param[in] camera The handle to the camera + * @param[in] fps The frame rate + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_start_preview() * @see camera_attr_get_preview_fps() * @see camera_attr_foreach_supported_fps() @@ -1785,13 +1934,14 @@ int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps); /** * @brief Gets the frames per second of a preview video stream. - * - * @param[in] camera The handle to the camera - * @param[out] fps The frames per second of preview video stream - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] fps The frames per second of the preview video stream + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_preview_fps() * @see camera_attr_foreach_supported_fps() */ @@ -1807,16 +1957,17 @@ int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps); */ /** - * @brief Retrieves all supported FPS modes by invoking callback function once for each supported FPS mode. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_fps_cb() repeatly to get each supported FPS mode. - * + * @brief Retrieves all supported FPS modes by invoking the callback function once for each supported FPS mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_fps_cb() repeatly to get each supported FPS mode. * @see camera_attr_set_preview_fps() * @see camera_attr_get_preview_fps() * @see camera_attr_supported_fps_cb() @@ -1834,46 +1985,52 @@ int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps */ /** - * @brief Sets the image quality. - * + * @brief Sets quality of the image. * @details The range for image quality is 1 to 100. If @a quality is out of range, #CAMERA_ERROR_INVALID_PARAMETER error occurred. - * - * @param[in] camera The handle to the camera - * @param[in] quality The quality of image (1 ~ 100) - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @pre The camera state must be #CAMERA_STATE_CREATED, #CAMERA_STATE_PREVIEW. - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] quality The quality of image (1 ~ 100) + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * @see camera_start_preview() * @see camera_attr_get_image_quality() */ int camera_attr_set_image_quality(camera_h camera, int quality); /** - * @brief Gets the quality of capturing a still image. - * - * @param[in] camera The handle to the camera - * @param[out] quality The quality of image(1 ~ 100) - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the quality of a still image, which is captured. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] quality The quality of the image(1 ~ 100) + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_image_quality() */ int camera_attr_get_image_quality(camera_h camera, int *quality); /** * @brief Sets the zoom level. - * @details The range for zoom level is getting from camera_attr_get_zoom_range(). If @a zoom is out of range, #CAMERA_ERROR_INVALID_PARAMETER error occurred. - * - * @param[in] camera The handle to the camera - * @param[in] zoom The zoom level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @details The range for the zoom level is received from camera_attr_get_zoom_range(). If @a zoom is out of range, the #CAMERA_ERROR_INVALID_PARAMETER error occurs. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] zoom The zoom level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_zoom() * @see camera_attr_get_zoom_range() */ @@ -1881,13 +2038,14 @@ int camera_attr_set_zoom(camera_h camera, int zoom); /** * @brief Gets the zoom level. - * - * @param[in] camera The handle to the camera - * @param[out] zoom The zoom level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] zoom The zoom level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_zoom() * @see camera_attr_get_zoom_range() */ @@ -1895,14 +2053,16 @@ int camera_attr_get_zoom(camera_h camera, int *zoom); /** * @brief Gets the available zoom level. - * - * @param[in] camera The handle to the camera - * @param[out] min The minimum 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 - * + * @since_tizen 2.3 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum zoom level + * @param[out] max The maximum zoom level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_zoom() * @see camera_attr_get_zoom() */ @@ -1911,13 +2071,16 @@ int camera_attr_get_zoom_range(camera_h camera , int *min , int *max); /** * @brief Sets the auto focus mode. - * - * @param[in] camera The handle to the camera - * @param[in] mode The auto focus mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] mode The auto focus mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_af_mode() * @see camera_attr_foreach_supported_af_mode() * @see #camera_attr_af_mode_e @@ -1926,13 +2089,16 @@ int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode); /** * @brief Gets the auto focus mode. - * - * @param[in] camera The handle to the camera - * @param[out] mode Auto focus mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[out] mode The auto focus mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_af_mode() * @see camera_attr_set_af_mode() * @see #camera_attr_af_mode_e @@ -1940,40 +2106,41 @@ int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode); int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode); /** - * @brief Sets auto focus area - * - * @remarks This API is invalid in CAMERA_ATTR_AF_NONE mode.\n - * The coordinates are mapped into preview area - * - * @param[in] camera The handle to the camera - * @param[in] x The x coordinates of focus area - * @param[in] y The y coordinates of focus area - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * + * @brief Sets auto focus area. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks This API is invalid in the #CAMERA_ATTR_AF_NONE mode.\n + * The coordinates are mapped to preview area. + * @param[in] camera The handle to the camera + * @param[in] x The x coordinates of the focus area + * @param[in] y The y coordinates of the focus area + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_af_mode() * @see camera_attr_clear_af_area() */ int camera_attr_set_af_area(camera_h camera, int x, int y); /** - * @brief Clear the auto focus area. - * - * @remarks The focusing area set to the center area - * - * @param[in] camera The handle to the camera - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * + * @brief Clears the auto focus area. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks The focusing area is set to the center. + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_af_mode() * @see camera_attr_set_af_area() - * */ int camera_attr_clear_af_area(camera_h camera); @@ -1987,16 +2154,17 @@ int camera_attr_clear_af_area(camera_h camera); */ /** - * @brief Retrieves all supported auto focus modes by invoking callback function once for each supported auto focus mode. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_af_mode_cb() to get all supported auto focus modes. - * + * @brief Retrieves all supported auto focus modes by invoking the callback function once for each supported auto focus mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_af_mode_cb() to get all the supported auto focus modes. * @see camera_attr_set_af_mode() * @see camera_attr_get_af_mode() * @see camera_attr_supported_af_mode_cb() @@ -2015,13 +2183,16 @@ int camera_attr_foreach_supported_af_mode(camera_h camera, /** * @brief Sets the exposure mode. - * - * @param[in] camera The handle to the camera + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera * @param[in] mode The exposure mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_exposure_mode() * @see camera_attr_foreach_supported_exposure_mode() */ @@ -2029,13 +2200,14 @@ int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e m /** * @brief Gets the exposure mode. - * - * @param[in] camera The handle to the camera - * @param[out] mode Exposure mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] mode The exposure mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_exposure_mode() * @see camera_attr_foreach_supported_exposure_mode() */ @@ -2051,16 +2223,17 @@ int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e * */ /** - * @brief Retrieves all supported exposure modes by invoking callback function once for each supported exposure mode. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_exposure_mode_cb() to get all supported exposure modes. - * + * @brief Retrieves all supported exposure modes by invoking the callback function once for each supported exposure mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be invoked + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_exposure_mode_cb() to get all the supported exposure modes. * @see camera_attr_set_exposure_mode() * @see camera_attr_get_exposure_mode() * @see camera_attr_supported_exposure_mode_cb() @@ -2079,53 +2252,62 @@ int camera_attr_foreach_supported_exposure_mode(camera_h camera, /** * @brief Sets the exposure value. - * - * @param[in] camera The handle to the camera - * @param[in] value The exposure value - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] value The exposure value + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_exposure() */ int camera_attr_set_exposure(camera_h camera, int value); /** * @brief Gets the exposure value. - * - * @param[in] camera The handle to the camera - * @param[out] value Exposure value - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] value The exposure value + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_exposure() */ int camera_attr_get_exposure(camera_h camera, int *value); /** * @brief Gets the available exposure value. - * - * @param[in] camera The handle to the camera - * @param[out] min The minimum 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 - * + * @since_tizen 2.3 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum exposure value + * @param[out] max The maximum exposure value + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_exposure() */ int camera_attr_get_exposure_range(camera_h camera, int *min, int *max); /** * @brief Sets the ISO level. - * - * @param[in] camera The handle to the camera - * @param[in] iso The ISO Level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] iso The ISO level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_iso() * @see camera_attr_foreach_supported_iso() */ @@ -2133,13 +2315,14 @@ int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso); /** * @brief Gets the ISO level. - * - * @param[in] camera The handle to the camera - * @param[out] iso ISO Level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] iso The ISO level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_iso() * @see camera_attr_foreach_supported_iso() */ @@ -2155,16 +2338,17 @@ int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso); */ /** - * @brief Retrieves all supported ISO levels by invoking callback function once for each supported ISO level. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_iso_cb() to get all supported ISO levels. - * + * @brief Retrieves all supported ISO levels by invoking the callback function once for each supported ISO level. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be invoked + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_iso_cb() to get all the supported ISO levels. * @see camera_attr_set_iso() * @see camera_attr_get_iso() * @see camera_attr_supported_iso_cb() @@ -2181,47 +2365,88 @@ int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso * @{ */ - /** - * @brief Sets the theater mode - * - * @remarks If you want to display preview image on external display with full screen mode, use this function. - * - * @param[in] camera The handle to the camera - * @param[in] mode The mode to change - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @pre This function is valid only when external display was connected. - * + * @brief Sets the theater mode. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks If you want to display the preview image on the external display with the full screen mode, use this function. + * @param[in] camera The handle to the camera + * @param[in] mode The mode to change + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre This function is valid only when the external display is connected. * @see camera_attr_get_theater_mode() */ int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode); /** - * @brief Gets the theater mode - * - * @param[in] camera The handle to the camera - * @param[in] mode Currnet theater mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the theater mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] mode Currnet theater mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_theater_mode() */ int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode); +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @brief Retrieves all supported theater modes by invoking callback function once for each supported theater modes. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be invoked + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_theater_mode_cb() to get all supported theater modes. + * @see camera_attr_set_theater_mode() + * @see camera_attr_get_theater_mode() + * @see camera_attr_supported_theater_mode_cb() + */ +int camera_attr_foreach_supported_theater_mode(camera_h camera, + camera_attr_supported_theater_mode_cb callback, void *user_data); + +/** + * @} + */ + + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ /** * @brief Sets the brightness level. - * - * - * @param[in] camera The handle to the camera - * @param[in] level The brightness level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] level The brightness level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_brightness() * @see camera_attr_get_brightness_range() */ @@ -2229,13 +2454,14 @@ int camera_attr_set_brightness(camera_h camera, int level); /** * @brief Gets the brightness level. - * - * @param[in] camera The handle to the camera - * @param[out] level The brightness level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] level The brightness level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_brightness() * @see camera_attr_get_brightness_range() */ @@ -2243,14 +2469,16 @@ int camera_attr_get_brightness(camera_h camera, int *level); /** * @brief Gets the available brightness level. - * - * @param[in] camera The handle to the camera - * @param[out] min The minimum 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 - * + * @since_tizen 2.3 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum brightness level + * @param[out] max The maximum brightness level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_brightness() * @see camera_attr_get_brightness() */ @@ -2258,28 +2486,31 @@ int camera_attr_get_brightness_range(camera_h camera, int *min, int *max); /** * @brief Sets the contrast level. - * - * @param[in] camera The handle to the camera - * @param[in] level The contrast level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] level The contrast level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_contrast() * @see camera_attr_get_contrast_range() */ int camera_attr_set_contrast(camera_h camera, int level); - /** * @brief Gets the contrast level. - * - * @param[in] camera The handle to the camera - * @param[out] level The contrast level - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] level The contrast level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_contrast() * @see camera_attr_get_contrast_range() */ @@ -2287,14 +2518,16 @@ int camera_attr_get_contrast(camera_h camera, int *level); /** * @brief Gets the available contrast level. - * - * @param[in] camera The handle to the camera - * @param[out] min The minimum 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 - * + * @since_tizen 2.3 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum contrast level + * @param[out] max The maximum contrast level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_contrast() * @see camera_attr_get_contrast() */ @@ -2302,28 +2535,31 @@ int camera_attr_get_contrast_range(camera_h camera, int *min , int *max); /** * @brief Sets the white balance mode. - * - * @param[in] camera The handle to the camera - * @param[in] whitebalance The white balance mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] whitebalance The white balance mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_whitebalance() * @see camera_attr_get_whitebalance() */ int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e whitebalance); - /** * @brief Gets the white balance mode. - * - * @param[in] camera The handle to the camera - * @param[out] whitebalance The white balance mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] whitebalance The white balance mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_whitebalance() * @see camera_attr_set_whitebalance() */ @@ -2339,16 +2575,17 @@ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wh */ /** - * @brief Retrieves all supported white balances by invoking callback function once for each supported white balance. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_whitebalance_cb() to get all supported white balances. - * + * @brief Retrieves all supported white balances by invoking the callback function once for each supported white balance. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to be invoked + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_whitebalance_cb() to get all the supported white balances. * @see camera_attr_set_whitebalance() * @see camera_attr_get_whitebalance() * @see camera_attr_supported_whitebalance_cb() @@ -2367,13 +2604,16 @@ int camera_attr_foreach_supported_whitebalance(camera_h camera, /** * @brief Sets the camera effect mode. - * - * @param[in] camera The handle to the camera - * @param[in] effect The camera effect mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] effect The camera effect mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_effect() * @see camera_attr_get_effect() */ @@ -2382,13 +2622,14 @@ int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect); /** * @brief Gets the camera effect mode. - * - * @param[in] camera The handle to the camera - * @param[out] effect The camera effect mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] effect The camera effect mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_effect() * @see camera_attr_set_effect() */ @@ -2404,16 +2645,17 @@ int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect); */ /** - * @brief Retrieves all supported effect modes by invoking callback function once for each supported effect mode. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_effect_cb() to get all supported effect modes. - * + * @brief Retrieves all supported effect modes by invoking the callback function once for each supported effect mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_effect_cb() to get all the supported effect modes. * @see camera_attr_set_effect() * @see camera_attr_get_effect() * @see camera_attr_supported_effect_cb() @@ -2432,13 +2674,16 @@ int camera_attr_foreach_supported_effect(camera_h camera, /** * @brief Sets the scene mode. - * - * @param[in] camera The handle to the camera - * @param[in] mode The scene mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] mode The scene mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_scene_mode() * @see camera_attr_get_scene_mode() */ @@ -2446,13 +2691,14 @@ int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode); /** * @brief Gets the scene mode. - * - * @param[in] camera The handle to the camera - * @param[out] mode The scene mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] mode The scene mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_scene_mode() * @see camera_attr_set_scene_mode() */ @@ -2468,16 +2714,17 @@ int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode); */ /** - * @brief Retrieves all supported scene modes by invoking callback function once for each supported scene mode. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_scene_mode_cb() to get all supported scene modes. - * + * @brief Retrieves all supported scene modes by invoking the callback function once for each supported scene mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_scene_mode_cb() to get all the supported scene modes. * @see camera_attr_set_scene_mode() * @see camera_attr_get_scene_mode() * @see camera_attr_supported_scene_mode_cb() @@ -2496,180 +2743,193 @@ int camera_attr_foreach_supported_scene_mode(camera_h camera, /** * @brief Enables to write EXIF(Exchangeable image file format) tags in a JPEG file. - * - * @param[in] camera The handle to the camera - * @param[in] enable @c true to enable write EXIF tags in a JPEG file, otherwise @c false - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] enable If @c true writing EXIF tags in a JPEG file is enabled, otherwise @c false + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_is_enabled_tag() */ int camera_attr_enable_tag(camera_h camera, bool enable); /** - * @brief Gets the value that indicates whether to write EXIF(Exchangeable image file format) tags in a JPEG file is enabled. - * - * @param[in] camera The handle to the camera - * @param[out] enabled @c true if camera information is enabled, otherwise @c false - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the value that indicates whether writing EXIF(Exchangeable image file format) tags in a JPEG file is enabled. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] enabled If @c true camera information is enabled, otherwise @c false + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_enable_tag() */ int camera_attr_is_enabled_tag(camera_h camera, bool *enabled); /** - * @brief Sets a camera image description in EXIF(Exchangeable image file format) tag. - * - * @param[in] camera The handle to the camera - * @param[in] description The string with description - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_attr_get_tag_image_description() + * @brief Sets the camera image description in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] description The string with description + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_get_tag_image_description() */ int camera_attr_set_tag_image_description(camera_h camera, const char *description); /** * @brief Gets the camera image description in EXIF(Exchangeable image file format) tag. - * - * @remarks @a description must be released with free() by you. - * - * @param[in] camera The handle to the camera - * @param[out] description A pointer to a string - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_attr_set_tag_image_description() + * @since_tizen 2.3 + * @remarks You must release @a description using free(). + * @param[in] camera The handle to the camera + * @param[out] description A pointer to a string + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_set_tag_image_description() */ int camera_attr_get_tag_image_description(camera_h camera, char **description); /** - * @brief Sets the camera orientation in EXIF(Exchangeable image file format) tag. - * - * @param[in] camera The handle to the camera - * @param[in] orientation The information of the camera orientation - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Sets the camera orientation in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] orientation The camera orientation + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_tag_orientation() */ int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation); /** - * @brief Gets the camera orientation in EXIF(Exchangeable image file format) tag. - * - * @param[in] camera The handle to the camera - * @param[out] orientation The information of the camera orientation - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the camera orientation in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] orientation The camera orientation + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_tag_orientation() */ int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation); /** - * @brief Sets the software information in EXIF(Exchangeable image file format) tag. - * - * @param[in] camera The handle to the camera - * @param[in] software The software information tag - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_attr_get_tag_software() + * @brief Sets the software information in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] software The software information tag + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_get_tag_software() */ int camera_attr_set_tag_software(camera_h camera, const char *software); /** - * @brief Gets the software information in EXIF(Exchangeable image file format) tag. - * - * @remarks @a software must be released with free() by you. - * - * @param[in] camera The handle to the camera - * @param[out] software A pointer to a string - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_attr_set_tag_software() + * @brief Gets the software information in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @remarks You must release @a software using free(). + * @param[in] camera The handle to the camera + * @param[out] software A pointer to a string + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_set_tag_software() */ int camera_attr_get_tag_software(camera_h camera, char **software); /** - * @brief Sets the geotag(GPS data) in EXIF(Exchangeable image file format) tag. - * - * @param[in] camera The handle to the camera - * @param[in] latitude Latitude data - * @param[in] longitude Longitude data - * @param[in] altitude Altitude data - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_attr_get_geotag() - * @see camera_attr_remove_geotag() + * @brief Sets the geotag(GPS data) in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] latitude The latitude data + * @param[in] longitude The longitude data + * @param[in] altitude The altitude data + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_get_geotag() + * @see camera_attr_remove_geotag() */ int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude); /** - * @brief Gets the geotag(GPS data) in EXIF(Exchangeable image file format) tag. - * - * @param[in] camera The handle to the camera - * @param[out] latitude Latitude data - * @param[out] longitude Longitude data - * @param[out] altitude Altitude data - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_attr_set_geotag() - * @see camera_attr_remove_geotag() + * @brief Gets the geotag(GPS data) in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] latitude The latitude data + * @param[out] longitude The longitude data + * @param[out] altitude The altitude data + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_set_geotag() + * @see camera_attr_remove_geotag() */ int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude); /** - * @brief Remove the geotag(GPS data) in EXIF(Exchangeable image file format) tag. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_attr_set_geotag() - * @see camera_attr_get_geotag() + * @brief Removes the geotag(GPS data) in the EXIF(Exchangeable image file format) tag. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_set_geotag() + * @see camera_attr_get_geotag() */ int camera_attr_remove_geotag(camera_h camera); /** - * @brief Sets the camera flash mode. - * - * @param[in] camera The handle to the camera - * @param[in] mode The flash mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Sets the camera's flash mode. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] mode The flash mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_flash_mode() * @see camera_attr_get_flash_mode() */ int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode); /** - * @brief Gets the camera flash mode. - * - * @param[in] camera The handle to the camera - * @param[out] mode The flash mode - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the camera's flash mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] mode The flash mode + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_foreach_supported_flash_mode() * @see camera_attr_set_flash_mode() */ @@ -2685,16 +2945,17 @@ int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode); */ /** - * @brief Retrieves all supported flash modes by invoking callback funcion once for each supported flash mode. - * - * @param[in] camera The handle to the camera - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data passed to the callback registration function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @post This function invokes camera_attr_supported_flash_mode_cb() to get all supported flash modes. - * + * @brief Retrieves all supported flash modes by invoking the callback function once for each supported flash mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data passed to the callback registration function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_flash_mode_cb() to get all supported flash modes. * @see camera_attr_set_flash_mode() * @see camera_attr_get_flash_mode() * @see camera_attr_supported_flash_mode_cb() @@ -2712,90 +2973,159 @@ int camera_attr_foreach_supported_flash_mode(camera_h camera, */ /** - * @brief Gets the camera lens orientation angle. - * - * @param[in] camera The handle to the camera + * @brief Gets the camera len's orientation angle. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera * @param[out] angle The orientation angle - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see camera_set_x11_display_rotation() + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_set_display_rotation() */ 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. - * + * @brief Sets the stream rotation. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] rotation The stream rotation + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #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 + * @brief Gets the stream rotation. + * @since_tizen 2.3 + * @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. - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see camera_attr_set_stream_rotation() */ int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation); +/** + * @} + */ +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ /** - * @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. - * + * @brief Retrieves all supported stream rotation modes by invoking callback function once for each supported stream rotation mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_stream_rotation_cb() to get all supported stream rotation mode. + * @see camera_attr_set_stream_rotation() + * @see camera_attr_get_stream_rotation() + * @see camera_attr_supported_stream_rotation_cb() + */ +int camera_attr_foreach_supported_stream_rotation(camera_h camera, + camera_attr_supported_stream_rotation_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @brief Sets the stream flip. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] flip The stream flip + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #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 + * @brief Gets the stream flip. + * @since_tizen 2.3 + * @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. - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see camera_attr_set_stream_rotation() */ int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip); +/** + * @} + */ +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ /** - * @brief Called when HDR capture process was updated - * - * @param[in] percent The progress percent of HDR capture - * @param[in] user_data The user data passed from the callback registration function + * @brief Retrieves all supported stream flip modes by invoking callback function once for each supported stream flip mode. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @post This function invokes camera_attr_supported_stream_flip_cb() to get all supported stream flip mode. + * @see camera_attr_set_stream_flip() + * @see camera_attr_get_stream_flip() + * @see camera_attr_supported_stream_flip_cb() + */ +int camera_attr_foreach_supported_stream_flip(camera_h camera, + camera_attr_supported_stream_flip_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @brief Called when the HDR capture process is updated. + * @since_tizen 2.3 + * @param[in] percent The progress percentage of HDR capture + * @param[in] user_data The user data passed from the callback registration function * @pre camera_start_capture() will invoke this callback if you register it using camera_attr_set_hdr_capture_progress_cb(). - * * @see camera_attr_get_hdr_mode() * @see camera_attr_set_hdr_capture_progress_cb() * @see camera_attr_unset_hdr_capture_progress_cb() @@ -2803,20 +3133,21 @@ int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip); */ typedef void (*camera_attr_hdr_progress_cb)(int percent, void *user_data); - /** * @brief Sets the mode of HDR(High dynamic range) capture. - * @remarks - * Taking multiple pictures at different exposure level and intelligently stitching them together so that we eventually arrive at a picture that is representative in both dark and bright areas.\n - * If this attribute is setting true. camera_attr_hdr_progress_cb is invoked when capture.\n - * If you set #CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL, the capturing callback is invoked twice. The first callback is delivering origin image data. The second callback is delivering improved image data. - * - * @param[in] camera The handle to the camera - * @param[in] mode The mode of HDR capture - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks Taking multiple pictures at different exposure levels and intelligently stitching them together so that we eventually arrive at a picture that is representative in both dark and bright areas.\n + * If this attribute is set to @c true. camera_attr_hdr_progress_cb() is invoked during capture.\n + * If you set #CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL, the capturing callback is invoked twice. The first callback is delivering origin image data. The second callback is delivering improved image data. + * @param[in] camera The handle to the camera + * @param[in] mode The mode of HDR capture + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_get_hdr_mode() * @see camera_attr_set_hdr_capture_progress_cb() * @see camera_attr_unset_hdr_capture_progress_cb() @@ -2827,35 +3158,33 @@ int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode); /** * @brief Gets the mode of HDR(High dynamic range) capture. - * - * @param[in] camera The handle to the camera - * @param[out] mode The mode of HDR capture - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] mode The mode of HDR capture + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_hdr_mode() * @see camera_attr_set_hdr_capture_progress_cb() * @see camera_attr_unset_hdr_capture_progress_cb() * @see camera_attr_is_supported_hdr_capture() - * */ int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode); -__attribute__ ((deprecated)) int camera_attr_enable_hdr_capture(camera_h camera, bool enable); -__attribute__ ((deprecated)) int camera_attr_is_enabled_hdr_capture(camera_h camera, bool *enabled); - /** - * @brief Registers a callback function to be called when HDR capture is progressing. - * @remarks This callback notify progress of HDR process. - * - * @param[in] camera The handle to the camera + * @brief Registers a callback function to be called when HDR capture is progressing. + * @since_tizen 2.3 + * @remarks This callback notifies progress of the HDR process. + * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data passed to the callback registration function - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_hdr_mode() * @see camera_attr_get_hdr_mode() * @see camera_attr_unset_hdr_capture_progress_cb() @@ -2863,16 +3192,15 @@ __attribute__ ((deprecated)) int camera_attr_is_enabled_hdr_capture(camera_h cam */ int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void* user_data); - - /** - * @brief Unregisters the callback function. - * - * @param[in] camera The handle to the camera - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Unregisters the callback function. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_hdr_mode() * @see camera_attr_get_hdr_mode() * @see camera_attr_set_hdr_capture_progress_cb() @@ -2881,11 +3209,16 @@ int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_pro int camera_attr_unset_hdr_capture_progress_cb(camera_h camera); /** - * @biref Gets HDR capture supported state * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @param[in] camera The handle to the camera - * @return true on supported, otherwise false - * + * @brief Gets the support state of HDR capture. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return @c true if supported, otherwise @c false + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_set_hdr_mode() * @see camera_attr_get_hdr_mode() * @see camera_attr_set_hdr_capture_progress_cb() @@ -2894,15 +3227,18 @@ int camera_attr_unset_hdr_capture_progress_cb(camera_h camera); bool camera_attr_is_supported_hdr_capture(camera_h camera); /** - * @brief Enable/Disable Anti-shake feature - * - * @remarks This feature used for image capture - * @param[in] camera The handle to the camera - * @param[in] enable The state of anti-shake - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Enables/Disables the anti-shake feature. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks This feature is used for image capture. + * @param[in] camera The handle to the camera + * @param[in] enable If @c true the anti-shake feature is enabled, otherwise @c false + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_is_enabled_anti_shake() * @see camera_attr_is_supported_anti_shake() * @@ -2910,43 +3246,50 @@ bool camera_attr_is_supported_hdr_capture(camera_h camera); int camera_attr_enable_anti_shake(camera_h camera, bool enable); /** - * @brief Gets state of Anti-shake feature - * - * @param[in] camera The handle to the camera - * @param[out] enabled The state of anti-shake - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the state of the anti-shake feature. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] enabled The state of anti-shake + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_enable_anti_shake() * @see camera_attr_is_supported_anti_shake() - * */ int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled); /** - * @biref Gets Anti-shake feature supported state * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @param[in] camera The handle to the camera - * @return true on supported, otherwise false - * + * @brief Gets the support state of the anti-shake feature. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return @c true if supported, otherwise @c false + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_enable_anti_shake() * @see camera_attr_is_enabled_anti_shake() */ bool camera_attr_is_supported_anti_shake(camera_h camera); /** - * @brief Enable/Disable video stabilization feature - * @remarks - * If enabling video stabilization, zero shutter lag is disabling.\n - * This feature used for video recording. - * - * @param[in] camera The handle to the camera - * @param[in] enable The state of video stabilization - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Enables/Disables the video stabilization feature. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks If video stabilization is enabled, zero shutter lag is disabled.\n + * This feature is used to record a video. + * @param[in] camera The handle to the camera + * @param[in] enable If @c true video stabilization is enabled, otherwise @c false + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_is_enabled_video_stabilization() * @see camera_attr_is_supported_video_stabilization() * @@ -2954,72 +3297,112 @@ bool camera_attr_is_supported_anti_shake(camera_h camera); int camera_attr_enable_video_stabilization(camera_h camera, bool enable); /** - * @brief Gets state of video stabilization feature - * - * @param[in] camera The handle to the camera - * @param[out] enabled The state of video stabilization - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the state of the video stabilization feature. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] enabled The state of video stabilization + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_enable_video_stabilization() * @see camera_attr_is_supported_video_stabilization() - * */ int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled); /** - * @biref Gets Video stabilization feature supported state - * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @param[in] camera The handle to the camera - * @return true on supported, otherwise false - * + * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @brief Gets the support state of the video stabilization feature. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return @c true if supported, otherwise @c false + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_enable_video_stabilization() * @see camera_attr_is_enabled_video_stabilization() */ bool camera_attr_is_supported_video_stabilization(camera_h camera); - - - /** - * @brief Enable/Disable auto contrast - * - * @param[in] camera The handle to the camera - * @param[in] enable The state of auto contrast - * - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Enables/Disables auto contrast. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] camera The handle to the camera + * @param[in] enable If @c true auto contrast is enabled, otherwise @c false + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_is_enabled_auto_contrast() */ int camera_attr_enable_auto_contrast(camera_h camera, bool enable); /** - * @brief Gets state of auto contrast - * - * @param[in] camera The handle to the camera - * @param[out] enabled The state of auto contrast - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * + * @brief Gets the state of auto contrast. + * @since_tizen 2.3 + * @param[in] camera The handle to the camera + * @param[out] enabled The state of auto contrast + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see camera_attr_enable_auto_contrast() - * */ int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled); /** - * @brief Disable shutter sound. - * @remarks In some country, this operation was not permitted. - * + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @brief Gets state of support of auto contrast feature. + * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. + * @param[in] camera The handle to the camera + * @return true on supported, otherwise false + * @exception #CAMERA_ERROR_NONE Successful + * @exception #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @exception #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see camera_attr_enable_auto_contrast() + * @see camera_attr_is_enabled_auto_contrast() + */ +bool camera_attr_is_supported_auto_contrast(camera_h camera); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @brief Disables shutter sound. + * @since_tizen 2.3 + * @remarks In some countries, this operation is not permitted. * @param[in] camera The handle to the camera - * @param[in] disable If true, disabling shutter sound - * @return 0 on success, otherwise a negative error value. - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_OPERATION Not permitted disabling shutter sound + * @param[in] disable If @c true shutter sound is disabled, otherwise @c false + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_OPERATION Disabling shutter sound is not permitted + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported */ int camera_attr_disable_shutter_sound(camera_h camera, bool disable); diff --git a/include/camera_internal.h b/include/camera_internal.h new file mode 100644 index 0000000..b04c992 --- /dev/null +++ b/include/camera_internal.h @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* 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. +*/ + +#ifndef __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__ +#define __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__ +#include <camera.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file camera_internal.h + * @brief This file contains the Camera Product-internal API for framework, related structures and enumerations. + */ + +/** + * @internal + * @addtogroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @{ + */ + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Called when the media camera needs updated xid. + * @remarks If current display type is not #CAMERA_DISPLAY_TYPE_OVERLAY, no operation is performed. + * @param[in] user_data The user data passed from the callback registration function + * @return The updated xid + * @pre It will be invoked when camera needs updated xid and if this callback is registered using camera_set_x11_display_pixmap(). + * @see camera_set_x11_display_pixmap() + */ +typedef unsigned int (*camera_x11_pixmap_updated_cb)(void *user_data); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Sets the display rotation. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function should be called before previewing (see camera_start_preview())\n + * This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[in] rotation The display rotation + * @return @c 0 on success, otherwise a negative error value + * @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_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_start_preview() + * @see camera_get_x11_display_rotation() + */ +int camera_set_x11_display_rotation(camera_h camera, camera_rotation_e rotation); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Gets the display rotation. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[out] rotation The display rotation + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_set_x11_display_rotation() + */ +int camera_get_x11_display_rotation(camera_h camera, camera_rotation_e *rotation); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Sets the display flip. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[in] flip The display flip + * @return @c 0 on success, otherwise a negative error value + * @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_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_get_x11_display_flip() + */ +int camera_set_x11_display_flip(camera_h camera, camera_flip_e flip); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Gets the display flip. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[out] flip The display flip + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_set_x11_display_flip() + */ +int camera_get_x11_display_flip(camera_h camera, camera_flip_e *flip); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Sets the visible property for X11 display. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[in] visible The display visibility property + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_is_x11_display_visible() + */ +int camera_set_x11_display_visible(camera_h camera, bool visible); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Gets the visible property of X11 display. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[out] visible If @c true the camera display is visible, otherwise @c false + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_set_x11_display_visible() + */ +int camera_is_x11_display_visible(camera_h camera, bool *visible); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Sets the X11 display mode. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[in] mode The display mode + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_get_x11_display_mode() + */ +int camera_set_x11_display_mode(camera_h camera , camera_display_mode_e mode); + +/** + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @brief Gets the X11 display mode. + * + * @since_tizen 2.3 + * @privlevel platform + * @privilege %http://tizen.org/privilege/camera + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[out] mode The display mode + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted + * @see camera_set_x11_display_mode() + */ +int camera_get_x11_display_mode(camera_h camera, camera_display_mode_e *mode); + +/** + * @brief Registers a callback function to be invoked when camera needs updated xid. + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. + * @param[in] camera The handle to the camera + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create(). + * @post camera_set_x11_display_pixmap() will be invoked. + * + * @see camera_set_x11_display_pixmap() + */ +int camera_set_x11_display_pixmap(camera_h camera, camera_x11_pixmap_updated_cb callback, void *user_data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif //__TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__ diff --git a/include/camera_private.h b/include/camera_private.h index 4b43ae6..0e27f59 100755..100644 --- a/include/camera_private.h +++ b/include/camera_private.h @@ -34,14 +34,21 @@ typedef enum { _CAMERA_EVENT_TYPE_FOCUS_CHANGE, _CAMERA_EVENT_TYPE_CAPTURE_COMPLETE, _CAMERA_EVENT_TYPE_PREVIEW, + _CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW, _CAMERA_EVENT_TYPE_CAPTURE, _CAMERA_EVENT_TYPE_ERROR, _CAMERA_EVENT_TYPE_HDR_PROGRESS, _CAMERA_EVENT_TYPE_INTERRUPTED, _CAMERA_EVENT_TYPE_FACE_DETECTION, + _CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR, _CAMERA_EVENT_TYPE_NUM }_camera_event_e; +typedef struct _camera_cb_data { + int event_type; + void *handle; +} camera_cb_data; + typedef struct _camera_s{ MMHandleType mm_handle; @@ -49,7 +56,7 @@ typedef struct _camera_s{ void* user_data[_CAMERA_EVENT_TYPE_NUM]; void* display_handle; camera_display_type_e display_type; - int state; + unsigned int state; MMMessageCallback relay_message_callback; void* relay_user_data; @@ -68,6 +75,10 @@ typedef struct _camera_s{ bool is_used_in_recorder; bool on_continuous_focusing; int cached_focus_mode; + media_format_h pkt_fmt; + + GList *cb_data_list; + GMutex idle_cb_lock; } camera_s; int _camera_get_mm_handle(camera_h camera , MMHandleType *handle); @@ -75,6 +86,11 @@ int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback cal int __camera_start_continuous_focusing(camera_h camera); int _camera_set_use(camera_h camera, bool used); bool _camera_is_used(camera_h camera); +void _camera_remove_cb_message(camera_s *handle); +int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format); +int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype); +int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data); +int __convert_camera_error_code(const char* func, int code); #ifdef __cplusplus } diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 2c58661..58832b8 100755 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,15 +1,24 @@ Name: capi-media-camera Summary: A Camera library in Tizen C API -Version: 0.1.4 +Version: 0.2.0 Release: 0 Group: Multimedia/API License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake +BuildRequires: pkgconfig(gstreamer-1.0) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(mm-camcorder) BuildRequires: pkgconfig(audio-session-mgr) BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-media-tool) +BuildRequires: pkgconfig(libtbm) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(elementary) +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + %description A Camera library in Tizen C API. @@ -18,6 +27,9 @@ A Camera library in Tizen C API. %package devel Summary: A Camera library in Tizen C API (Development) Requires: %{name} = %{version}-%{release} +Requires: pkgconfig(libtbm) +Requires: pkgconfig(capi-media-tool) + %description devel A Camera library in Tizen C API. @@ -25,35 +37,41 @@ A Camera library in Tizen C API. Development related files. - %prep %setup -q %build +%if 0%{?sec_build_binary_debug_enable} +export CFLAGS+=" -DTIZEN_DEBUG_ENABLE" +%endif MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} - - +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} make %{?jobs:-j%jobs} + %install +rm -rf %{buildroot} %make_install +mkdir -p %{buildroot}%{_datadir}/license +cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name} + %post -p /sbin/ldconfig + %postun -p /sbin/ldconfig %files %manifest capi-media-camera.manifest -%license LICENSE.APLv2 %{_libdir}/libcapi-media-camera.so.* +%{_datadir}/license/%{name} %files devel %{_includedir}/media/camera.h +%{_includedir}/media/camera_internal.h %{_libdir}/pkgconfig/*.pc %{_libdir}/libcapi-media-camera.so - diff --git a/src/camera.c b/src/camera.c index e99d2d3..6d6cdb9 100755..100644 --- a/src/camera.c +++ b/src/camera.c @@ -27,6 +27,12 @@ #include <camera_private.h> #include <glib.h> #include <dlog.h> +#include <gst/gst.h> +#include <tbm_bufmgr.h> +#include <tbm_surface_internal.h> +#include <Evas.h> +#include <Ecore.h> +#include <Elementary.h> #ifdef LOG_TAG #undef LOG_TAG @@ -36,76 +42,116 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * stream, void *user_data); static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data); +void _camera_remove_cb_message(camera_s *handle){ + int ret = 0; + GList *list = NULL; + camera_cb_data *cb_data = NULL; -static int __convert_camera_error_code(const char* func, int code){ + if( handle == NULL ){ + LOGE("handle is NULL"); + return; + } + + LOGI("start"); + + g_mutex_lock(&handle->idle_cb_lock); + + if( handle->cb_data_list ){ + list = handle->cb_data_list; + + while( list ){ + cb_data = list->data; + list = g_list_next(list); + + if( !cb_data ){ + LOGW("cb_data is NULL"); + } else { + ret = g_idle_remove_by_data (cb_data); + LOGW("Remove cb_data[%p]. ret[%d]", cb_data, ret); + + handle->cb_data_list = g_list_remove(handle->cb_data_list, cb_data); + free(cb_data); + cb_data = NULL; + } + } + + g_list_free(handle->cb_data_list); + handle->cb_data_list = NULL; + } else { + LOGW("There is no remained callback"); + } + + g_mutex_unlock(&handle->idle_cb_lock); + + LOGI("done"); + + return; +} + + +int __convert_camera_error_code(const char* func, int code){ int ret = CAMERA_ERROR_NONE; - char *errorstr = NULL; - switch(code) - { + const char *errorstr = NULL; + + switch( code ){ case MM_ERROR_NONE: ret = CAMERA_ERROR_NONE; errorstr = "ERROR_NONE"; break; - case MM_ERROR_CAMCORDER_INVALID_ARGUMENT : - case MM_ERROR_COMMON_INVALID_ATTRTYPE : - case MM_ERROR_COMMON_INVALID_PERMISSION : - case MM_ERROR_COMMON_OUT_OF_ARRAY : - case MM_ERROR_COMMON_OUT_OF_RANGE : - case MM_ERROR_COMMON_ATTR_NOT_EXIST : + case MM_ERROR_CAMCORDER_INVALID_ARGUMENT: + case MM_ERROR_COMMON_INVALID_ATTRTYPE: ret = CAMERA_ERROR_INVALID_PARAMETER; errorstr = "INVALID_PARAMETER"; break; - case MM_ERROR_CAMCORDER_NOT_INITIALIZED : - case MM_ERROR_CAMCORDER_INVALID_STATE : + case MM_ERROR_CAMCORDER_NOT_INITIALIZED: + case MM_ERROR_CAMCORDER_INVALID_STATE: ret = CAMERA_ERROR_INVALID_STATE; errorstr = "INVALID_STATE"; break; - case MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND : + case MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND: ret = CAMERA_ERROR_DEVICE_NOT_FOUND; errorstr = "DEVICE_NOT_FOUND"; break; - case MM_ERROR_CAMCORDER_DEVICE_BUSY : - case MM_ERROR_CAMCORDER_DEVICE_OPEN : - case MM_ERROR_CAMCORDER_CMD_IS_RUNNING : + case MM_ERROR_CAMCORDER_DEVICE_BUSY: + case MM_ERROR_CAMCORDER_DEVICE_OPEN: + case MM_ERROR_CAMCORDER_CMD_IS_RUNNING: ret = CAMERA_ERROR_DEVICE_BUSY; errorstr = "DEVICE_BUSY"; break; - case MM_ERROR_CAMCORDER_DEVICE : - case MM_ERROR_CAMCORDER_DEVICE_IO : - case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT : - case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE : - case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG : - case MM_ERROR_CAMCORDER_DEVICE_LACK_BUFFER : + case MM_ERROR_CAMCORDER_DEVICE: + case MM_ERROR_CAMCORDER_DEVICE_IO: + case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT: + case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG: + case MM_ERROR_CAMCORDER_DEVICE_LACK_BUFFER: ret = CAMERA_ERROR_DEVICE; errorstr = "ERROR_DEVICE"; break; - case MM_ERROR_CAMCORDER_GST_CORE : - case MM_ERROR_CAMCORDER_GST_LIBRARY : - case MM_ERROR_CAMCORDER_GST_RESOURCE : - case MM_ERROR_CAMCORDER_GST_STREAM : - case MM_ERROR_CAMCORDER_GST_STATECHANGE : - case MM_ERROR_CAMCORDER_GST_NEGOTIATION : - case MM_ERROR_CAMCORDER_GST_LINK : - case MM_ERROR_CAMCORDER_GST_FLOW_ERROR : - case MM_ERROR_CAMCORDER_ENCODER : - case MM_ERROR_CAMCORDER_ENCODER_BUFFER : - case MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE : - case MM_ERROR_CAMCORDER_ENCODER_WORKING : - case MM_ERROR_CAMCORDER_INTERNAL : - case MM_ERROR_CAMCORDER_NOT_SUPPORTED : - case MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT : - case MM_ERROR_CAMCORDER_DSP_FAIL : - case MM_ERROR_CAMCORDER_AUDIO_EMPTY : - case MM_ERROR_CAMCORDER_CREATE_CONFIGURE : - case MM_ERROR_CAMCORDER_FILE_SIZE_OVER : - case MM_ERROR_CAMCORDER_DISPLAY_DEVICE_OFF : - case MM_ERROR_CAMCORDER_INVALID_CONDITION : + case MM_ERROR_CAMCORDER_GST_CORE: + case MM_ERROR_CAMCORDER_GST_LIBRARY: + case MM_ERROR_CAMCORDER_GST_RESOURCE: + case MM_ERROR_CAMCORDER_GST_STREAM: + case MM_ERROR_CAMCORDER_GST_STATECHANGE: + case MM_ERROR_CAMCORDER_GST_NEGOTIATION: + case MM_ERROR_CAMCORDER_GST_LINK: + case MM_ERROR_CAMCORDER_GST_FLOW_ERROR: + case MM_ERROR_CAMCORDER_ENCODER: + case MM_ERROR_CAMCORDER_ENCODER_BUFFER: + case MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE: + case MM_ERROR_CAMCORDER_ENCODER_WORKING: + case MM_ERROR_CAMCORDER_INTERNAL: + case MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT: + case MM_ERROR_CAMCORDER_DSP_FAIL: + case MM_ERROR_CAMCORDER_AUDIO_EMPTY: + case MM_ERROR_CAMCORDER_CREATE_CONFIGURE: + case MM_ERROR_CAMCORDER_FILE_SIZE_OVER: + case MM_ERROR_CAMCORDER_DISPLAY_DEVICE_OFF: + case MM_ERROR_CAMCORDER_INVALID_CONDITION: ret = CAMERA_ERROR_INVALID_OPERATION; errorstr = "INVALID_OPERATION"; break; - case MM_ERROR_CAMCORDER_RESOURCE_CREATION : + case MM_ERROR_CAMCORDER_RESOURCE_CREATION: case MM_ERROR_COMMON_OUT_OF_MEMORY: ret = CAMERA_ERROR_OUT_OF_MEMORY; errorstr = "OUT_OF_MEMORY"; @@ -127,12 +173,30 @@ static int __convert_camera_error_code(const char* func, int code){ ret = CAMERA_ERROR_SECURITY_RESTRICTED; errorstr = "ERROR_RESTRICTED"; break; - + case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE: + ret = CAMERA_ERROR_ESD; + errorstr = "ERROR_ESD"; + break; + case MM_ERROR_COMMON_INVALID_PERMISSION: + ret = CAMERA_ERROR_PERMISSION_DENIED; + errorstr = "ERROR_PERMISSION_DENIED"; + break; + case MM_ERROR_COMMON_OUT_OF_ARRAY: + case MM_ERROR_COMMON_OUT_OF_RANGE: + case MM_ERROR_COMMON_ATTR_NOT_EXIST: + case MM_ERROR_CAMCORDER_NOT_SUPPORTED: + ret = CAMERA_ERROR_NOT_SUPPORTED; + errorstr = "ERROR_NOT_SUPPORTED"; + break; default: ret = CAMERA_ERROR_INVALID_OPERATION; errorstr = "INVALID_OPERATION"; } - LOGE( "[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code); + + if( code != MM_ERROR_NONE ){ + LOGE("%s(0x%08x) : core frameworks error code(0x%08x)", errorstr, ret, code); + } + return ret; } @@ -156,17 +220,17 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea frame.data.single_plane.yuv = stream->data.yuv420.yuv; frame.data.single_plane.size = stream->data.yuv420.length_yuv; break; - case MM_CAM_STREAM_DATA_YUV422 : + case MM_CAM_STREAM_DATA_YUV422: frame.data.single_plane.yuv = stream->data.yuv422.yuv; frame.data.single_plane.size = stream->data.yuv422.length_yuv; break; - case MM_CAM_STREAM_DATA_YUV420SP : + case MM_CAM_STREAM_DATA_YUV420SP: frame.data.double_plane.y = stream->data.yuv420sp.y; frame.data.double_plane.uv = stream->data.yuv420sp.uv; frame.data.double_plane.y_size = stream->data.yuv420sp.length_y; frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv; break; - case MM_CAM_STREAM_DATA_YUV420P : + case MM_CAM_STREAM_DATA_YUV420P: frame.data.triple_plane.y = stream->data.yuv420p.y; frame.data.triple_plane.u = stream->data.yuv420p.u; frame.data.triple_plane.v = stream->data.yuv420p.v; @@ -174,7 +238,7 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea frame.data.triple_plane.u_size = stream->data.yuv420p.length_u; frame.data.triple_plane.v_size = stream->data.yuv420p.length_v; break; - case MM_CAM_STREAM_DATA_YUV422P : + case MM_CAM_STREAM_DATA_YUV422P: frame.data.triple_plane.y = stream->data.yuv422p.y; frame.data.triple_plane.u = stream->data.yuv422p.u; frame.data.triple_plane.v = stream->data.yuv422p.v; @@ -182,11 +246,113 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea frame.data.triple_plane.u_size = stream->data.yuv422p.length_u; frame.data.triple_plane.v_size = stream->data.yuv422p.length_v; break; + default : + break; } ((camera_preview_cb)handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW])(&frame, handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW]); } + + if( handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] ){ + media_packet_h pkt = NULL; + tbm_surface_h tsurf = NULL; + uint32_t bo_format = 0; + int i; + int bo_num; + int ret = 0; + media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12; + bool make_pkt_fmt = false; + + /* create tbm surface */ + for( i = 0, bo_num = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++ ){ + if( stream->bo[i] ){ + bo_num++; + } + } + + /* get tbm surface format */ + ret = _camera_get_tbm_surface_format(stream->format, &bo_format); + ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype); + + if( bo_num > 0 && ret == CAMERA_ERROR_NONE ){ + tsurf = tbm_surface_internal_create_with_bos(stream->width, stream->height, bo_format, (tbm_bo *)stream->bo, bo_num); + /*LOGD("tbm surface %p", tsurf);*/ + } + + if( tsurf ){ + /* check media packet format */ + if( handle->pkt_fmt ){ + int pkt_fmt_width = 0; + int pkt_fmt_height = 0; + media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12; + + media_format_get_video_info(handle->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL); + if( pkt_fmt_mimetype != mimetype || + pkt_fmt_width != stream->width || + pkt_fmt_height != stream->height ){ + LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d", + pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height); + media_format_unref(handle->pkt_fmt); + handle->pkt_fmt = NULL; + make_pkt_fmt = true; + } + } else { + make_pkt_fmt = true; + } + + /* create packet format */ + if( make_pkt_fmt ){ + LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height); + ret = media_format_create(&handle->pkt_fmt); + if (ret == MEDIA_FORMAT_ERROR_NONE) { + ret = media_format_set_video_mime(handle->pkt_fmt, mimetype); + ret |= media_format_set_video_width(handle->pkt_fmt, stream->width); + ret |= media_format_set_video_height(handle->pkt_fmt, stream->height); + LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret); + } else { + LOGW("media_format_create failed"); + } + } + + /* create media packet */ + ret = media_packet_create_from_tbm_surface(handle->pkt_fmt, tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize, (void *)handle, &pkt); + if( ret != MEDIA_PACKET_ERROR_NONE ){ + LOGE("media_packet_create_from_tbm_surface failed"); + + tbm_surface_destroy(tsurf); + tsurf = NULL; + } + } else { + LOGE("failed to create tbm surface %dx%d, format %d, bo_num %d", stream->width, stream->height, stream->format, bo_num); + } + + if( pkt ){ + /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/ + + /* set internal buffer */ + ret = media_packet_set_extra(pkt, stream->internal_buffer); + if( ret != MEDIA_PACKET_ERROR_NONE ){ + LOGE("media_packet_set_extra failed"); + + media_packet_destroy(pkt); + pkt = NULL; + } else { + /* set timestamp : msec -> nsec */ + if( media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE ){ + LOGW("media_packet_set_pts failed"); + } + + /* increase ref count of gst buffer */ + gst_buffer_ref((GstBuffer *)stream->internal_buffer); + + /* call media packet callback */ + ((camera_media_packet_preview_cb)handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW])(pkt, handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]); + } + } + } + return 1; } + static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data){ if( user_data == NULL || frame == NULL) return 0; @@ -209,7 +375,7 @@ static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamco image.height = frame->height; image.format = frame->format; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, "captured-exif-raw-data", &exif, &exif_size, NULL); - if( ret == 0 ){ + if( ret == MM_ERROR_NONE ){ image.exif = exif; image.exif_size = exif_size; } @@ -235,15 +401,17 @@ static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamco } // update captured state if( handle->capture_count == 1 && handle->hdr_keep_mode ){ - if( handle->current_capture_count == 2 ) + if( handle->current_capture_count == 2 ){ handle->is_capture_completed = true; - }else if( handle->capture_count == handle->current_capture_count || handle->is_continuous_shot_break) + } + } else if( handle->capture_count == handle->current_capture_count || handle->is_continuous_shot_break){ handle->is_capture_completed = true; + } + return 1; } -static camera_state_e __camera_state_convert(MMCamcorderStateType mm_state) -{ +static camera_state_e __camera_state_convert(MMCamcorderStateType mm_state){ camera_state_e state = CAMERA_STATE_NONE; switch( mm_state ){ @@ -306,21 +474,21 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat switch (m->state.code) { case ASM_EVENT_SOURCE_CALL_START: policy = CAMERA_POLICY_SOUND_BY_CALL; - LOGE("CAMERA_POLICY_SOUND_BY_CALL"); + LOGW("CAMERA_POLICY_SOUND_BY_CALL"); break; case ASM_EVENT_SOURCE_ALARM_START: case ASM_EVENT_SOURCE_ALARM_END: policy = CAMERA_POLICY_SOUND_BY_ALARM; - LOGE("CAMERA_POLICY_SOUND_BY_ALARM"); + LOGW("CAMERA_POLICY_SOUND_BY_ALARM"); break; default: policy = CAMERA_POLICY_SOUND; - LOGE("CAMERA_POLICY_SOUND"); + LOGW("CAMERA_POLICY_SOUND"); break; } } else if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY) { policy = CAMERA_POLICY_SECURITY; - LOGE("CAMERA_POLICY_SECURITY"); + LOGW("CAMERA_POLICY_SECURITY"); } if( previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] ){ @@ -328,11 +496,12 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat } // should change intermediate state MM_CAMCORDER_STATE_READY is not valid in capi , change to NULL state - if( policy != CAMERA_POLICY_NONE ){ - if( previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] ) + if( policy != CAMERA_POLICY_NONE && + m->state.current == MM_CAMCORDER_STATE_NULL ){ + if( handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED]){ ((camera_interrupted_cb)handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED])(policy, previous_state, handle->state, handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]); - if( m->state.previous == MM_CAMCORDER_STATE_PREPARE && m->state.current == MM_CAMCORDER_STATE_READY ){ - mm_camcorder_unrealize(handle->mm_handle); + } else { + LOGW("_CAMERA_EVENT_TYPE_INTERRUPTED cb is NULL"); } } @@ -345,7 +514,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat case MM_MESSAGE_CAMCORDER_CAPTURED: { handle->current_capture_complete_count = m->code; - if( handle->capture_count == 1 || m->code == handle->capture_count ||(handle->is_continuous_shot_break && handle->state == CAMERA_STATE_CAPTURING) ){ + if( handle->capture_count == 1 || m->code == handle->capture_count ||(handle->is_continuous_shot_break && handle->state == CAMERA_STATE_CAPTURING) ){ //pseudo state change previous_state = handle->state ; handle->state = CAMERA_STATE_CAPTURED; @@ -385,32 +554,41 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat int camera_error = 0; switch( errorcode ){ case MM_ERROR_CAMCORDER_DEVICE : - case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT : - case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE : - case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG : + case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT: + case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG: camera_error = CAMERA_ERROR_DEVICE; break; - case MM_ERROR_CAMCORDER_GST_CORE : - case MM_ERROR_CAMCORDER_GST_LIBRARY : - case MM_ERROR_CAMCORDER_GST_RESOURCE : - case MM_ERROR_CAMCORDER_GST_STREAM : - case MM_ERROR_CAMCORDER_GST_NEGOTIATION : - case MM_ERROR_CAMCORDER_GST_FLOW_ERROR : - case MM_ERROR_CAMCORDER_ENCODER : - case MM_ERROR_CAMCORDER_ENCODER_BUFFER : - case MM_ERROR_CAMCORDER_ENCODER_WORKING : - case MM_ERROR_CAMCORDER_MNOTE_CREATION : - case MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY : - case MM_ERROR_CAMCORDER_INTERNAL : + case MM_ERROR_CAMCORDER_GST_CORE: + case MM_ERROR_CAMCORDER_GST_LIBRARY: + case MM_ERROR_CAMCORDER_GST_RESOURCE: + case MM_ERROR_CAMCORDER_GST_STREAM: + case MM_ERROR_CAMCORDER_GST_NEGOTIATION: + case MM_ERROR_CAMCORDER_GST_FLOW_ERROR: + case MM_ERROR_CAMCORDER_ENCODER: + case MM_ERROR_CAMCORDER_ENCODER_BUFFER: + case MM_ERROR_CAMCORDER_ENCODER_WORKING: + case MM_ERROR_CAMCORDER_MNOTE_CREATION: + case MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY: + case MM_ERROR_CAMCORDER_INTERNAL: case MM_ERROR_FILE_NOT_FOUND: case MM_ERROR_FILE_READ: camera_error = CAMERA_ERROR_INVALID_OPERATION; break; - case MM_ERROR_CAMCORDER_LOW_MEMORY : - case MM_ERROR_CAMCORDER_MNOTE_MALLOC : + case MM_ERROR_CAMCORDER_LOW_MEMORY: + case MM_ERROR_CAMCORDER_MNOTE_MALLOC: camera_error = CAMERA_ERROR_OUT_OF_MEMORY; break; + case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE: + camera_error = CAMERA_ERROR_ESD; + break; + default : + camera_error = CAMERA_ERROR_INVALID_OPERATION; + break; } + + /* set capture completed flag as true to release camera handle */ + handle->is_capture_completed = true; + if( camera_error != 0 && handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] ) ((camera_error_cb)handle->user_cb[_CAMERA_EVENT_TYPE_ERROR])(camera_error, handle->state , handle->user_data[_CAMERA_EVENT_TYPE_ERROR]); @@ -446,6 +624,8 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat } break; } + default: + break; } return 1; @@ -467,10 +647,10 @@ static int __capture_completed_event_cb(void *data){ return false; } -int camera_create( camera_device_e device, camera_h* camera){ +int camera_create(camera_device_e device, camera_h* camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -479,20 +659,19 @@ int camera_create( camera_device_e device, camera_h* camera){ int preview_format; int rotation; - if( device == CAMERA_DEVICE_CAMERA1 ) - info.videodev_type= MM_VIDEO_DEVICE_CAMERA1; - else - info.videodev_type= MM_VIDEO_DEVICE_CAMERA0; + LOGW("device name = [%d]",device); + + info.videodev_type = device; camera_s* handle = (camera_s*)malloc( sizeof(camera_s) ); - if(handle==NULL){ - LOGE("[%s] malloc fail",__func__); + if( handle==NULL ){ + LOGE("malloc fail"); return CAMERA_ERROR_OUT_OF_MEMORY; } memset(handle, 0 , sizeof(camera_s)); ret = mm_camcorder_create(&handle->mm_handle, &info); - if( ret != MM_ERROR_NONE){ + if( ret != MM_ERROR_NONE ){ free(handle); return __convert_camera_error_code(__func__,ret); } @@ -500,27 +679,27 @@ int camera_create( camera_device_e device, camera_h* camera){ preview_format = MM_PIXEL_FORMAT_YUYV; rotation = MM_DISPLAY_ROTATION_NONE; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, &preview_format, - MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation, - MMCAM_CAPTURE_WIDTH, &handle->capture_width, - MMCAM_CAPTURE_HEIGHT, &handle->capture_height, - NULL); + MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, &preview_format, + MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation, + MMCAM_CAPTURE_WIDTH, &handle->capture_width, + MMCAM_CAPTURE_HEIGHT, &handle->capture_height, + NULL); char *error; ret = mm_camcorder_set_attributes(handle->mm_handle, &error, - MMCAM_MODE , MM_CAMCORDER_MODE_VIDEO_CAPTURE, - MMCAM_CAMERA_FORMAT, preview_format, - 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, - (void*)NULL); + MMCAM_MODE , MM_CAMCORDER_MODE_VIDEO_CAPTURE, + MMCAM_CAMERA_FORMAT, preview_format, + 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, + (void*)NULL); handle->display_type = CAMERA_DISPLAY_TYPE_NONE; - if( ret != MM_ERROR_NONE){ - LOGE("[%s] mm_camcorder_set_attributes fail(%x, %s)",__func__, ret, error); + if( ret != MM_ERROR_NONE ){ + LOGE("mm_camcorder_set_attributes fail(%x, %s)", ret, error); mm_camcorder_destroy(handle->mm_handle); free(error); free(handle); @@ -536,70 +715,79 @@ int camera_create( camera_device_e device, camera_h* camera){ handle->is_used_in_recorder = false; handle->on_continuous_focusing = false; handle->cached_focus_mode = -1; + g_mutex_init(&handle->idle_cb_lock); mm_camcorder_set_message_callback(handle->mm_handle, __mm_camera_message_callback, (void*)handle); + LOGW("camera handle %p", handle); + *camera = (camera_h)handle; return __convert_camera_error_code(__func__, ret); } int camera_destroy(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } int ret; camera_s *handle = (camera_s*)camera; if( handle->is_used_in_recorder ){ - LOGE("[%s] camera is using in another recorder.", __func__); + LOGE("camera is using in another recorder."); return CAMERA_ERROR_INVALID_OPERATION; } + LOGW("camera handle %p", handle); + ret = mm_camcorder_destroy(handle->mm_handle); - if( ret == MM_ERROR_NONE) + if( handle->pkt_fmt ){ + media_format_unref(handle->pkt_fmt); + handle->pkt_fmt = NULL; + } + + if( ret == MM_ERROR_NONE ){ + _camera_remove_cb_message(handle); + g_mutex_clear(&handle->idle_cb_lock); free(handle); + } return __convert_camera_error_code(__func__, ret); } int camera_start_preview(camera_h camera){ - LOGE("%s - start", __func__); - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGW("start"); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; camera_s *handle = (camera_s*)camera; camera_state_e capi_state; camera_get_state(camera, &capi_state); - if( capi_state == CAMERA_STATE_CAPTURED ) - { + if( capi_state == CAMERA_STATE_CAPTURED ){ ret = mm_camcorder_capture_stop(handle->mm_handle); return __convert_camera_error_code(__func__, ret); } - - - //for receving MM_MESSAGE_CAMCORDER_CAPTURED evnet must be seted capture callback + /*for receving MM_MESSAGE_CAMCORDER_CAPTURED evnet must be seted capture callback*/ mm_camcorder_set_video_capture_callback( handle->mm_handle, (mm_camcorder_video_capture_callback)__mm_capture_callback, (void*)handle); - MMCamcorderStateType state ; + MMCamcorderStateType state; mm_camcorder_get_state(handle->mm_handle, &state); - if( state != MM_CAMCORDER_STATE_READY){ + if( state != MM_CAMCORDER_STATE_READY ){ ret = mm_camcorder_realize(handle->mm_handle); - if( ret != MM_ERROR_NONE ) + if( ret != MM_ERROR_NONE ){ return __convert_camera_error_code(__func__, ret); + } } ret = mm_camcorder_start(handle->mm_handle); - - //start fail. - if( ret != MM_ERROR_NONE && state != MM_CAMCORDER_STATE_READY){ + if( ret != MM_ERROR_NONE ){ + /*start fail */ mm_camcorder_unrealize(handle->mm_handle); } @@ -607,12 +795,11 @@ int camera_start_preview(camera_h camera){ } int camera_stop_preview(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; camera_s *handle = (camera_s*)camera; MMCamcorderStateType state ; @@ -620,17 +807,21 @@ int camera_stop_preview(camera_h camera){ if( state == MM_CAMCORDER_STATE_PREPARE ){ ret = mm_camcorder_stop(handle->mm_handle); - if( ret != MM_ERROR_NONE) + if( ret != MM_ERROR_NONE ){ return __convert_camera_error_code(__func__, ret); + } } + camera_stop_face_detection(camera); + ret = mm_camcorder_unrealize(handle->mm_handle); + return __convert_camera_error_code(__func__, ret); } int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , camera_capture_completed_cb completed_cb , void *user_data){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -638,16 +829,18 @@ int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , cam int ret; MMCamcorderStateType state; mm_camcorder_get_state(handle->mm_handle, &state); - if( state != MM_CAMCORDER_STATE_PREPARE && state != MM_CAMCORDER_STATE_RECORDING && state != MM_CAMCORDER_STATE_PAUSED){ - LOGE( "[%s] INVALID_STATE(0x%08x)",__func__,CAMERA_ERROR_INVALID_STATE); + if( state != MM_CAMCORDER_STATE_PREPARE && + state != MM_CAMCORDER_STATE_RECORDING && + state != MM_CAMCORDER_STATE_PAUSED ){ + LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } if( handle->capture_resolution_modified ){ mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_WIDTH, handle->capture_width, - MMCAM_CAPTURE_HEIGHT, handle->capture_height, - NULL); + MMCAM_CAPTURE_WIDTH, handle->capture_width, + MMCAM_CAPTURE_HEIGHT, handle->capture_height, + NULL); handle->capture_resolution_modified = false; } mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAPTURE_COUNT , 1,NULL); @@ -673,14 +866,40 @@ int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , cam return __convert_camera_error_code(__func__, ret); } +bool camera_is_supported_continuous_capture(camera_h camera){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + return false; + } + + int ret = MM_ERROR_NONE; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo info; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_COUNT , &info); + set_last_result(__convert_camera_error_code(__func__, ret)); + if( ret != MM_ERROR_NONE ){ + return false; + } + if( info.int_range.max > 1){ + return true; + } else { + return false; + } +} + int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + if( camera_is_supported_continuous_capture(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + if( count < 2 || interval < 0 ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -689,51 +908,49 @@ int camera_start_continuous_capture(camera_h camera, int count, int interval, ca MMCamcorderStateType state; mm_camcorder_get_state(handle->mm_handle, &state); if( state != MM_CAMCORDER_STATE_PREPARE ){ - LOGE( "[%s] INVALID_STATE(0x%08x)",__func__,CAMERA_ERROR_INVALID_STATE); + LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } - int preview_width; - int preview_height; - int capture_width; - int capture_height; - int current_preview_format; - bool supported_ZSL = false; + int supported_zsl = FALSE; int ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_COUNT , count, - MMCAM_CAPTURE_INTERVAL, interval, - NULL); + MMCAM_CAPTURE_COUNT, count, + MMCAM_CAPTURE_INTERVAL, interval, + NULL); if( ret != 0 ){ - LOGE("[%s] (%x) error set continuous shot attribute", ret); + LOGE("(%x) error set continuous shot attribute", ret); return __convert_camera_error_code(__func__, ret); } + handle->capture_count = count; handle->is_continuous_shot_break = false; handle->current_capture_count = 0; handle->current_capture_complete_count = 0; handle->is_capture_completed = false; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FORMAT, ¤t_preview_format,NULL); - if( current_preview_format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) - supported_ZSL = true; - + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, NULL); if( ret != 0 ){ - LOGE("[%s] (%x) error get continuous shot attribute", ret); + LOGE("(%x) error get continuous shot attribute", ret); } - if( !supported_ZSL ){ + if( !supported_zsl ){ + int preview_width; + int preview_height; + int capture_width; + int capture_height; + mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_WIDTH, &preview_width, - MMCAM_CAMERA_HEIGHT, &preview_height, - MMCAM_CAPTURE_WIDTH, &capture_width, - MMCAM_CAPTURE_HEIGHT, &capture_height, - NULL); + MMCAM_CAMERA_WIDTH, &preview_width, + MMCAM_CAMERA_HEIGHT, &preview_height, + MMCAM_CAPTURE_WIDTH, &capture_width, + MMCAM_CAPTURE_HEIGHT, &capture_height, + NULL); if( preview_width != capture_width || preview_height != capture_height ){ mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_WIDTH, preview_width, - MMCAM_CAPTURE_HEIGHT, preview_height, - NULL); + MMCAM_CAPTURE_WIDTH, preview_width, + MMCAM_CAPTURE_HEIGHT, preview_height, + NULL); handle->capture_resolution_modified = true; } } @@ -756,24 +973,33 @@ int camera_start_continuous_capture(camera_h camera, int count, int interval, ca } int camera_stop_continuous_capture(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_is_supported_continuous_capture(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + camera_s *handle = (camera_s*)camera; + int ret; camera_state_e state; camera_get_state(camera, &state); + if( state != CAMERA_STATE_CAPTURING && handle->capture_count > 1 ){ - LOGE( "[%s] INVALID_STATE(0x%08x)",__func__,CAMERA_ERROR_INVALID_STATE); + LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, "capture-break-cont-shot", 1, NULL); - if( ret == 0){ + if( ret == MM_ERROR_NONE ){ handle->is_continuous_shot_break = true; - if( handle->current_capture_count > 0 ) + if( handle->current_capture_count > 0 ){ handle->is_capture_completed = true; + } g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __capture_completed_event_cb, handle, NULL); } @@ -781,88 +1007,144 @@ int camera_stop_continuous_capture(camera_h camera){ } bool camera_is_supported_face_detection(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return false; } - int ret; - camera_s * handle = (camera_s*)camera; + + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo info; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_DETECT_MODE , &info); - int i=0; - if( info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY){ - for( i =0; i < info.int_array.count ; i++){ - if( info.int_array.array[i] == MM_CAMCORDER_DETECT_MODE_ON ) + set_last_result(__convert_camera_error_code(__func__, ret)); + if( ret != MM_ERROR_NONE ){ + LOGE("MMCAM_DETECT_MODE get attr info failed"); + return false; + } + + if( info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY ){ + for( i = 0 ; i < info.int_array.count ; i++ ){ + if( info.int_array.array[i] == MM_CAMCORDER_DETECT_MODE_ON ){ + LOGD("face detection supported"); return true; + } } } + + LOGD("face detection NOT supported"); + return false; } bool camera_is_supported_zero_shutter_lag(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + int ret = MM_ERROR_NONE; + int supported_zsl = false; + camera_s *handle = (camera_s *)camera; + + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return false; } - int ret; - camera_s * handle = (camera_s*)camera; - MMCamAttrsInfo info; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT , &info); - int i=0; - if( info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY){ - for( i =0; i < info.int_array.count ; i++){ - if( info.int_array.array[i] == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) - return true; - } + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, NULL); + set_last_result(__convert_camera_error_code(__func__, ret)); + if( ret != MM_ERROR_NONE ){ + LOGE("MMCAM_SUPPORT_ZSL_CAPTURE get failed"); + return false; } - return false; + + LOGD("support zero shutter lag : %d", supported_zsl); + + return supported_zsl; +} + +bool camera_is_supported_media_packet_preview_cb(camera_h camera){ + int ret = MM_ERROR_NONE; + int supported = false; + camera_s *handle = (camera_s *)camera; + + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return false; + } + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, &supported, + NULL); + set_last_result(__convert_camera_error_code(__func__, ret)); + if( ret != MM_ERROR_NONE ){ + LOGE("MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB get failed"); + return false; + } + + LOGD("support media packet preview callback : %d", supported); + + return supported; } -int camera_get_device_count(camera_h camera, int *device_count) { +int camera_get_device_count(camera_h camera, int *device_count){ int ret = MM_ERROR_NONE; camera_s *handle = (camera_s *)camera; - if (camera == NULL || device_count == NULL) { - LOGE("[%s] INVALID_PARAMETER(0x%08x)", __func__, CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || device_count == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_DEVICE_COUNT, device_count, - NULL); + MMCAM_CAMERA_DEVICE_COUNT, device_count, + NULL); return __convert_camera_error_code(__func__, ret); } int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void * user_data){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_is_supported_face_detection(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + camera_s * handle = (camera_s*)camera; camera_state_e state = CAMERA_STATE_NONE; int ret; camera_get_state(camera, &state); if( state != CAMERA_STATE_PREVIEW ){ - LOGE( "[%s] INVALID_STATE(0x%08x)",__func__,CAMERA_ERROR_INVALID_STATE); + LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_ON, NULL); - if( ret == 0 ){ + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_ON, + NULL); + if( ret == MM_ERROR_NONE ){ handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION] = (void*)callback; handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION] = (void*)user_data; handle->num_of_faces = 0; } + return __convert_camera_error_code(__func__,ret); } int camera_stop_face_detection(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s * handle = (camera_s*)camera; int ret; + + if( camera_is_supported_face_detection(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_OFF, NULL); handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL; handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL; @@ -870,53 +1152,9 @@ int camera_stop_face_detection(camera_h camera){ return __convert_camera_error_code(__func__,ret); } -int camera_face_zoom(camera_h camera, int face_id){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; - } - camera_s * handle = (camera_s*)camera; - int ret; - int find = -1; - int i; - int current_mode; - - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FACE_ZOOM_MODE , ¤t_mode, NULL); - - if( current_mode == MM_CAMCORDER_FACE_ZOOM_MODE_ON ) - return CAMERA_ERROR_INVALID_STATE; - - for( i = 0 ; i < handle->num_of_faces ; i++){ - if( handle->faceinfo[i].id == face_id ){ - find = i; - break; - } - } - if( find == -1 ) - return CAMERA_ERROR_INVALID_PARAMETER; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_ON, - MMCAM_CAMERA_FACE_ZOOM_X, handle->faceinfo[find].x+(handle->faceinfo[find].width>>1), - MMCAM_CAMERA_FACE_ZOOM_Y, handle->faceinfo[find].y+(handle->faceinfo[find].height>>1), - NULL); - - return __convert_camera_error_code(__func__,ret); -} - -int camera_cancel_face_zoom(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; - } - camera_s * handle = (camera_s*)camera; - int ret; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_OFF, NULL); - return __convert_camera_error_code(__func__,ret); -} - - int camera_get_state(camera_h camera, camera_state_e * state){ - if( camera == NULL || state == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || state == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -927,22 +1165,23 @@ int camera_get_state(camera_h camera, camera_state_e * state){ capi_state = __camera_state_convert(mmstate); - if( ( handle->state == CAMERA_STATE_CAPTURED || handle->is_capture_completed ) && mmstate == MM_CAMCORDER_STATE_CAPTURING ) + if( (handle->state == CAMERA_STATE_CAPTURED || handle->is_capture_completed) && (handle->current_capture_count > 0 || handle->is_capture_completed) && mmstate == MM_CAMCORDER_STATE_CAPTURING ){ capi_state = CAMERA_STATE_CAPTURED; + } *state = capi_state; return CAMERA_ERROR_NONE; } int camera_start_focusing( camera_h camera, bool continuous ){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s *handle = (camera_s*)camera; - if( handle->cached_focus_mode != -1){ - LOGD("[%s] apply cached focus mode %d", __func__, handle->cached_focus_mode); + if( handle->cached_focus_mode != -1 ){ + LOGD("apply cached focus mode %d", handle->cached_focus_mode); mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_AF_SCAN_RANGE , handle->cached_focus_mode, NULL); handle->cached_focus_mode = -1; } @@ -957,14 +1196,16 @@ int camera_start_focusing( camera_h camera, bool continuous ){ int __camera_start_continuous_focusing(camera_h camera){ if( camera == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s *handle = (camera_s*)camera; int ret; int mode; handle->on_continuous_focusing = true; ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , &mode, NULL); + if( mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS ) ret = mm_camcorder_start_focusing(handle->mm_handle); else @@ -972,9 +1213,9 @@ int __camera_start_continuous_focusing(camera_h camera){ return __convert_camera_error_code(__func__, ret); } -int camera_cancel_focusing( camera_h camera ){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_cancel_focusing(camera_h camera){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s *handle = (camera_s*)camera; @@ -982,109 +1223,121 @@ int camera_cancel_focusing( camera_h camera ){ return __convert_camera_error_code(__func__, mm_camcorder_stop_focusing(handle->mm_handle)); } int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display){ - if( camera == 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; - handle->display_handle = display; - handle->display_type = type; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, - MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD, - MMCAM_DISPLAY_SURFACE ,type, NULL ); - if( ret == 0 && type != CAMERA_DISPLAY_TYPE_NONE) - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, - MMCAM_DISPLAY_HANDLE , type == CAMERA_DISPLAY_TYPE_X11 ? &handle->display_handle : display , sizeof(display) , - NULL); - return __convert_camera_error_code(__func__, ret); -} + int ret = MM_ERROR_NONE; + int set_surface = MM_DISPLAY_SURFACE_X; + void *set_handle = NULL; + camera_s *handle = NULL; -int camera_set_preview_resolution(camera_h camera, int width, int height){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + Evas_Object *obj = NULL; + const char *object_type = NULL; + + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_WIDTH , width ,MMCAM_CAMERA_HEIGHT ,height, NULL); - return __convert_camera_error_code(__func__, ret); -} -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); + + if( type != CAMERA_DISPLAY_TYPE_NONE && display == NULL ){ + LOGE("display type[%d] is not NONE, but display handle is NULL", type); return CAMERA_ERROR_INVALID_PARAMETER; } - if( rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270 ) - return CAMERA_ERROR_INVALID_PARAMETER; + handle = (camera_s *)camera; + handle->display_type = type; - int ret; - camera_s * handle = (camera_s*)camera; + if( type == CAMERA_DISPLAY_TYPE_NONE ){ + /* NULL surface */ + set_surface = MM_DISPLAY_SURFACE_NULL; + handle->display_handle = 0; + + LOGD("display type NONE"); + } else { + obj = (Evas_Object *)display; + object_type = evas_object_type_get(obj); + if( object_type ){ + if( type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win") ){ + /* x window overlay surface */ + handle->display_handle = (void *)elm_win_xwindow_get(obj); + set_surface = MM_DISPLAY_SURFACE_X; + set_handle = &(handle->display_handle); + + LOGD("display type OVERLAY : handle %p, %d", set_handle, (int)handle->display_handle); + } else if( type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image") ) { + /* evas object surface */ + handle->display_handle = display; + set_surface = MM_DISPLAY_SURFACE_EVAS; + set_handle = display; + + LOGD("display type EVAS : handle %p", set_handle); + } else { + LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type); + return CAMERA_ERROR_INVALID_PARAMETER; + } + } else { + LOGE("failed to get evas object type from %p", obj); + return CAMERA_ERROR_INVALID_PARAMETER; + } + } - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_ROTATION , rotation, NULL); - return __convert_camera_error_code(__func__, ret); -} + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD, + MMCAM_DISPLAY_SURFACE, set_surface, + NULL); -int camera_set_x11_display_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( ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE ){ + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *), NULL); } - if( flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH ) - return CAMERA_ERROR_INVALID_PARAMETER; - - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_FLIP , flip, NULL); return __convert_camera_error_code(__func__, ret); } -int camera_get_x11_display_flip(camera_h camera, camera_flip_e *flip){ - if( camera == NULL || flip == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_set_preview_resolution(camera_h camera, int width, int height){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_DISPLAY_FLIP , flip, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_WIDTH , width ,MMCAM_CAMERA_HEIGHT ,height, NULL); return __convert_camera_error_code(__func__, ret); } int camera_set_capture_resolution(camera_h camera, int width, int height){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAPTURE_WIDTH, width ,MMCAM_CAPTURE_HEIGHT , height, NULL); - if( ret == 0 ){ + + if( ret == MM_ERROR_NONE ){ handle->capture_width = width; handle->capture_height = height; } + return __convert_camera_error_code(__func__, ret); } int camera_set_capture_format(camera_h camera, camera_pixel_format_e format){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAPTURE_FORMAT, format , NULL); + return __convert_camera_error_code(__func__, ret); } int camera_set_preview_format(camera_h camera, camera_pixel_format_e format){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; @@ -1093,33 +1346,58 @@ int camera_set_preview_format(camera_h camera, camera_pixel_format_e format){ MMCamAttrsInfo supported_format; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT , &supported_format); int i; - for( i=0 ; i < supported_format.int_array.count ; i++){ + for( i=0 ; i < supported_format.int_array.count ; i++ ){ if( supported_format.int_array.array[i] == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) supported_ITLV_UYVY = true; } - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FORMAT, supported_ITLV_UYVY ? MM_PIXEL_FORMAT_ITLV_JPEG_UYVY : MM_PIXEL_FORMAT_UYVY , NULL); - }else + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FORMAT, supported_ITLV_UYVY ? MM_PIXEL_FORMAT_ITLV_JPEG_UYVY : MM_PIXEL_FORMAT_UYVY, + NULL); + } else { ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FORMAT, format , NULL); + } return __convert_camera_error_code(__func__, ret); } int camera_get_preview_resolution(camera_h camera, int *width, int *height){ - if( camera == NULL || width == NULL || height == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || width == NULL || height == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_WIDTH , width,MMCAM_CAMERA_HEIGHT, height, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_WIDTH, width, + MMCAM_CAMERA_HEIGHT, height, + NULL); + return __convert_camera_error_code(__func__, ret); +} + +int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( 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_DISPLAY_ROTATION, rotation, + NULL); + + return __convert_camera_error_code(__func__, ret); } -int camera_get_x11_display_rotation( camera_h camera, camera_rotation_e *rotation){ +int camera_get_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); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1130,21 +1408,60 @@ int camera_get_x11_display_rotation( camera_h camera, camera_rotation_e *rotati return __convert_camera_error_code(__func__, ret); } -int camera_set_x11_display_visible(camera_h camera, bool visible){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_set_display_flip(camera_h camera, camera_flip_e flip){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( flip > CAMERA_FLIP_BOTH ) + return CAMERA_ERROR_INVALID_PARAMETER; + + int ret; + camera_s * handle = (camera_s*)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_FLIP, flip, + NULL); + + return __convert_camera_error_code(__func__, ret); +} + +int camera_get_display_flip(camera_h camera, camera_flip_e *flip){ + if( camera == NULL || flip == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_DISPLAY_FLIP, flip, + NULL); + + return __convert_camera_error_code(__func__, ret); +} + +int camera_set_display_visible(camera_h camera, bool visible){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_VISIBLE , visible, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_VISIBLE, visible, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_is_x11_display_visible(camera_h camera, bool* visible){ - if( camera == NULL || visible == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_is_display_visible(camera_h camera, bool* visible){ + if( camera == NULL || visible == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1152,196 +1469,293 @@ int camera_is_x11_display_visible(camera_h camera, bool* visible){ int result; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_VISIBLE , &result, NULL); - if( ret == 0) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_VISIBLE, &result, + NULL); + + if( ret == MM_ERROR_NONE) *visible = result; + return __convert_camera_error_code(__func__, ret); } -int camera_set_x11_display_mode( camera_h camera , camera_display_mode_e ratio){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_set_display_mode(camera_h camera, camera_display_mode_e mode){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( ratio < CAMERA_DISPLAY_MODE_LETTER_BOX || ratio > CAMERA_DISPLAY_MODE_CROPPED_FULL ) + if( mode > CAMERA_DISPLAY_MODE_CROPPED_FULL ) return CAMERA_ERROR_INVALID_PARAMETER; int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_GEOMETRY_METHOD , ratio, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_GEOMETRY_METHOD, mode, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_get_x11_display_mode( camera_h camera , camera_display_mode_e* ratio){ - if( camera == NULL || ratio == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_get_display_mode(camera_h camera, camera_display_mode_e* mode){ + if( camera == NULL || mode == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_DISPLAY_GEOMETRY_METHOD , ratio, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_GEOMETRY_METHOD, mode, + NULL); + return __convert_camera_error_code(__func__, ret); } - int camera_get_capture_resolution(camera_h camera, int *width, int *height){ if( camera == NULL || width== NULL || height == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s * handle = (camera_s*)camera; *width = handle->capture_width; *height = handle->capture_height; + return CAMERA_ERROR_NONE; } int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format){ - if( camera == NULL || format == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || format == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_CAPTURE_FORMAT, format , NULL); + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAPTURE_FORMAT, format, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format){ - if( camera == NULL || format == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || format == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_FORMAT, format , NULL); + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FORMAT, format, + NULL); + if( (MMPixelFormatType)*format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) *format = CAMERA_PIXEL_FORMAT_UYVY; + return __convert_camera_error_code(__func__, ret); } -int camera_set_preview_cb( camera_h camera, camera_preview_cb callback, void* user_data ){ - if( camera == NULL || callback == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void* user_data){ + if( camera == NULL || callback == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] = (void*)callback; handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW] = (void*)user_data; - mm_camcorder_set_video_stream_callback( handle->mm_handle, (mm_camcorder_video_stream_callback)__mm_videostream_callback, (void*)handle); + + mm_camcorder_set_video_stream_callback(handle->mm_handle, + (mm_camcorder_video_stream_callback)__mm_videostream_callback, + (void *)handle); + return CAMERA_ERROR_NONE; } + int camera_unset_preview_cb( camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - mm_camcorder_set_video_stream_callback( handle->mm_handle, (mm_camcorder_video_stream_callback)NULL, (void*)NULL); - handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] = (void*)NULL; - handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW] = (void*)NULL; + + camera_s *handle = (camera_s *)camera; + + if( handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL ){ + mm_camcorder_set_video_stream_callback(handle->mm_handle, + (mm_camcorder_video_stream_callback)NULL, + (void *)NULL); + } + + handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL; + + return CAMERA_ERROR_NONE; +} + +int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void* user_data){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( camera_is_supported_media_packet_preview_cb(camera) == false ){ + LOGE("NOT SUPPORTED"); + return CAMERA_ERROR_NOT_SUPPORTED; + } + + if( callback == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + camera_s *handle = (camera_s *)camera; + handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)callback; + handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)user_data; + + mm_camcorder_set_video_stream_callback(handle->mm_handle, + (mm_camcorder_video_stream_callback)__mm_videostream_callback, + (void *)handle); + + return CAMERA_ERROR_NONE; +} + +int camera_unset_media_packet_preview_cb(camera_h camera){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( camera_is_supported_media_packet_preview_cb(camera) == false ){ + LOGE("NOT SUPPORTED"); + return CAMERA_ERROR_NOT_SUPPORTED; + } + + camera_s *handle = (camera_s *)camera; + + if( handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] == NULL ){ + mm_camcorder_set_video_stream_callback(handle->mm_handle, + (mm_camcorder_video_stream_callback)NULL, + (void*)NULL); + } + + handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void*)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void*)NULL; + return CAMERA_ERROR_NONE; } int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void* user_data){ - if( camera == NULL || callback == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || callback == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)callback; handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)user_data; + return CAMERA_ERROR_NONE; } int camera_unset_state_changed_cb(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)NULL; handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)NULL; + return CAMERA_ERROR_NONE; } int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data){ - if( camera == NULL || callback == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || callback == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)callback; handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)user_data; + return CAMERA_ERROR_NONE; } int camera_unset_interrupted_cb(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)NULL; handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)NULL; + return CAMERA_ERROR_NONE; } int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void* user_data){ - if( camera == NULL || callback == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || callback == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)callback; handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)user_data; + return CAMERA_ERROR_NONE; } int camera_unset_focus_changed_cb(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)NULL; handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)NULL; + return CAMERA_ERROR_NONE; } int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data){ - if( camera == NULL || callback == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || callback == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void*)callback; handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void*)user_data; + return CAMERA_ERROR_NONE; } int camera_unset_error_cb(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void*)NULL; handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void*)NULL; + return CAMERA_ERROR_NONE; } int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1356,17 +1770,17 @@ int camera_foreach_supported_preview_resolution(camera_h camera, camera_supporte return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < preview_width.int_array.count ; i++) - { - if ( !foreach_cb(preview_width.int_array.array[i], preview_height.int_array.array[i],user_data) ) + for( i=0 ; i < preview_width.int_array.count ; i++ ){ + if( !foreach_cb(preview_width.int_array.array[i], preview_height.int_array.array[i],user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } + int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data){ if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } int ret; @@ -1390,7 +1804,7 @@ int camera_foreach_supported_capture_resolution(camera_h camera, camera_supporte int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data){ if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1403,22 +1817,21 @@ int camera_foreach_supported_capture_format(camera_h camera, camera_supported_ca return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < format.int_array.count ; i++) - { + for( i=0 ; i < format.int_array.count ; i++ ){ if( format.int_array.array[i] != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) if ( !foreach_cb(format.int_array.array[i], user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } - int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo format; @@ -1428,20 +1841,18 @@ int camera_foreach_supported_preview_format(camera_h camera, camera_supported_pr return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < format.int_array.count ; i++) - { + for( i=0 ; i < format.int_array.count ; i++ ){ if( format.int_array.array[i] != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY /* || format.int_array.array[i] != MM_PIXEL_FORMAT_ITLV_JPEG_NV12 */) if ( !foreach_cb(format.int_array.array[i], user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } - int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height){ - if( camera == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || width == NULL || height == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1453,31 +1864,43 @@ int camera_get_recommended_preview_resolution(camera_h camera, int *width, int * camera_get_capture_resolution(camera, &capture_w, &capture_h); ratio = (double)capture_w/(double)capture_h; - if( ratio > 1.5 ) + if( ratio > 1.5 ){ wide = MM_CAMCORDER_PREVIEW_TYPE_WIDE; - else + } else if( ratio == 1.0 ){ + wide = MM_CAMCORDER_PREVIEW_TYPE_SQUARE; + } else { wide = MM_CAMCORDER_PREVIEW_TYPE_NORMAL; + } MMCamAttrsInfo width_info, height_info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_RECOMMEND_CAMERA_WIDTH , &width_info); ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_RECOMMEND_CAMERA_HEIGHT, &height_info); + if( ret != 0 ) return __convert_camera_error_code(__func__, ret); - if( width ) + if( width && (unsigned int)width_info.int_array.count > wide ){ *width = width_info.int_array.array[wide]; + } else { + LOGE("there is no width value for resolution %dx%d type %d", capture_w, capture_h, wide); + return CAMERA_ERROR_INVALID_OPERATION; + } - if( height ) + if( height && (unsigned int)height_info.int_array.count > wide ){ *height = height_info.int_array.array[wide]; + } else { + LOGE("there is no height value for resolution %dx%d type %d", capture_w, capture_h, wide); + return CAMERA_ERROR_INVALID_OPERATION; + } + + LOGI("recommend resolution %dx%d, type %d", *width, *height, wide); return CAMERA_ERROR_NONE; } - - -int camera_attr_get_lens_orientation(camera_h camera, int *angle) { - if( camera == NULL || angle == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_attr_get_lens_orientation(camera_h camera, int *angle){ + if( camera == NULL || angle == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1486,7 +1909,7 @@ int camera_attr_get_lens_orientation(camera_h camera, int *angle) { int rotation; ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation , NULL); - switch( rotation ) { + switch( rotation ){ case MM_DISPLAY_ROTATION_NONE: *angle = 0; break; @@ -1499,156 +1922,197 @@ int camera_attr_get_lens_orientation(camera_h camera, int *angle) { case MM_DISPLAY_ROTATION_270: *angle = 90; break; + default : + *angle = 0; + break; } return __convert_camera_error_code(__func__, ret); } int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_MODE, mode, NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode){ - if( camera == NULL || mode == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || mode == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_DISPLAY_MODE , mode, NULL); + return __convert_camera_error_code(__func__, ret); } +int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data){ + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo info; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_DISPLAY_MODE , &info); + + if( ret != CAMERA_ERROR_NONE ) + return __convert_camera_error_code(__func__, ret); + + int i; + for (i=0 ; i < info.int_array.count ; i++ ){ + if ( !foreach_cb(info.int_array.array[i],user_data) ) + break; + } + + return CAMERA_ERROR_NONE; +} + int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; if( fps == CAMERA_ATTR_FPS_AUTO ){ - MMCamAttrsInfo info; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FPS , &info); - int maxfps = 0; - int i; - for( i=0 ; i < info.int_array.count ; i++) - { - if ( info.int_array.array[i] > maxfps && info.int_array.array[i] <= 60 ) - maxfps = info.int_array.array[i]; - } - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FPS_AUTO , 1, MMCAM_CAMERA_FPS, maxfps , NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FPS_AUTO, 1, + NULL); + } else { + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FPS_AUTO, 0, + MMCAM_CAMERA_FPS, fps, + NULL); } - else - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FPS_AUTO , 0, MMCAM_CAMERA_FPS , fps, NULL); return __convert_camera_error_code(__func__, ret); - } - int camera_attr_set_image_quality(camera_h camera, int quality){ - - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } int ret; camera_s * handle = (camera_s*)camera; ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_IMAGE_ENCODER_QUALITY , quality, NULL); - return __convert_camera_error_code(__func__, ret); + return __convert_camera_error_code(__func__, ret); } + int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps){ - if( camera == NULL || fps == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || fps == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; int mm_fps; int is_auto; camera_s * handle = (camera_s*)camera; ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FPS , &mm_fps, MMCAM_CAMERA_FPS_AUTO , &is_auto, NULL); + if( is_auto ) *fps = CAMERA_ATTR_FPS_AUTO; else *fps = mm_fps; return __convert_camera_error_code(__func__, ret); - } + int camera_attr_get_image_quality(camera_h camera, int *quality){ - if( camera == NULL || quality == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || quality == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_IMAGE_ENCODER_QUALITY , quality, NULL); - return __convert_camera_error_code(__func__, ret); + return __convert_camera_error_code(__func__, ret); } - int camera_attr_set_zoom(camera_h camera, int zoom){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_DIGITAL_ZOOM , zoom, NULL); - return __convert_camera_error_code(__func__, ret); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret = CAMERA_ERROR_INVALID_PARAMETER; camera_s * handle = (camera_s*)camera; + int focus_mode; bool should_change_focus_mode = false; - mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE, &focus_mode, NULL); + mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FOCUS_MODE, &focus_mode, + NULL); + if( focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO && focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && focus_mode != MM_CAMCORDER_FOCUS_MODE_AUTO ) should_change_focus_mode = true; - if( mode != CAMERA_ATTR_AF_NONE && focus_mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && !handle->on_continuous_focusing){ + if( mode != CAMERA_ATTR_AF_NONE && focus_mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && !handle->on_continuous_focusing ){ handle->cached_focus_mode = mode; - LOGD("[%s] af mode will be set actually start focusing",__func__); + LOGD("af mode will be set actually start focusing"); return __convert_camera_error_code(__func__, 0); - }else + } else { handle->cached_focus_mode = -1; + } if( mode != CAMERA_ATTR_AF_NONE && should_change_focus_mode ){ mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_AUTO, NULL); } - switch(mode){ + switch( 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); + 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_NONE, + NULL); break; case CAMERA_ATTR_AF_NORMAL: - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_NORMAL, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + 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_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_MACRO, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + 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_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_FULL, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_FULL, + NULL); break; default: return ret; @@ -1658,46 +2122,50 @@ int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode){ } int camera_attr_set_af_area(camera_h camera, int x, int y){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret = CAMERA_ERROR_INVALID_PARAMETER; camera_s * handle = (camera_s*)camera; camera_attr_af_mode_e mode; camera_attr_get_af_mode(camera, &mode); + if( mode == CAMERA_ATTR_AF_NONE ){ - LOGE( "[%s] INVALID_OPERATION(0x%08x) AF mode is CAMERA_ATTR_AF_NONE",__func__,CAMERA_ERROR_INVALID_OPERATION); + LOGE("INVALID_OPERATION(0x%08x) AF mode is CAMERA_ATTR_AF_NONE",CAMERA_ERROR_INVALID_OPERATION); return CAMERA_ERROR_INVALID_OPERATION; } + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_AF_TOUCH_X, x, - MMCAM_CAMERA_AF_TOUCH_Y, y, - NULL); - if( ret == 0 ) + MMCAM_CAMERA_AF_TOUCH_X, x, + MMCAM_CAMERA_AF_TOUCH_Y, y, + NULL); + + if( ret == MM_ERROR_NONE ) handle->focus_area_valid = true; + return __convert_camera_error_code(__func__, ret); } int camera_attr_clear_af_area(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__, CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s * handle = (camera_s*)camera; - if( !handle->focus_area_valid ){ - LOGE( "[%s] INVALID_OPERATION(0x%08x) AF area was not set",__func__,CAMERA_ERROR_INVALID_OPERATION); - return CAMERA_ERROR_INVALID_OPERATION; - } handle->focus_area_valid = false; - return 0; + + return CAMERA_ERROR_NONE; } int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + 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 @@ -1707,197 +2175,245 @@ int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_EXPOSURE_MODE , maptable[abs(mode%5)], NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_EXPOSURE_MODE, maptable[abs(mode%5)], + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_exposure(camera_h camera, int value){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_EXPOSURE_VALUE , value, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_EXPOSURE_VALUE, value, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_ISO , iso, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_ISO, iso, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_brightness(camera_h camera, int level){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_brightness(camera_h camera, int level){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_FILTER_BRIGHTNESS , level, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_BRIGHTNESS, level, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_contrast(camera_h camera, int level){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_attr_set_contrast(camera_h camera, int level){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_FILTER_CONTRAST , level, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_CONTRAST, level, + NULL); return __convert_camera_error_code(__func__, ret); - } -int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_FILTER_WB , wb, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_WB, wb, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_FILTER_COLOR_TONE , effect, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_COLOR_TONE, effect, + NULL); + return __convert_camera_error_code(__func__, ret); } + int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_FILTER_SCENE_MODE , mode, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_SCENE_MODE, mode, + NULL); + return __convert_camera_error_code(__func__, ret); } - int camera_attr_enable_tag(camera_h camera, bool enable){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TAG_ENABLE , enable, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_TAG_ENABLE, enable, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_tag_image_description(camera_h camera, const char *description){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TAG_IMAGE_DESCRIPTION , description, strlen(description), NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_TAG_IMAGE_DESCRIPTION, description, strlen(description), + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TAG_ORIENTATION , orientation, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_TAG_ORIENTATION, orientation, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_tag_software(camera_h camera, const char *software){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TAG_SOFTWARE , software, strlen(software), NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_TAG_SOFTWARE, software, strlen(software), + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TAG_GPS_ENABLE, 1, - MMCAM_TAG_LATITUDE, latitude, - MMCAM_TAG_LONGITUDE, longitude, - MMCAM_TAG_ALTITUDE, altitude, - NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_TAG_GPS_ENABLE, 1, + MMCAM_TAG_LATITUDE, latitude, + MMCAM_TAG_LONGITUDE, longitude, + MMCAM_TAG_ALTITUDE, altitude, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_remove_geotag(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_TAG_GPS_ENABLE, 0, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_TAG_GPS_ENABLE, 0, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode){ + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_STROBE_MODE , mode, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_STROBE_MODE, mode, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_zoom(camera_h camera, int *zoom){ - if( camera == NULL || zoom == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); +int camera_attr_get_zoom(camera_h camera, int *zoom){ + if( camera == NULL || zoom == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_DIGITAL_ZOOM , zoom, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_DIGITAL_ZOOM, zoom, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_zoom_range(camera_h camera , int *min , int *max){ +int camera_attr_get_zoom_range(camera_h camera, int *min, int *max){ if( camera == NULL || min == NULL || max == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1905,6 +2421,7 @@ int camera_attr_get_zoom_range(camera_h camera , int *min , int *max){ camera_s * handle = (camera_s*)camera; MMCamAttrsInfo ainfo; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_DIGITAL_ZOOM, &ainfo); + if( min ) *min = ainfo.int_range.min; if( max ) @@ -1913,10 +2430,9 @@ int camera_attr_get_zoom_range(camera_h camera , int *min , int *max){ return __convert_camera_error_code(__func__, ret); } - int camera_attr_get_af_mode( camera_h camera, camera_attr_af_mode_e *mode){ - if( camera == NULL || mode == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || mode == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1925,41 +2441,52 @@ int camera_attr_get_af_mode( camera_h camera, camera_attr_af_mode_e *mode){ int af_range; int detect_mode; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , &focus_mode, MMCAM_CAMERA_AF_SCAN_RANGE , &af_range, MMCAM_DETECT_MODE , &detect_mode, NULL); - if( ret == CAMERA_ERROR_NONE){ + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FOCUS_MODE, &focus_mode, + MMCAM_CAMERA_AF_SCAN_RANGE, &af_range, + MMCAM_DETECT_MODE, &detect_mode, + NULL); + + if( ret == CAMERA_ERROR_NONE ){ switch( focus_mode ){ - case MM_CAMCORDER_FOCUS_MODE_NONE : - case MM_CAMCORDER_FOCUS_MODE_PAN : - case MM_CAMCORDER_FOCUS_MODE_MANUAL : - *mode = CAMERA_ATTR_AF_NONE; + case MM_CAMCORDER_FOCUS_MODE_NONE : + case MM_CAMCORDER_FOCUS_MODE_PAN : + case MM_CAMCORDER_FOCUS_MODE_MANUAL : + *mode = CAMERA_ATTR_AF_NONE; + break; + case MM_CAMCORDER_FOCUS_MODE_AUTO: + case MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO: + case MM_CAMCORDER_FOCUS_MODE_CONTINUOUS: + switch ( af_range ){ + case MM_CAMCORDER_AUTO_FOCUS_NONE : + *mode = CAMERA_ATTR_AF_NORMAL; break; - case MM_CAMCORDER_FOCUS_MODE_AUTO: - case MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO: - case MM_CAMCORDER_FOCUS_MODE_CONTINUOUS: - switch ( af_range ){ - case MM_CAMCORDER_AUTO_FOCUS_NONE : - *mode = CAMERA_ATTR_AF_NORMAL; - break; - case MM_CAMCORDER_AUTO_FOCUS_NORMAL: - *mode = CAMERA_ATTR_AF_NORMAL; - break; - case MM_CAMCORDER_AUTO_FOCUS_MACRO: - *mode = CAMERA_ATTR_AF_MACRO; - break; - case MM_CAMCORDER_AUTO_FOCUS_FULL: - *mode = CAMERA_ATTR_AF_FULL; - break; - } + case MM_CAMCORDER_AUTO_FOCUS_NORMAL: + *mode = CAMERA_ATTR_AF_NORMAL; + break; + case MM_CAMCORDER_AUTO_FOCUS_MACRO: + *mode = CAMERA_ATTR_AF_MACRO; break; + case MM_CAMCORDER_AUTO_FOCUS_FULL: + *mode = CAMERA_ATTR_AF_FULL; + break; + default : + *mode = CAMERA_ATTR_AF_NORMAL; + break; + } + break; + default : + *mode = CAMERA_ATTR_AF_NONE; + break; } - } + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_exposure_mode( camera_h camera, camera_attr_exposure_mode_e *mode){ if( camera == NULL|| mode == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1977,30 +2504,30 @@ int camera_attr_get_exposure_mode( camera_h camera, camera_attr_exposure_mode_e int ret; int exposure_mode; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_EXPOSURE_MODE , &exposure_mode, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_EXPOSURE_MODE, &exposure_mode, NULL); if( ret == CAMERA_ERROR_NONE ){ *mode = maptable[abs(exposure_mode%9)]; } - return __convert_camera_error_code(__func__, ret); + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_exposure(camera_h camera, int *value){ - if( camera == NULL || value == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || value == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_EXPOSURE_VALUE , value, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_EXPOSURE_VALUE, value, NULL); + return __convert_camera_error_code(__func__, ret); } - int camera_attr_get_exposure_range(camera_h camera, int *min, int *max){ if( camera == NULL || min == NULL || max == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2008,6 +2535,7 @@ int camera_attr_get_exposure_range(camera_h camera, int *min, int *max){ camera_s * handle = (camera_s*)camera; MMCamAttrsInfo ainfo; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_VALUE, &ainfo); + if( min ) *min = ainfo.int_range.min; if( max ) @@ -2016,35 +2544,39 @@ int camera_attr_get_exposure_range(camera_h camera, int *min, int *max){ return __convert_camera_error_code(__func__, ret); } - int camera_attr_get_iso( camera_h camera, camera_attr_iso_e *iso){ - if( camera == NULL || iso == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || iso == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_ISO , iso, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_ISO, iso, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_brightness(camera_h camera, int *level){ - if( camera == NULL || level == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || level == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_FILTER_BRIGHTNESS , level, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_BRIGHTNESS, level, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_brightness_range(camera_h camera, int *min, int *max){ if( camera == NULL || min == NULL || max == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2052,6 +2584,7 @@ int camera_attr_get_brightness_range(camera_h camera, int *min, int *max){ camera_s * handle = (camera_s*)camera; MMCamAttrsInfo ainfo; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_BRIGHTNESS, &ainfo); + if( min ) *min = ainfo.int_range.min; if( max ) @@ -2060,23 +2593,24 @@ int camera_attr_get_brightness_range(camera_h camera, int *min, int *max){ return __convert_camera_error_code(__func__, ret); } - int camera_attr_get_contrast(camera_h camera, int *level){ - if( camera == NULL || level == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || level == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_FILTER_CONTRAST , level, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_CONTRAST, level, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_contrast_range(camera_h camera, int *min , int *max){ if( camera == NULL || min == NULL || max == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2084,6 +2618,7 @@ int camera_attr_get_contrast_range(camera_h camera, int *min , int *max){ camera_s * handle = (camera_s*)camera; MMCamAttrsInfo ainfo; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_CONTRAST, &ainfo); + if( min ) *min = ainfo.int_range.min; if( max ) @@ -2092,31 +2627,33 @@ int camera_attr_get_contrast_range(camera_h camera, int *min , int *max){ return __convert_camera_error_code(__func__, ret); } - int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb){ - if( camera == NULL || wb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || wb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_FILTER_WB , wb, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_WB, wb, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect){ - if( camera == NULL || effect == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } int ret; camera_s * handle = (camera_s*)camera; int tone; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_FILTER_COLOR_TONE , &tone, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_COLOR_TONE, &tone, + NULL); if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); @@ -2127,37 +2664,39 @@ int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect){ } int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode){ - if( camera == NULL || mode == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || mode == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_FILTER_SCENE_MODE , mode, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_FILTER_SCENE_MODE, mode, + NULL); + return __convert_camera_error_code(__func__, ret); } - int camera_attr_is_enabled_tag(camera_h camera, bool *enable){ - if( camera == NULL || enable == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || enable == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_TAG_ENABLE , enable, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_TAG_ENABLE, enable, + NULL); return __convert_camera_error_code(__func__, ret); - } int camera_attr_get_tag_image_description(camera_h camera, char **description){ - if( camera == NULL || description == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || description == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2165,7 +2704,8 @@ int camera_attr_get_tag_image_description(camera_h camera, char **description){ camera_s * handle = (camera_s*)camera; char *ndescription = NULL; int desc_size; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_TAG_IMAGE_DESCRIPTION , &ndescription, &desc_size, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, &ndescription, &desc_size, NULL); + if( ret == CAMERA_ERROR_NONE ){ if( ndescription != NULL ) *description = strdup(ndescription); @@ -2174,25 +2714,26 @@ int camera_attr_get_tag_image_description(camera_h camera, char **description){ } return __convert_camera_error_code(__func__, ret); - } int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation){ - - if( camera == NULL || orientation == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || orientation == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_TAG_ORIENTATION , orientation, NULL); - return __convert_camera_error_code(__func__, ret); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_TAG_ORIENTATION, orientation, + NULL); + return __convert_camera_error_code(__func__, ret); } + int camera_attr_get_tag_software(camera_h camera, char **software){ if( camera == NULL || software == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2200,76 +2741,82 @@ int camera_attr_get_tag_software(camera_h camera, char **software){ camera_s * handle = (camera_s*)camera; char *soft; int soft_size; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_TAG_SOFTWARE , &soft, &soft_size, NULL); + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_TAG_SOFTWARE, &soft, &soft_size, NULL); + if( ret == CAMERA_ERROR_NONE ){ if( soft != NULL ) *software = strdup(soft); else *software = strdup(""); } + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude){ - if( camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_TAG_LATITUDE , latitude, - MMCAM_TAG_LONGITUDE, longitude, - MMCAM_TAG_ALTITUDE, altitude, - NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_TAG_LATITUDE, latitude, + MMCAM_TAG_LONGITUDE, longitude, + MMCAM_TAG_ALTITUDE, altitude, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode){ - if( camera == NULL || mode == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || mode == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",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_STROBE_MODE , mode, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_STROBE_MODE, mode, + NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_foreach_supported_af_mode( camera_h camera, camera_attr_supported_af_mode_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; int i; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo af_range; MMCamAttrsInfo focus_mode; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_AF_SCAN_RANGE , &af_range); - ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FOCUS_MODE , &focus_mode); + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_AF_SCAN_RANGE, &af_range); + ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FOCUS_MODE, &focus_mode); if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); - for( i=0 ; i < af_range.int_array.count ; i++) - { - if ( !foreach_cb(af_range.int_array.array[i],user_data) ) + for( i=0 ; i < af_range.int_array.count ; i++ ) { + if( !foreach_cb(af_range.int_array.array[i],user_data) ) goto ENDCALLBACK; } ENDCALLBACK: return CAMERA_ERROR_NONE; - } int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2288,66 +2835,70 @@ int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_sup camera_s * handle = (camera_s*)camera; MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_MODE , &info); + if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < info.int_array.count ; i++) - { - if( maptable[info.int_array.array[i]] != -1){ + for( i=0 ; i < info.int_array.count ; i++ ){ + if( maptable[info.int_array.array[i]] != -1 ){ if ( !foreach_cb(maptable[info.int_array.array[i]],user_data) ) break; } } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } + int camera_attr_foreach_supported_iso( camera_h camera, camera_attr_supported_iso_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ISO , &info); + if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < info.int_array.count ; i++) - { - if ( !foreach_cb(info.int_array.array[i],user_data) ) + for( i=0 ; i < info.int_array.count ; i++ ){ + if( !foreach_cb(info.int_array.array[i],user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo info; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_WB , &info); + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_WB, &info); + if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < info.int_array.count ; i++) - { + for( i=0 ; i < info.int_array.count ; i++ ){ if ( !foreach_cb(info.int_array.array[i],user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } + int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2355,22 +2906,23 @@ int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_ camera_s * handle = (camera_s*)camera; MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_COLOR_TONE , &info); + if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < info.int_array.count ; i++) - { + for( i=0 ; i < info.int_array.count ; i++){ int effect = info.int_array.array[i]; - if ( !foreach_cb(effect,user_data) ) + if( !foreach_cb(effect,user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } + int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2378,123 +2930,176 @@ int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_suppor camera_s * handle = (camera_s*)camera; MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_SCENE_MODE , &info); + if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < info.int_array.count ; i++) - { + for( i=0 ; i < info.int_array.count ; i++){ if ( !foreach_cb(info.int_array.array[i],user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data){ if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_STROBE_MODE , &info); + if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); int i; - for( i=0 ; i < info.int_array.count ; i++) - { - if ( !foreach_cb(info.int_array.array[i],user_data) ) + for( i=0 ; i < info.int_array.count ; i++){ + if( !foreach_cb(info.int_array.array[i],user_data) ) break; } - return CAMERA_ERROR_NONE; + return CAMERA_ERROR_NONE; } + int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FPS , &info); + if( ret != CAMERA_ERROR_NONE ) return __convert_camera_error_code(__func__, ret); int i; - //if (foreach_cb(CAMERA_ATTR_FPS_AUTO, user_data) < 0 ) - // return CAMERA_ERROR_NONE; - for( i=0 ; i < info.int_array.count ; i++) - { - if ( !foreach_cb(info.int_array.array[i],user_data) ) + for( i=0 ; i < info.int_array.count ; i++){ + if( !foreach_cb(info.int_array.array[i],user_data) ) break; } + return CAMERA_ERROR_NONE; +} + +int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data){ + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo info; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FLIP , &info); + + if( ret != CAMERA_ERROR_NONE ) + return __convert_camera_error_code(__func__, ret); + + int i; + for( i=0 ; i < info.int_array.count ; i++){ + if( !foreach_cb(info.int_array.array[i], user_data) ) + break; + } + return CAMERA_ERROR_NONE; +} + +int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data){ + if( camera == NULL || foreach_cb == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo info; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ROTATION , &info); + + if( ret != CAMERA_ERROR_NONE ) + return __convert_camera_error_code(__func__, ret); + + int i; + for( i=0 ; i < info.int_array.count ; i++ ){ + if( !foreach_cb(info.int_array.array[i], user_data) ) + break; + } + + return CAMERA_ERROR_NONE; } 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); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270 ) + if( 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); + 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); + LOGE("INVALID_PARAMETER(0x%08x)",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); + 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); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH ) + if( flip > CAMERA_FLIP_BOTH ) return CAMERA_ERROR_INVALID_PARAMETER; int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FLIP , flip , NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FLIP, flip, + 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); + LOGE("INVALID_PARAMETER(0x%08x)",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_FLIP , flip , NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FLIP, flip, NULL); + return __convert_camera_error_code(__func__, ret); } int _camera_set_use(camera_h camera, bool used){ camera_s * handle = (camera_s*)camera; handle->is_used_in_recorder = used; - return 0; + return CAMERA_ERROR_NONE; } bool _camera_is_used(camera_h camera){ @@ -2502,20 +3107,20 @@ bool _camera_is_used(camera_h camera){ return handle->is_used_in_recorder; } - int _camera_get_mm_handle(camera_h camera , MMHandleType *handle){ if( camera == NULL || handle == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s *camera_handle = (camera_s*)camera; *handle = camera_handle->mm_handle; + return CAMERA_ERROR_NONE; } int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data){ if( camera == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2526,89 +3131,249 @@ int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback cal return CAMERA_ERROR_NONE; } +int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format){ + if( in_format <= MM_PIXEL_FORMAT_INVALID || + in_format >= MM_PIXEL_FORMAT_NUM || + out_format == NULL ){ + LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + switch( in_format ){ + case MM_PIXEL_FORMAT_NV12: + case MM_PIXEL_FORMAT_NV12T: + *out_format = TBM_FORMAT_NV12; + break; + case MM_PIXEL_FORMAT_NV16: + *out_format = TBM_FORMAT_NV16; + break; + case MM_PIXEL_FORMAT_NV21: + *out_format = TBM_FORMAT_NV21; + break; + case MM_PIXEL_FORMAT_YUYV: + *out_format = TBM_FORMAT_YUYV; + break; + case MM_PIXEL_FORMAT_UYVY: + case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY: + *out_format = TBM_FORMAT_UYVY; + break; + case MM_PIXEL_FORMAT_422P: + *out_format = TBM_FORMAT_YUV422; + break; + case MM_PIXEL_FORMAT_I420: + *out_format = TBM_FORMAT_YUV420; + break; + case MM_PIXEL_FORMAT_YV12: + *out_format = TBM_FORMAT_YVU420; + break; + case MM_PIXEL_FORMAT_RGB565: + *out_format = TBM_FORMAT_RGB565; + break; + case MM_PIXEL_FORMAT_RGB888: + *out_format = TBM_FORMAT_RGB888; + break; + case MM_PIXEL_FORMAT_RGBA: + *out_format = TBM_FORMAT_RGBA8888; + break; + case MM_PIXEL_FORMAT_ARGB: + *out_format = TBM_FORMAT_ARGB8888; + break; + default: + LOGE("invalid in_format %d", in_format); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + return CAMERA_ERROR_NONE; +} + +int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype){ + if( in_format <= MM_PIXEL_FORMAT_INVALID || + in_format >= MM_PIXEL_FORMAT_NUM || + mimetype == NULL ){ + LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + switch (in_format) { + case MM_PIXEL_FORMAT_NV12: + case MM_PIXEL_FORMAT_NV12T: + *mimetype = MEDIA_FORMAT_NV12; + break; + case MM_PIXEL_FORMAT_NV16: + *mimetype = MEDIA_FORMAT_NV16; + break; + case MM_PIXEL_FORMAT_NV21: + *mimetype = MEDIA_FORMAT_NV21; + break; + case MM_PIXEL_FORMAT_YUYV: + *mimetype = MEDIA_FORMAT_YUYV; + break; + case MM_PIXEL_FORMAT_UYVY: + case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY: + *mimetype = MEDIA_FORMAT_UYVY; + break; + case MM_PIXEL_FORMAT_422P: + *mimetype = MEDIA_FORMAT_422P; + break; + case MM_PIXEL_FORMAT_I420: + *mimetype = MEDIA_FORMAT_I420; + break; + case MM_PIXEL_FORMAT_YV12: + *mimetype = MEDIA_FORMAT_YV12; + break; + case MM_PIXEL_FORMAT_RGB565: + *mimetype = MEDIA_FORMAT_RGB565; + break; + case MM_PIXEL_FORMAT_RGB888: + *mimetype = MEDIA_FORMAT_RGB888; + break; + case MM_PIXEL_FORMAT_RGBA: + *mimetype = MEDIA_FORMAT_RGBA; + break; + case MM_PIXEL_FORMAT_ARGB: + *mimetype = MEDIA_FORMAT_ARGB; + break; + default: + LOGE("invalid in_format %d", in_format); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + return CAMERA_ERROR_NONE; +} + +int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data){ + int ret = 0; + void *internal_buffer = NULL; + tbm_surface_h tsurf = NULL; + + if( pkt == NULL || user_data == NULL ){ + LOGE("invalid parameter buffer %p, user_data %p", pkt, user_data); + return MEDIA_PACKET_FINALIZE; + } + + ret = media_packet_get_extra(pkt, &internal_buffer); + + if( ret != MEDIA_PACKET_ERROR_NONE ){ + LOGE("media_packet_get_extra failed 0x%x", ret); + return MEDIA_PACKET_FINALIZE; + } + + /*LOGD("pointer gst buffer %p, ret 0x%x", internal_buffer, ret);*/ + + if( internal_buffer ){ + gst_buffer_unref((GstBuffer *)internal_buffer); + internal_buffer = NULL; + } + + ret = media_packet_get_tbm_surface(pkt, &tsurf); + if( ret != MEDIA_PACKET_ERROR_NONE ){ + LOGE("media_packet_get_tbm_surface failed 0x%x", ret); + return MEDIA_PACKET_FINALIZE; + } + + if( tsurf ){ + tbm_surface_destroy(tsurf); + tsurf = NULL; + } + + return MEDIA_PACKET_FINALIZE; +} + int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_attr_is_supported_hdr_capture(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_HDR_CAPTURE , mode, NULL); - if( ret == 0 ){ + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_HDR_CAPTURE, mode, NULL); + + if( ret == MM_ERROR_NONE ){ if( mode == CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL ) handle->hdr_keep_mode = true; else handle->hdr_keep_mode = false; } + return __convert_camera_error_code(__func__, ret); } int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode){ - if( camera == NULL || mode == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - int result; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_HDR_CAPTURE , &result, NULL); - if( ret == 0 ){ - *mode = result; - } - return __convert_camera_error_code(__func__, ret); -} - -int camera_attr_enable_hdr_capture(camera_h camera, bool enable){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; + if( camera_attr_is_supported_hdr_capture(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_HDR_CAPTURE , enable, NULL); - return __convert_camera_error_code(__func__, ret); -} -int camera_attr_is_enabled_hdr_capture(camera_h camera, bool *enabled){ - if( camera == NULL || enabled == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( mode == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - mode",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; int result; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_HDR_CAPTURE , &result, NULL); - if( ret == 0 ){ - if( result >= MM_CAMCORDER_HDR_ON ) - *enabled = true; - else - *enabled = false; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_HDR_CAPTURE, &result, NULL); + + if( ret == MM_ERROR_NONE ){ + *mode = result; } + return __convert_camera_error_code(__func__, ret); } bool camera_attr_is_supported_hdr_capture(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return false; } int ret; int i; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo hdr_info; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_HDR_CAPTURE , &hdr_info); - for (i = 0; i < hdr_info.int_array.count ; i++) { - if (hdr_info.int_array.array[i] >= MM_CAMCORDER_HDR_ON) { + + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_HDR_CAPTURE, &hdr_info); + set_last_result(__convert_camera_error_code(__func__, ret)); + if( ret != MM_ERROR_NONE ){ + LOGE("MMCAM_CAMERA_HDR_CAPTURE get attr info failed"); + return false; + } + + for( i = 0; i < hdr_info.int_array.count ; i++ ){ + if( hdr_info.int_array.array[i] >= MM_CAMCORDER_HDR_ON ){ + LOGD("HDR capture supported"); return true; } } + + LOGD("HDR capture NOT supported"); + return false; } int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void* user_data){ - if( camera == NULL || callback == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( camera_attr_is_supported_hdr_capture(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + + if( callback == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -2619,152 +3384,247 @@ int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_pro } int camera_attr_unset_hdr_capture_progress_cb(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_attr_is_supported_hdr_capture(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + camera_s * handle = (camera_s*)camera; handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)NULL; handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)NULL; + return CAMERA_ERROR_NONE; } int camera_attr_enable_anti_shake(camera_h camera, bool enable){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_attr_is_supported_anti_shake(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + int ret; int mode = MM_CAMCORDER_AHS_OFF; + if( enable ) mode = MM_CAMCORDER_AHS_ON; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_ANTI_HANDSHAKE , mode, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ANTI_HANDSHAKE, mode, NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled){ - if( camera == NULL || enabled == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_attr_is_supported_anti_shake(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + + if( enabled == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + int ret; int mode = MM_CAMCORDER_AHS_OFF; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_ANTI_HANDSHAKE , &mode, NULL); - if( ret == 0 ) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ANTI_HANDSHAKE, &mode, NULL); + + if( ret == MM_ERROR_NONE ) *enabled = mode; + return __convert_camera_error_code(__func__, ret); } bool camera_attr_is_supported_anti_shake(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return false; } + int i; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo ash_info; - mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ANTI_HANDSHAKE , &ash_info); + int ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ANTI_HANDSHAKE , &ash_info); + set_last_result(__convert_camera_error_code(__func__, ret)); - for( i=0 ; i < ash_info.int_array.count ; i++) - { - if ( ash_info.int_array.array[i] == MM_CAMCORDER_AHS_ON) + for( i=0 ; i < ash_info.int_array.count ; i++ ){ + if( ash_info.int_array.array[i] == MM_CAMCORDER_AHS_ON ) return true; } + return false; } int camera_attr_enable_video_stabilization(camera_h camera, bool enable){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_attr_is_supported_video_stabilization(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + int ret; int mode = MM_CAMCORDER_VIDEO_STABILIZATION_OFF; + if( enable ) mode = MM_CAMCORDER_VIDEO_STABILIZATION_ON; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_VIDEO_STABILIZATION , mode, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_VIDEO_STABILIZATION, mode, NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled){ - if( camera == NULL || enabled == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_attr_is_supported_video_stabilization(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + + if( enabled == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + int ret; int mode = MM_CAMCORDER_VIDEO_STABILIZATION_OFF; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_VIDEO_STABILIZATION , &mode, NULL); - if( ret == 0 ) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_VIDEO_STABILIZATION, &mode, NULL); + + if( ret == MM_ERROR_NONE ) *enabled = (mode == MM_CAMCORDER_VIDEO_STABILIZATION_ON); + return __convert_camera_error_code(__func__, ret); } bool camera_attr_is_supported_video_stabilization(camera_h camera){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return false; } + int i; camera_s * handle = (camera_s*)camera; MMCamAttrsInfo vs_info; - mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_VIDEO_STABILIZATION , &vs_info); + int ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_VIDEO_STABILIZATION , &vs_info); + set_last_result(__convert_camera_error_code(__func__, ret)); - for( i=0 ; i < vs_info.int_array.count ; i++) - { - if ( vs_info.int_array.array[i] == MM_CAMCORDER_VIDEO_STABILIZATION_ON) + for( i=0 ; i < vs_info.int_array.count ; i++ ){ + if( vs_info.int_array.array[i] == MM_CAMCORDER_VIDEO_STABILIZATION_ON ) return true; } + return false; } - - int camera_attr_enable_auto_contrast(camera_h camera, bool enable){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + + if( camera_attr_is_supported_auto_contrast(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + int ret; int mode = MM_CAMCORDER_WDR_OFF; + if( enable ) mode = MM_CAMCORDER_WDR_ON; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_WDR , mode, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_WDR, mode, NULL); + return __convert_camera_error_code(__func__, ret); } int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled){ - if( camera == NULL || enabled == NULL ){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( camera_attr_is_supported_auto_contrast(camera) == false ){ + LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); + return CAMERA_ERROR_NOT_SUPPORTED; + } + + if( enabled == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; int mode = MM_CAMCORDER_WDR_OFF; camera_s * handle = (camera_s*)camera; ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_WDR , &mode, NULL); - if( ret == 0 ) + + if( ret == MM_ERROR_NONE ) *enabled = mode; + return __convert_camera_error_code(__func__, ret); } +bool camera_attr_is_supported_auto_contrast(camera_h camera) { + if( camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + return false; + } + + int i; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo info; + int ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_WDR, &info); + set_last_result(__convert_camera_error_code(__func__, ret)); + + for( i=0 ; i < info.int_array.count ; i++ ) { + if( info.int_array.array[i] == MM_CAMCORDER_WDR_ON ) + return true; + } + + return false; +} + int camera_attr_disable_shutter_sound(camera_h camera, bool disable){ - if( camera == NULL){ - LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + if (camera == NULL ){ + LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + int ret; camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, "capture-sound-enable" , !disable, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, "capture-sound-enable", !disable, NULL); + if( ret != 0 ){ - LOGE("[%s] CAMERA_ERROR_INVALID_OPERATION : not permitted disable shutter sound", __func__); + LOGE("CAMERA_ERROR_INVALID_OPERATION : not permitted disable shutter sound"); return CAMERA_ERROR_INVALID_OPERATION; } + return CAMERA_ERROR_NONE; } diff --git a/src/camera_internal.c b/src/camera_internal.c new file mode 100644 index 0000000..a452f56 --- /dev/null +++ b/src/camera_internal.c @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* 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. +*/ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <mm.h> +#include <mm_camcorder.h> +#include <mm_types.h> +#include <camera.h> +#include <camera_internal.h> +#include <camera_private.h> +#include <glib.h> +#include <dlog.h> + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "TIZEN_N_CAMERA" + + +int camera_set_x11_display_rotation(camera_h camera, camera_rotation_e rotation) +{ + return camera_set_display_rotation(camera, rotation); +} + +int camera_get_x11_display_rotation(camera_h camera, camera_rotation_e *rotation) +{ + return camera_get_display_rotation(camera, rotation); +} + +int camera_set_x11_display_flip(camera_h camera, camera_flip_e flip) +{ + return camera_set_display_flip(camera, flip); +} + +int camera_get_x11_display_flip(camera_h camera, camera_flip_e *flip) +{ + return camera_get_display_flip(camera, flip); +} + +int camera_set_x11_display_visible(camera_h camera, bool visible) +{ + return camera_set_display_visible(camera, visible); +} + +int camera_is_x11_display_visible(camera_h camera, bool* visible) +{ + return camera_is_display_visible(camera, visible); +} + +int camera_set_x11_display_mode(camera_h camera, camera_display_mode_e mode) +{ + return camera_set_display_mode(camera, mode); +} + +int camera_get_x11_display_mode(camera_h camera, camera_display_mode_e* mode) +{ + return camera_get_display_mode(camera, mode); +} + +int camera_set_x11_display_pixmap(camera_h camera, camera_x11_pixmap_updated_cb callback, void *user_data) +{ + int ret; + camera_s *handle = (camera_s*)camera; + camera_state_e capi_state; + + if (handle == NULL || callback == NULL) { + LOGE("INVALID_PARAMETER(handle:%p,callback:%p,user_data:%p)", handle, callback, user_data); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + camera_get_state(camera, &capi_state); + if (capi_state > CAMERA_STATE_CREATED) { + LOGE("INVALID STATE(state:%d)", capi_state); + return CAMERA_ERROR_INVALID_STATE; + } + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_X_EXT, + MMCAM_DISPLAY_HANDLE, callback, sizeof(unsigned int (void *)), + NULL); + + return __convert_camera_error_code(__func__, ret); +} + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 73c466c..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -SET(fw_test "${fw_name}-test") - -INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_test} REQUIRED mm-camcorder elementary evas ecore edje ecore-x) -FOREACH(flag ${${fw_test}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") - MESSAGE(${flag}) -ENDFOREACH() - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall") - -#ADD_EXECUTABLE("system-sensor" system-sensor.c) -#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS}) - -aux_source_directory(. sources) -FOREACH(src ${sources}) - GET_FILENAME_COMPONENT(src_name ${src} NAME_WE) - MESSAGE("${src_name}") - ADD_EXECUTABLE(${src_name} ${src}) - TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS}) -ENDFOREACH() diff --git a/test/multimedia_camera_test.c b/test/multimedia_camera_test.c deleted file mode 100755 index 1c65f3c..0000000 --- a/test/multimedia_camera_test.c +++ /dev/null @@ -1,1582 +0,0 @@ -/* -* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* 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. -*/ - - -#include <Elementary.h> -#include <glib.h> -#include <Ecore.h> -#include <Ecore_X.h> - -#include <stdio.h> -#include <camera.h> - -#include <assert.h> -#include <pthread.h> - -typedef struct{ - Evas_Object* win; - -}appdata; - - -Evas_Object* mEvasWindow; -Ecore_X_Window preview_win; -Evas_Object* img; - -void state_cb(camera_state_e previous , camera_state_e current , int by_asm, const void *user_data){ - char *state_table[] ={ - "CAMERA_STATE_NONE", /**< camera is not created yet */ - "CAMERA_STATE_CREATED", /**< camera is created, but not initialized yet */ - "CAMERA_STATE_PREVIEW", /**< camera is prepared to capture (Preview) */ - "CAMERA_STATE_CAPTURING", /**< While capturing*/ - "CAMERA_STATE_CAPTURED", /**< camera is now recording */ - "CAMERA_STATE_NUM", /**< Number of camera states */ - }; - printf("%s\n", state_table[current]); -} - - -void capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data) -{ - char * filepath = (char*)user_data; - FILE* f = fopen(filepath, "w+"); - bool ret; - if(f!=NULL && image !=NULL) - { - fwrite(image->data,1, image->size, f); - printf("capture(%s) %dx%d, buffer_size=%d\n", filepath, image->width, image->height, image->size); - ret = TRUE; - } - else - { - ret = FALSE; - } - fclose(f); - -} - -int capture_complete(void *user_data){ - camera_h cam = (camera_h)user_data; - - printf("capture_complete!!\n"); - - camera_start_preview(cam); - - return 1; -} - -int stillshot_test(){ - camera_h camera; - camera_create(CAMERA_DEVICE_CAMERA0, &camera); - camera_attr_set_image_quality(camera, 100); - camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - 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); - camera_set_capture_format(camera, CAMERA_PIXEL_FORMAT_JPEG); - - camera_start_preview(camera); - camera_start_focusing(camera, false); - - sleep(1); - camera_start_capture(camera, capturing_cb, NULL, "/mnt/nfs/test.jpg"); - sleep(1); - camera_start_preview(camera); - camera_stop_preview(camera); - camera_destroy(camera); - return 0; -} - -bool g_preview_fps_pass; -bool _preview_fps_cb(camera_attr_fps_e fps, void *user_data){ - int ret; - camera_attr_fps_e get_fps; - camera_h camera = (camera_h) user_data; - ret = camera_attr_set_preview_fps(camera, fps); - printf("-set preview fps %d\tret=%x\n", fps, ret); - ret = camera_attr_get_preview_fps(camera, &get_fps); - printf("-get preview fps %d\tret=%x", get_fps, ret); - - if(get_fps == fps) - printf("\t\t\tpass\n"); - else{ - printf("\t\t\tfail\n"); - g_preview_fps_pass = false; - return false; - } - return true; -} - - -int preview_fps_test(camera_h camera) -{ - g_preview_fps_pass = true; - printf("------------- PREVIEW FPS TEST -------------\n"); - camera_attr_foreach_supported_fps(camera, _preview_fps_cb,(void*)camera); - printf("--------------------------------------------\n"); - if( g_preview_fps_pass ){ - printf("PREVIEW FPS TEST PASS\n\n"); - return 0; - }else{ - printf("PREVIEW FPS TEST FAIL\n\n"); - return -1; - } -} - -int image_quality_test(camera_h camera){ - int ret1; - int ret2; - int i; - printf("------------- IMAGE QUALITY TEST -------------\n"); - for( i =-10; i <= 110 ; i+=10){ - int quality; - ret1 = camera_attr_set_image_quality(camera,i); - printf("-set image quality %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_image_quality(camera,&quality); - printf("-get image quality %d\tret=%x",quality,ret2); - - if( i >=0 && i <= 100){ - if( quality == i ){ - printf("\t\t\tpass\n"); - }else - { - printf("\t\t\tfail\n"); - return -1; - } - }else{ //out of bound error - if( ret1 == 0){ - printf("\t\t\tfail\n"); - return -1; - }else{ - printf("\t\t\tpass\n"); - } - } - - } - printf("--------------------------------------------\n"); - printf("IMAGE QUALITY TEST PASS\n\n"); - - return 0; -} - -int zoom_test(camera_h camera){ - int ret1 ; - int ret2 ; - int i; - int min, max; - printf("------------- ZOOM TEST -------------\n"); - camera_attr_get_zoom_range(camera, &min, &max); - if(max == -1 ) - return 0; - for( i = min ; i <= max; i+=5 ){ - int zoom; - ret1 = camera_attr_set_zoom(camera, i); - printf("-set zoom %d\tret=%x\n",i, ret1); - ret2 = camera_attr_get_zoom(camera,&zoom); - printf("-get zoom %d\tret=%x",zoom, ret2); - - if( i >=min && i <= max ){ - if( i == zoom ) - printf("\t\t\tpass\n"); - else{ - printf("\t\t\tfail\n"); - return -1; - } - }else{ - if( ret1 == 0 ){ - printf("\t\t\tfail\n"); - return -1; - }else{ - printf("\t\t\tpass\n"); - } - } - } - printf("--------------------------------------------\n"); - printf("ZOOM TEST PASS\n\n"); - - camera_attr_set_zoom(camera, 10); - return 0; -} - -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; - camera_attr_af_mode_e get_mode; - ret= camera_attr_set_af_mode(camera, mode); - printf("-set af mode %d\tret=%x\n", mode, ret); - ret= camera_attr_get_af_mode(camera, &get_mode); - printf("-get af mode %d\tret=%x", get_mode, ret); - if( mode != get_mode ){ - printf("\t\t\tFAIL\n"); - g_af_test_pass= false; - return false; - }else - printf("\t\t\tPASS\n"); - return true; -} - -int af_mode_test(camera_h camera){ - g_af_test_pass = true; - camera_attr_foreach_supported_af_mode(camera, _af_mode_test_cb, camera); - return g_af_test_pass ? 0 : -1; -} - -bool g_exposure_mode_pass; -bool _exposure_mode_test_cb(camera_attr_exposure_mode_e mode, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - camera_attr_exposure_mode_e get_mode; - - ret = camera_attr_set_exposure_mode(camera, mode); - printf("-set exposure mode %d\tret=%x\n", mode,ret); - ret = camera_attr_get_exposure_mode(camera,&get_mode); - printf("-get exposure mode %d\tret=%x\n", get_mode,ret); - if( get_mode != mode ){ - printf("\t\t\tFAIL\n"); - g_exposure_mode_pass = false; - return false; - }else - printf("\t\t\tPASS\n"); - return true; -} - -int exposure_mode_test(camera_h camera){ - g_exposure_mode_pass = true; - camera_attr_foreach_supported_exposure_mode(camera,_exposure_mode_test_cb, camera); - camera_attr_set_exposure_mode(camera, CAMERA_ATTR_EXPOSURE_MODE_ALL); - return g_exposure_mode_pass ? 0 : -1; -} - -int exposure_test(camera_h camera){ - int i; - int ret1, ret2; - int default_value; - int min,max; - ret1 = camera_attr_get_exposure(camera, &default_value ); - camera_attr_get_exposure_range(camera, &min, &max); - printf("exposure range %d~%d\n", min, max); - if(max == -1 ) - return 0; - for( i = 1; i < 13 ; i++ ){ - int value; - ret1 = camera_attr_set_exposure(camera, i ); - printf("-set exposure %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_exposure(camera, &value); - printf("-get exposure %d\tret=%x\n",value,ret2); - if( i >= min && i <= max ){ - if( value != i) - return -1; - }else{ // out of bound error - if( ret1 == 0 ) - return -1; - } - } - ret1 = camera_attr_set_exposure(camera, default_value ); - return 0; -} - -bool g_iso_test_pass ; -bool _iso_test_cb(camera_attr_iso_e iso, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - camera_attr_iso_e get_iso; - ret = camera_attr_set_iso(camera, iso); - printf("-set iso %d\tret=%x\n", iso, ret); - ret = camera_attr_get_iso(camera,&get_iso); - printf("-get iso %d\tret=%x\n", get_iso, ret); - if( get_iso != iso ){ - g_iso_test_pass = false; - return false; - } - return true; -} - -int iso_test(camera_h camera){ - g_iso_test_pass = true; - camera_attr_foreach_supported_iso(camera,_iso_test_cb, camera); - return g_iso_test_pass ? 0 : -1; -} - -int brightness_test(camera_h camera){ - int i; - int ret1,ret2; - int default_value; - int min,max; - ret1 = camera_attr_get_brightness(camera, &default_value ); - camera_attr_get_brightness_range(camera, &min, &max); - if(max == -1 ) - return 0; - for( i = 1; i < 13 ; i++ ){ - int value; - ret1 = camera_attr_set_brightness(camera, i ); - printf("-set brightness %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_brightness(camera, &value); - printf("-get brightness %d\tret=%x\n",value,ret2); - - if( i >= min && i <= max ){ - if( value != i) - return -1; - }else{ // out of bound error - if( ret1 == 0 ) - return -1; - } - - } - ret1 = camera_attr_set_brightness(camera, default_value ); - return 0; - -} - -int contrast_test(camera_h camera){ - int i; - int ret1,ret2; - int default_value; - int min,max; - ret1 = camera_attr_get_contrast (camera, &default_value ); - camera_attr_get_contrast_range(camera, &min, &max); - if(max == -1 ) - return 0; - for( i = 1; i < 13 ; i++ ){ - int value; - ret1 = camera_attr_set_contrast (camera, i ); - printf("-set contrast %d\tret=%x\n",i,ret1); - ret2 = camera_attr_get_contrast (camera, &value); - printf("-get contrast %d\tret=%x\n",value,ret2); - - if( i >= min && i <= max ){ - if( value != i) - return -1; - }else{ // out of bound error - if( ret1 == 0 ) - return -1; - } - } - ret1 = camera_attr_set_contrast (camera, default_value ); - return 0; -} - -bool _whitebalance_test_cb(camera_attr_whitebalance_e wb, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_whitebalance(camera, wb); - printf("-set whitebalance %d\tret=%x\n", wb,ret); - ret = camera_attr_get_whitebalance(camera,&wb); - printf("-get whitebalance %d\tret=%x\n", wb,ret); - return true; -} - - -int whitebalance_test(camera_h camera){ - camera_attr_foreach_supported_whitebalance(camera, _whitebalance_test_cb ,camera); - return 0; -} - -bool _effect_test_cb(camera_attr_effect_mode_e effect, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_effect(camera, effect); - printf("-set effect %d\tret=%x\n", effect,ret); - ret = camera_attr_get_effect(camera,&effect); - printf("-get effect %d\tret=%x\n", effect,ret); - return true; -} - - -int effect_test(camera_h camera){ - camera_attr_foreach_supported_effect(camera, _effect_test_cb, camera); - return 0; -} - - -bool _scene_mode_test_cb (camera_attr_scene_mode_e mode, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_scene_mode(camera, mode); - printf("-set scene %d\tret=%x\n", mode,ret); - ret = camera_attr_get_scene_mode(camera,&mode); - printf("-get scene %d\tret=%x\n", mode,ret); - return true; -} - -int scene_mode_test(camera_h camera){ - camera_attr_foreach_supported_scene_mode(camera, _scene_mode_test_cb, camera); - return 0; -} - -int tag_enable_test(camera_h camera){ - int ret; - bool enable; - ret = camera_attr_enable_tag(camera, true); - printf("-set enable tag true\tret=%x\n",ret); - ret = camera_attr_is_enabled_tag(camera, &enable); - printf("-get enable tag %d\tret=%x\n",enable, ret); - return 0; -} - -int tag_orientation_test(camera_h camera){ - int ret; - camera_attr_tag_orientation_e orientation; - - ret = camera_attr_set_tag_orientation(camera, 1); - printf("-set tag orientation %d\tret=%x\n",1 ,ret); - ret= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - - ret |= camera_attr_set_tag_orientation(camera, 2 ); - printf("-set tag orientation %d\tret=%x\n",2 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 3 ); - printf("-set tag orientation %d\tret=%x\n",3 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 4 ); - printf("-set tag orientation %d\tret=%x\n",4 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 5 ); - printf("-set tag orientation %d\tret=%x\n",5 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 6 ); - printf("-set tag orientation %d\tret=%x\n",6 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 7 ); - printf("-set tag orientation %d\tret=%x\n",7 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - ret |= camera_attr_set_tag_orientation(camera, 8 ); - printf("-set tag orientation %d\tret=%x\n",8 ,ret); - ret |= camera_attr_get_tag_orientation(camera, &orientation); - printf("-get tag orientation %d\tret=%x\n",orientation,ret); - - return ret == 0 ? 0 : -1; - -} - -int tag_image_description_test(camera_h camera){ - char *description; - int ret; - ret = camera_attr_set_tag_image_description(camera, "hello capi"); - printf("-set tag image description \"hello capi\"\tret=%x\n", ret); - ret = camera_attr_get_tag_image_description(camera, &description); - printf("-get tag image description \"%s\"\tret=%x\n", description, ret); - free(description); - ret = camera_attr_set_tag_image_description(camera, "12345678901234567890"); - printf("-set tag image description \"12345678901234567890\"\tret=%x\n", ret); - ret = camera_attr_get_tag_image_description(camera, &description); - printf("-get tag image description \"%s\"\tret=%x\n", description, ret); - free(description); - return 0; -} - -int tag_software_test(camera_h camera){ - char *buffer; - int ret; - ret = camera_attr_set_tag_software(camera, "hello capi"); - printf("-set tag software \"hello capi\"\tret=%x\n", ret); - ret = camera_attr_get_tag_software(camera, &buffer); - printf("-get tag software \"%s\"\tret=%x\n", buffer, ret); - free(buffer); - - ret = camera_attr_set_tag_software(camera, "12345678901234567890"); - printf("-set tag software \"12345678901234567890\"\tret=%x\n", ret); - ret = camera_attr_get_tag_software(camera, &buffer); - printf("-get tag software \"%s\"\tret=%x\n", buffer, ret); - free(buffer); - return 0; -} - - -bool _flash_mode_test_cb(camera_attr_flash_mode_e mode, void *user_data){ - camera_h camera = (camera_h) user_data; - int ret; - ret = camera_attr_set_flash_mode(camera, mode); - printf("-set flash mode %d\tret=%x\n", mode,ret); - ret = camera_attr_get_flash_mode(camera,&mode); - printf("-get flash mode %d\tret=%x\n", mode,ret); - return true; -} - - -int flash_mode_test(camera_h camera){ - camera_attr_foreach_supported_flash_mode(camera, _flash_mode_test_cb,camera); - return 0; -} - -int gps_test(camera_h camera){ - double lng = 1.12; - double lat = 1.13; - double alt = 1.14; - int ret; - ret = camera_attr_set_geotag(camera, lat, lng , alt ); - if( ret != 0) - return -1; - ret = camera_attr_get_geotag(camera, &lat , &lng , &alt); - if( ret != 0 ) - return -1; - return 0; - -} -int camera_attribute_test(){ - int ret; - 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_ROTATION_270); - printf("-----------------------create camera-----------------------------\n"); - - preview_fps_test(camera); - image_quality_test(camera); - - camera_start_preview(camera); - printf("--------------------------preview-started-----------------------------------\n"); - - ret = zoom_test(camera); - ret += af_mode_test(camera); - ret += exposure_mode_test(camera); - ret += exposure_test(camera); - ret += iso_test(camera); - ret += brightness_test(camera); - ret += contrast_test(camera); - ret += whitebalance_test(camera); - ret += effect_test(camera); - ret += scene_mode_test(camera); - ret += tag_enable_test(camera); - ret += tag_orientation_test(camera); - ret += tag_image_description_test(camera); - ret += tag_software_test(camera); - ret += flash_mode_test(camera); - ret += gps_test(camera); - - camera_stop_preview(camera); - camera_destroy(camera); - return ret; -} - - -typedef struct { - camera_h camera; - camera_pixel_format_e in_format; - bool iscalled; - bool result; -} camera_preview_test_s; - - void _camera_preview_test_cb(void *stream_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){ - camera_preview_test_s * data = (camera_preview_test_s*)user_data; - data->iscalled = true; - if( format == data->in_format ) - data->result = true; - -} - -bool _preview_format_test_cb(camera_pixel_format_e format, void *user_data){ - int *table = (int*)user_data; - table[format] = 1; - return true; -} - - -int camera_preview_test(){ - int ret; - camera_h camera ; - int i; - int timeout = 0; - camera_preview_test_s preview_test_data; - int enable_preview_format[CAMERA_PIXEL_FORMAT_JPEG+1] = {0,}; - - - 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_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); - - printf("-----------------------PREVIEW FORMAT TEST-----------------------------\n"); - - for(i =0; i<= CAMERA_PIXEL_FORMAT_JPEG ; i++){ - if( enable_preview_format[i] ){ - timeout = 5; - preview_test_data.in_format = i; - preview_test_data.camera = camera; - preview_test_data.iscalled = false; - preview_test_data.result = false; - camera_set_preview_format(camera, i); - printf("-------------PREVIEW FORMAT %d TEST--------------------\n", i); - camera_start_preview(camera); - while( preview_test_data.iscalled==false && timeout-- > 5 ) - sleep(1); - - camera_stop_preview(camera); - if( preview_test_data.iscalled && preview_test_data.result ){ - printf("PASS\n"); - }else{ - printf("preview_test_data.result = %d\n", preview_test_data.result); - printf("FAIL\n"); - camera_destroy(camera); - return -1; - } - - } - } - - camera_destroy(camera); - return 0; - - -} - - -typedef struct{ - bool iscalled; - bool ispreviewed; - bool iscapturing; - bool iscaptured; - camera_state_e state; -} state_change_data; - -void _state_change_test_cb(camera_state_e previous , camera_state_e current , bool by_asm, void *user_data){ - state_change_data * data = (state_change_data*)user_data; - data->iscalled = true; - if( current == CAMERA_STATE_PREVIEW ) - data->ispreviewed = true; - if( current == CAMERA_STATE_CAPTURED ) - data->iscaptured = true; - if( current == CAMERA_STATE_CAPTURING ) - data->iscapturing = true; - data->state = current; -} - -void _capture_test_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - printf("capture callback\n"); -} - - -int camera_state_change_test(){ - camera_h camera ; - state_change_data data; - bool ispass = true; - int ret=0; - - 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_ROTATION_270); - camera_set_state_changed_cb(camera, _state_change_test_cb, &data); - - printf("------------------- PREVIEW STATE Change test------------------\n"); - data.iscalled = false; - data.state = 0; - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %x\n", ret); - sleep(1); - if( data.iscalled && data.state == CAMERA_STATE_PREVIEW ) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - - printf("------------------- CREATED STATE Change test------------------\n"); - - data.iscalled = false; - data.state = 0; - ret = camera_stop_preview(camera); - printf("camera_stop_preview ret = %x\n", ret); - sleep(1); - if( data.iscalled && data.state == CAMERA_STATE_CREATED) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - - printf("------------------- CAPTURED STATE Change test------------------\n"); - - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %x\n", ret); - sleep(1); - data.iscalled = false; - data.state = 0; - data.iscaptured = false; - data.ispreviewed= false; - data.iscapturing = false; - ret = camera_start_capture(camera, _capture_test_cb, NULL, NULL); - printf("camera_start_capture ret = %x\n", ret); - sleep(3); - if( data.iscalled && data.iscaptured && data.iscapturing && data.state == CAMERA_STATE_CAPTURED) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %x\n", ret); - ret = camera_stop_preview(camera); - printf("camera_stop_preview ret = %x\n", ret); - ret = camera_destroy(camera); - printf("camera_destroy ret = %x\n", ret); - - return ispass ? 0: -1; - -} - -void _capture_test2_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - int *iscalled = (int*)user_data; - *iscalled = 1; -} - -int capture_test(){ - camera_h camera ; - int iscalled; - camera_state_e state ; - bool ispass = true; - int timeout = 10; - - printf("---------------------CAPTURE Test -----------------\n"); - - 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_ROTATION_270); - camera_start_preview(camera); - iscalled = 0; - camera_start_capture(camera, _capture_test2_cb, NULL, &iscalled); - - while( camera_get_state(camera, &state ) == 0 && state != CAMERA_STATE_CAPTURED && timeout-- > 0 ) - sleep(1); - - if( iscalled == 1 ) - printf("PASS\n"); - else{ - printf("FAIL\n"); - ispass = false; - } - - - camera_start_preview(camera); - camera_stop_preview(camera); - camera_destroy(camera); - return ispass ? 0: -1; - -} - - -typedef struct{ - int width[100]; - int height[100]; - int count; -} resolution_stack; - - -bool capture_resolution_test_cb(int width, int height, void *user_data){ - resolution_stack *data = (resolution_stack*)user_data; - data->width[data->count] = width; - data->height[data->count] = height; - data->count++; - - printf("%dx%d\n",width, height); - - return true; -} - -typedef struct{ - int expected_width; - int expected_height; - bool ispass; -}preview_test_data; -void _capture_test3_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - preview_test_data *data = (preview_test_data*)user_data; - if( data->expected_height == image->height && data->expected_width == image->width ) - data->ispass = true; -} - - -int capture_resolution_test(){ - camera_h camera ; - resolution_stack resolution_list; - int i; - camera_state_e state ; - int ret = 0; - - 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_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); - - printf("-----------------CAPTURE RESOLUTION TEST---------------------\n"); - - for(i =0 ; i < resolution_list.count ; i++){ - preview_test_data data; - data.ispass = false; - data.expected_width = resolution_list.width[i]; - data.expected_height = resolution_list.height[i]; - int timeout = 10; - - printf("-----------------CAPTURE RESOLUTION (%dx%d)---------------------\n",data.expected_width ,data.expected_height); - - printf("resolution set test %x\n", (unsigned int)camera_set_capture_resolution(camera,data.expected_width ,data.expected_height)); - - camera_start_preview(camera); - - camera_start_capture(camera, _capture_test3_cb , NULL, &data); - - while( camera_get_state(camera, &state ) == 0 && state != CAMERA_STATE_CAPTURED && timeout-- > 0){ - sleep(1); - } - - camera_start_preview(camera); - camera_stop_preview(camera); - if( !data.ispass ){ - ret += -1; - printf("FAIL\n"); - }else{ - printf("PASS\n"); - } - } - - return ret; -} - -bool preview_resolution_cb(int width, int height, void *user_data) -{ - printf("%dx%d\n", width, height); - return true; -} - - -void preview_test(){ - 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); - camera_start_preview(camera); -} - - -void rotation_test(){ - camera_h camera; - int ret; - 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_ROTATION_NONE); - camera_start_preview(camera); - sleep(3); - printf("180\n"); - camera_set_x11_display_rotation(camera, CAMERA_ROTATION_180); - - sleep(3); - printf("270\n"); - camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); - - sleep(3); - printf("90\n"); - camera_set_x11_display_rotation(camera, CAMERA_ROTATION_90); - - sleep(10); - camera_stop_preview(camera); - camera_destroy(camera); - -} - - -void _focus_changed_cb2(camera_focus_state_e state, void *user_data){ - char* table[] = { "CAMERA_FOCUS_STATE_RELEASED", "CAMERA_FOCUS_STATE_ONGOING" , "CAMERA_FOCUS_STATE_FOCUSED","CAMERA_FOCUS_STATE_FAILED" }; - - - printf("focus state %s\n", table[state]); -} - - -void focus_test(){ - camera_h camera; - int ret; - 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_ROTATION_270); - camera_set_focus_changed_cb(camera, _focus_changed_cb2, NULL); - camera_start_preview(camera); - - printf("enter to start focusing\n"); getchar(); - camera_start_focusing(camera, false); - sleep(3); - - printf("enter to start focusing 2\n"); getchar(); - camera_start_focusing(camera, false); - sleep(3); - - printf("enter to start focusing 3\n"); getchar(); - camera_start_focusing(camera, false); - sleep(3); - - printf("enter to cancel focusing\n");getchar(); - camera_cancel_focusing(camera); - sleep(3); - - printf("enter to start CAF\n"); getchar(); - camera_start_focusing(camera, true); - sleep(3); - - printf("enter to stop preview\n"); getchar(); - camera_stop_preview(camera); - sleep(3); - - printf("enter to start preview\n"); getchar(); - camera_start_preview(camera); - sleep(3); - - printf("enter to change AF mode to macro\n"); getchar(); - camera_attr_set_af_mode(camera, CAMERA_ATTR_AF_MACRO); - sleep(3); - - - printf("enter to stop focusing\n");getchar(); - camera_cancel_focusing(camera); - sleep(3); - - printf("enter to set af mode macro\n");getchar(); - camera_attr_set_af_mode(camera, CAMERA_ATTR_AF_MACRO); - sleep(3); - - printf("enter to start focusing\n"); getchar(); - camera_start_focusing(camera, false); - sleep(3); - - - printf("enter to CAF\n"); getchar(); - camera_start_focusing(camera, true); - sleep(3); - - printf("enter to stop focusing\n");getchar(); - camera_cancel_focusing(camera); - sleep(3); - - printf("enter to set af mode macro\n");getchar(); - camera_attr_set_af_mode(camera, CAMERA_ATTR_AF_MACRO); - sleep(3); - - printf("enter to CAF\n"); getchar(); - camera_start_focusing(camera, true); - sleep(3); - - printf("enter to stop preview\n"); getchar(); - camera_stop_preview(camera); - camera_destroy(camera); - -} - - -void camera_lens_rotation_test(){ - camera_h camera; - camera_create(CAMERA_DEVICE_CAMERA0, &camera); - camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - int angle; - camera_attr_get_lens_orientation(camera, &angle); - printf("angle =%d\n",angle); - camera_start_preview(camera); - - sleep(20); - camera_stop_preview(camera); - camera_destroy(camera); - - - camera_create(CAMERA_DEVICE_CAMERA1, &camera); - camera_set_display(camera, CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - - camera_attr_get_lens_orientation(camera, &angle); - printf("angle =%d\n",angle); - camera_start_preview(camera); - - sleep(20); - camera_stop_preview(camera); - camera_destroy(camera); - - -} - -void contrast_test2(){ - camera_h camera; - camera_create(CAMERA_DEVICE_CAMERA0, &camera); - 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); - - -} - - - -typedef struct{ - camera_h camera; - int count; - bool completed; -}conti_test_data; - -void conti_capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - conti_test_data *test_data = (conti_test_data*)user_data; - printf("capture callback!!%d\n", test_data->count++); - if( test_data->count == 5 ) - camera_stop_continuous_capture(test_data->camera); -} - -void _capture_completed_cb(void *user_data){ - conti_test_data *test_data = (conti_test_data*)user_data; - test_data->completed = true; - printf("capture completed\n"); -} - -int continuous_capture_test(){ - printf("--------------continuous capture test--------------------\n"); - camera_h camera; - conti_test_data test_data; - int timeout =30; - int ret; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - printf("camera_create %x\n", ret); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - printf("camera_set_display %x\n", ret); - ret = camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); - printf("camera_set_x11_display_rotation %x\n", ret); - ret = camera_start_preview(camera); - printf("camera_start_preview %x\n", ret); - - test_data.camera = camera; - test_data.count = 0; - test_data.completed = false; - ret = camera_start_continuous_capture(camera, 10, 10, conti_capturing_cb, _capture_completed_cb, &test_data); - printf("camera_start_continuous_capture ret = %x\n", ret); - if( ret != 0 ){ - printf("fail conti capture\n"); - camera_stop_preview(camera); - camera_destroy(camera); - return -1; - } - - while( test_data.completed == false && timeout-- > 0 ) - sleep(1); - - camera_start_preview(camera); - - if( test_data.count != 5|| test_data.completed == false ){ - camera_stop_preview(camera); - camera_destroy(camera); - return -1; - } - - - test_data.camera = camera; - test_data.count = 0; - test_data.completed = false; - timeout = 30; - - ret = camera_start_continuous_capture(camera, 10, 1000, conti_capturing_cb, _capture_completed_cb, &test_data); - - if( ret != 0 ){ - printf("fail conti capture\n"); - camera_stop_preview(camera); - camera_destroy(camera); - return -1; - } - - sleep(2); - camera_stop_continuous_capture(camera); - - while( test_data.completed == false && timeout-- > 0 ) - sleep(1); - - camera_start_preview(camera); - camera_stop_preview(camera); - camera_destroy(camera); - - printf("total capture count = %d\n", test_data.count); - if( test_data.completed == false) - return -1; - return 0; -} - - -void _face_detected(camera_detected_face_s *faces, int count, void *user_data){ - printf("face detected!!\n"); - int i; - for(i = 0 ; i < count ; i++){ - printf("%d) - %dx%d\n", faces[i].id, faces[i].x, faces[i].y); - } -} - - -int face_detection_test(){ - printf("--------------face_detection_test--------------------\n"); - camera_h camera; - int ret; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - printf("camera_create %x\n", ret); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - printf("camera_set_display %x\n", ret); - ret = camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); - printf("camera_set_x11_display_rotation %x\n", ret); - ret = camera_start_preview(camera); - printf("camera_start_preview %x\n", ret); - if( camera_is_supported_face_detection(camera) ){ - ret = camera_start_face_detection(camera, _face_detected, NULL); - printf("camera_start_face_detection %x\n", ret); - }else - { - printf("not supported face detection\n"); - } - return 0; -} - -int face_count ; -void _face_detected2(camera_detected_face_s *faces, int count, void *user_data){ - face_count = count; - printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n-------------------------------------------\n"); - int i; - for( i = 0 ; i < count ; i++ ){ - printf("%d) %dx%d \n", faces[i].id, faces[i].x , faces[i].y); - } -} - - -int face_zoom_test(){ - printf("--------------face_zoom_test--------------------\n"); - camera_h camera; - int ret; - ret = camera_create(CAMERA_DEVICE_CAMERA0, &camera); - printf("camera_create %x\n", ret); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - printf("camera_set_display %x\n", ret); - ret = camera_set_x11_display_rotation(camera, CAMERA_ROTATION_270); - printf("camera_set_x11_display_rotation %x\n", ret); - ret = camera_start_preview(camera); - printf("camera_start_preview %x\n", ret); - if( camera_is_supported_face_detection(camera) ){ - ret = camera_start_face_detection(camera, _face_detected2, NULL); - printf("camera_start_face_detection %x\n", ret); - }else - { - printf("not supported face detection\n"); - } - while(1){ - char select[255]; - //printf("current faces %d\n", face_count); - //printf("x is zoom cancel\n"); - //printf("select face>"); - gets(select); - if( select[0] == 'x' ){ - camera_cancel_face_zoom(camera); - }else if( select[0] != '\0'){ - int face = select[0] - '0'; - //printf("input : <%s>\n", select); - if( face >= 0 ){ - //printf("select %d\n", face); - camera_face_zoom(camera, face); - } - } - } - return 0; -} - -char *table[] = { -"CAMERA_PIXEL_FORMAT_NV12", /**< NV12 pixel format */ -"CAMERA_PIXEL_FORMAT_NV12T", /**< NV12 Tiled pixel format */ -"CAMERA_PIXEL_FORMAT_NV16", /**< NV16 pixel format */ -"CAMERA_PIXEL_FORMAT_NV21", /**< NV21 pixel format */ -"CAMERA_PIXEL_FORMAT_YUYV", /**< YUYV(YUY2) pixel format */ -"CAMERA_PIXEL_FORMAT_UYVY", /**< UYVY pixel format */ -"CAMERA_PIXEL_FORMAT_422P", /**< YUV422(Y:U:V) planar pixel format */ -"CAMERA_PIXEL_FORMAT_I420", /**< I420 pixel format */ -"CAMERA_PIXEL_FORMAT_YV12", /**< YV12 pixel format */ -"CAMERA_PIXEL_FORMAT_RGB565", /**< RGB565 pixel format */ -"CAMERA_PIXEL_FORMAT_RGB888", /**< RGB888 pixel format */ -"CAMERA_PIXEL_FORMAT_RGBA", /**< RGBA pixel format */ -"CAMERA_PIXEL_FORMAT_ARGB", /**< ARGB pixel format */ -"CAMERA_PIXEL_FORMAT_JPEG" /**< Encoded pixel format */ -}; - - -bool supported_preview_format_test(camera_pixel_format_e format,void *user_data){ - printf("%s\n", table[format]); - return true; -} - -int preview_format_test(){ - camera_h camera; - camera_pixel_format_e format; - camera_create(CAMERA_DEVICE_CAMERA0, &camera); - printf("----------CAMERA_DEVICE_CAMERA0 -----------------\n"); - camera_foreach_supported_preview_format(camera, supported_preview_format_test, NULL); - camera_get_preview_format(camera, &format); - printf("default - %s\n", table[format]); - - camera_destroy(camera); - camera_create(CAMERA_DEVICE_CAMERA1, &camera); - printf("----------CAMERA_DEVICE_CAMERA1 -----------------\n"); - camera_foreach_supported_preview_format(camera, supported_preview_format_test, NULL); - camera_get_preview_format(camera, &format); - printf("default - %s\n", table[format]); - camera_destroy(camera); - - return 0; - -} - -void _hdr_progress_cb(int percent, void *user_data){ - printf("percent = %d\n", percent); -} - -void _hdr_capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - printf("hdr capturing!\n"); -} - -void _hdr_capture_completed_cb(void *user_data){ - printf("hdr capture complete\n"); -} - - - -int hdr_capture_test(){ - camera_h camera; - int ret; - camera_create(CAMERA_DEVICE_CAMERA0, &camera); - if( !camera_attr_is_supported_hdr_capture(camera) ){ - printf("Not supported HDR Capture\n"); - return 0; - } - - camera_attr_set_hdr_capture_progress_cb(camera, _hdr_progress_cb, NULL); - camera_attr_set_hdr_mode(camera, CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_start_preview(camera); - camera_start_capture(camera, _hdr_capturing_cb , _hdr_capture_completed_cb , NULL); - - return 0; -} - -Eina_Bool captured_event_check5(void *data){ - printf("!!!captured_event_check5\n"); - camera_h camera = (camera_h)data; - camera_start_capture(camera, _hdr_capturing_cb , _hdr_capture_completed_cb , NULL); - camera_state_e state; - camera_get_state(camera,&state); - while( state == CAMERA_STATE_CAPTURING ){ - //printf("current state = %d\n", state); - usleep(10000); - camera_get_state(camera,&state); - } - printf("current state = %d\n", state); - camera_start_preview(camera); - camera_stop_preview(camera); - camera_destroy(camera); - - return false; -} - - -int hdr_capture_test2(){ - camera_h camera; - int ret; - camera_create(CAMERA_DEVICE_CAMERA0, &camera); - if( !camera_attr_is_supported_hdr_capture(camera) ){ - printf("Not supported HDR Capture\n"); - return 0; - } - - camera_attr_set_hdr_capture_progress_cb(camera, _hdr_progress_cb, NULL); - camera_attr_set_hdr_mode(camera, CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_start_preview(camera); - ecore_idler_add(captured_event_check5, camera); - - return 0; -} - - -void _captured_check_capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data){ - printf("capturing!\n"); -} - -void _captured_check_capture_completed_cb(void *user_data){ - printf("capture complete\n"); -} - -Eina_Bool captured_event_check4(void *data){ - printf("!!!HDR captured event check4\n"); - camera_h camera; - int ret; - camera_state_e state; - - ret= camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - camera_attr_set_hdr_mode(camera, CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL); - camera_start_capture(camera, _captured_check_capturing_cb , _captured_check_capture_completed_cb , NULL); - printf("camera_start_capture ret = %d\n", ret); - camera_get_state(camera,&state); - while( state == CAMERA_STATE_CAPTURING ){ - //printf("current state = %d\n", state); - usleep(10000); - camera_get_state(camera,&state); - } - printf("current state = %d\n", state); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - ret = camera_stop_preview(camera); - printf("camera_stop_preview ret = %d\n", ret); - ret = camera_destroy(camera); - printf("camera_destroy ret = %d\n", ret); - return false; -} - -Eina_Bool captured_event_check3(void *data){ - printf("!!!continuous break captured event check3\n"); - camera_h camera; - int ret; - camera_state_e state; - - ret= camera_create(CAMERA_DEVICE_CAMERA0, &camera); - printf("camera_create ret = %d\n", ret); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - ret = camera_start_continuous_capture(camera, 5 , 1000, _captured_check_capturing_cb, _captured_check_capture_completed_cb, NULL); - printf("camera_start_continuous_capture ret = %d\n", ret); - camera_get_state(camera,&state); - int count = 0; - while( state == CAMERA_STATE_CAPTURING ){ - //printf("current state = %d\n", state); - usleep(10000); - count++; - if( count == 10) - camera_stop_continuous_capture(camera); - camera_get_state(camera,&state); - } - printf("current state = %d\n", state); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - ret = camera_stop_preview(camera); - printf("camera_stop_preview ret = %d\n", ret); - ret = camera_destroy(camera); - printf("camera_destroy ret = %d\n", ret); - ecore_idler_add(captured_event_check4, NULL); - return false; -} - -Eina_Bool captured_event_check2(void *data){ - printf("!!!continuous shot captured event check2\n"); - camera_h camera; - int ret; - camera_state_e state; - - ret= camera_create(CAMERA_DEVICE_CAMERA0, &camera); - printf("camera_create ret = %d\n", ret); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - ret = camera_start_continuous_capture(camera, 5 , 1000, _captured_check_capturing_cb, _captured_check_capture_completed_cb, NULL); - printf("camera_start_continuous_capture ret = %d\n", ret); - camera_get_state(camera,&state); - while( state == CAMERA_STATE_CAPTURING ){ - //printf("current state = %d\n", state); - usleep(10000); - camera_get_state(camera,&state); - } - printf("current state = %d\n", state); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - ret = camera_stop_preview(camera); - printf("camera_stop_preview ret = %d\n", ret); - ret = camera_destroy(camera); - printf("camera_destroy ret = %d\n", ret); - ecore_idler_add(captured_event_check3, NULL); - return false; -} - - -Eina_Bool captured_event_check(void *data){ - printf("!!!Normal captured event check\n"); - camera_h camera; - camera_state_e state; - - int ret; - ret= camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - camera_start_capture(camera, _captured_check_capturing_cb , _captured_check_capture_completed_cb , NULL); - printf("camera_start_capture ret = %d\n", ret); - camera_get_state(camera,&state); - while( state == CAMERA_STATE_CAPTURING ){ - //printf("current state = %d\n", state); - usleep(10000); - camera_get_state(camera,&state); - } - printf("current state = %d\n", state); - ret = camera_start_preview(camera); - printf("camera_start_preview ret = %d\n", ret); - ret = camera_stop_preview(camera); - printf("camera_stop_preview ret = %d\n", ret); - ret = camera_destroy(camera); - printf("camera_destroy ret = %d\n", ret); - - ecore_idler_add(captured_event_check2, NULL); - return false; -} - -void rotate_test(){ - camera_h camera; - int ret; - ret= camera_create(CAMERA_DEVICE_CAMERA0, &camera); - ret = camera_set_display(camera,CAMERA_DISPLAY_TYPE_X11, GET_DISPLAY(preview_win)); - camera_set_x11_display_rotation(camera, CAMERA_ROTATION_NONE); - ret = camera_start_preview(camera); - int angle; - camera_attr_get_lens_orientation(camera, &angle); - printf("camera lens angle %d\n", angle); - printf("camera_start_preview ret = %d\n", ret); -} - -void supported_ZSL_test(){ - camera_h camera; - int ret; - ret= camera_create(CAMERA_DEVICE_CAMERA0, &camera); - if( camera_is_supported_zero_shutter_lag(camera)) - printf("support zero shutter lag\n"); - else - printf("not support zero shutter lag\n"); -} - -int camera_test(){ - - int ret=0; - - //ret = camera_attribute_test(); - //ret += camera_preview_test(); - //ret += camera_state_change_test(); - //ret += capture_test(); - //ret += capture_resolution_test(); - //ret += stillshot_test(); - //camera_lens_rotation_test(); - //contrast_test2(); - //rotation_flip_test(); - //ret += continuous_capture_test(); - //ret = face_detection_test(); - //face_zoom_test(); - //preview_format_test(); - //hdr_capture_test(); - //hdr_capture_test(); - //hdr_capture_test2(); - //rotate_test(); - //supported_ZSL_test(); - focus_test(); - return ret; -} - - - -void* test_main(void *arg){ - int ret = 0; - - ret = camera_test(); - if( ret == 0 ) - printf("--------------CAMERA TEST ALL PASS--------------------------\n"); - else - printf("--------------CAMERA TEST FAIL %d--------------------------\n", -ret); - - - return 0; - -} - -int main(int argc, char ** argv) -{ - int w,h; - elm_init(argc, argv); - - - - mEvasWindow = elm_win_add(NULL, "VIDEO OVERLAY", ELM_WIN_BASIC); - elm_win_title_set(mEvasWindow, "video oeverlay window"); - elm_win_borderless_set(mEvasWindow, EINA_TRUE); - ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); - evas_object_resize(mEvasWindow, w, h); - elm_win_indicator_state_set(mEvasWindow, EINA_TRUE); - - //elm_win_rotation_set(mEvasWindow, 270); - //elm_win_fullscreen_set(mEvasWindow, 1); - preview_win = elm_win_xwindow_get(mEvasWindow); - - evas_object_show(mEvasWindow); - - img = evas_object_image_add(evas_object_evas_get(mEvasWindow)); - evas_object_resize(mEvasWindow, w, h); - - evas_object_image_fill_set(img, 0, 0, w, h); - - evas_object_show(img); - - pthread_t gloop_thread; - - pthread_create(&gloop_thread, NULL, test_main, NULL); - - //ecore_idler_add(captured_event_check, NULL); - - elm_run(); - elm_shutdown(); - - - return 0; -} - |