diff options
-rw-r--r-- | AUTHORS | 4 | ||||
-rwxr-xr-x | CMakeLists.txt | 121 | ||||
-rw-r--r-- | LICENSE.APLv2 | 206 | ||||
-rw-r--r-- | NOTICE | 3 | ||||
-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 | ||||
-rwxr-xr-x | capi-media-camera.manifest | 5 | ||||
-rw-r--r-- | capi-media-camera.pc.in | 15 | ||||
-rwxr-xr-x | include/camera.h | 3030 | ||||
-rwxr-xr-x | include/camera_private.h | 84 | ||||
-rwxr-xr-x | packaging/capi-media-camera.spec | 60 | ||||
-rwxr-xr-x | src/camera.c | 2745 | ||||
-rw-r--r-- | tags | 652 | ||||
-rw-r--r-- | test/CMakeLists.txt | 21 | ||||
-rwxr-xr-x | test/multimedia_camera_test.c | 1582 |
29 files changed, 11384 insertions, 0 deletions
@@ -0,0 +1,4 @@ +Seungkeun Lee <sngn.lee at samsung dot com> +Kangho Hur <kanho.hur at samsung dot com> +Jeongmo Yang <jm80.yang at samsung dot com> +Jonghyuk Choi <jhchoi.choi at samsung dot com> diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..0a35b5a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,121 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(Services + "application" + "base" + "content" + "location" + "media" + "messaging" + "network" + "social" + "telephony" + "system" + ) + +# project +SET(project_prefix "capi") +SET(prefix "/usr") +SET(version "0.0.1") +SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>") +SET(description "A Camera library in Tizen Native API") +SET(service "media") +SET(submodule "camera") + +# for package file +SET(dependents "dlog mm-camcorder capi-base-common") +SET(pc_dependents "capi-base-common") + +SET(fw_name "${project_prefix}-${service}-${submodule}") + +PROJECT(${fw_name}) + +SET(CMAKE_INSTALL_PREFIX ${prefix}) +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(VERSION ${version}) + +SET(INC_DIR include) +INCLUDE_DIRECTORIES(${INC_DIR}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(${fw_name} REQUIRED ${dependents}) +FOREACH(flag ${${fw_name}_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") + +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DTIZEN_DEBUG") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") + +aux_source_directory(src SOURCES) +ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) + +SET_TARGET_PROPERTIES(${fw_name} + PROPERTIES + VERSION ${FULLVER} + SOVERSION ${MAJORVER} + CLEAN_DIRECT_OUTPUT 1 +) + + +TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS}) + +INSTALL(TARGETS ${fw_name} DESTINATION lib) +INSTALL( + DIRECTORY ${INC_DIR}/ DESTINATION include/${service} + FILES_MATCHING + PATTERN "*_private.h" EXCLUDE + PATTERN "${INC_DIR}/*.h" + ) + +SET(PC_NAME ${fw_name}) +SET(PC_REQUIRED ${pc_dependents}) +SET(PC_LDFLAGS -l${fw_name}) + +CONFIGURE_FILE( + ${fw_name}.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc + @ONLY +) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig) + +#ADD_SUBDIRECTORY(test) + +IF(UNIX) + +ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution) +ADD_CUSTOM_COMMAND( + DEPENDS clean + COMMENT "distribution clean" + COMMAND find + ARGS . + -not -name config.cmake -and \( + -name tester.c -or + -name Testing -or + -name CMakeFiles -or + -name cmake.depends -or + -name cmake.check_depends -or + -name CMakeCache.txt -or + -name cmake.check_cache -or + -name *.cmake -or + -name Makefile -or + -name core -or + -name core.* -or + -name gmon.out -or + -name install_manifest.txt -or + -name *.pc -or + -name *~ \) + | grep -v TC | xargs rm -rf + TARGET distclean + VERBATIM +) + +ENDIF(UNIX) diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 new file mode 100644 index 0000000..bbe9d02 --- /dev/null +++ b/LICENSE.APLv2 @@ -0,0 +1,206 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+
+
@@ -0,0 +1,3 @@ +Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE.APLv2 file for Apache License terms and conditions. diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100755 index 0000000..72a11ec --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,8 @@ +#!/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 new file mode 100755 index 0000000..5ddaa53 --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,7 @@ +#!/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 new file mode 100755 index 0000000..72aad6c --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,16 @@ +#!/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 new file mode 100755 index 0000000..29743e0 --- /dev/null +++ b/TC/clean.sh @@ -0,0 +1,11 @@ +#!/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 new file mode 100644 index 0000000..12ac1e2 --- /dev/null +++ b/TC/config.default @@ -0,0 +1,3 @@ +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 new file mode 100755 index 0000000..a4f6095 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,15 @@ +#!/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 new file mode 100755 index 0000000..49e33e0 --- /dev/null +++ b/TC/testcase/Makefile @@ -0,0 +1,28 @@ +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 new file mode 100644 index 0000000..3fb30e5 --- /dev/null +++ b/TC/testcase/tslist @@ -0,0 +1,5 @@ +/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 new file mode 100755 index 0000000..6d3fb33 --- /dev/null +++ b/TC/testcase/utc_media_camera_attr.c @@ -0,0 +1,731 @@ +/* +* 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 new file mode 100755 index 0000000..f2ee9a7 --- /dev/null +++ b/TC/testcase/utc_media_camera_lifecycle.c @@ -0,0 +1,351 @@ +/* +* 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 new file mode 100755 index 0000000..9543faa --- /dev/null +++ b/TC/testcase/utc_media_camera_setting.c @@ -0,0 +1,753 @@ +/* +* 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 new file mode 100755 index 0000000..3695c9f --- /dev/null +++ b/TC/testcase/utc_media_camera_working.c @@ -0,0 +1,906 @@ +/* +* 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 new file mode 100755 index 0000000..03f029a --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +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/capi-media-camera.manifest b/capi-media-camera.manifest new file mode 100755 index 0000000..a76fdba --- /dev/null +++ b/capi-media-camera.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_" /> + </request> +</manifest> diff --git a/capi-media-camera.pc.in b/capi-media-camera.pc.in new file mode 100644 index 0000000..5d02f8d --- /dev/null +++ b/capi-media-camera.pc.in @@ -0,0 +1,15 @@ + +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=/usr +libdir=/usr/lib +includedir=/usr/include/media + +Name: @PC_NAME@ +Description: @PACKAGE_DESCRIPTION@ +Version: @VERSION@ +Requires: @PC_REQUIRED@ +Libs: -L${libdir} @PC_LDFLAGS@ +Cflags: -I${includedir} + diff --git a/include/camera.h b/include/camera.h new file mode 100755 index 0000000..5894d67 --- /dev/null +++ b/include/camera.h @@ -0,0 +1,3030 @@ +/* +* 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_MULTIMEDIA_CAMERA_H__ +#define __TIZEN_MULTIMEDIA_CAMERA_H__ + +#include <tizen.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 + */ + + +/** + * @addtogroup CAPI_MEDIA_CAMERA_MODULE + * @{ + */ + + +/** + * @brief Enumerations of the error code for Camera. + */ +typedef enum +{ + CAMERA_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + CAMERA_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + CAMERA_ERROR_INVALID_STATE = CAMERA_ERROR_CLASS | 0x02, /**< Invalid state */ + CAMERA_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + CAMERA_ERROR_DEVICE = CAMERA_ERROR_CLASS | 0x04, /**< Device error */ + 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_NOT_FOUND = CAMERA_ERROR_CLASS | 0x09, /**< No camera device */ +} camera_error_e; + + +/** + * @brief Enumerations of the camera state. + */ +typedef enum +{ + CAMERA_STATE_NONE, /**< Before create */ + 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. + */ +typedef enum +{ + CAMERA_DEVICE_CAMERA0 = 0, /**< Primary camera */ + CAMERA_DEVICE_CAMERA1 /**< Secondary camera */ +} camera_device_e; + + +/** + * @brief Enumerations of the camera pixel format. + */ +typedef enum +{ + 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 */ + 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 */ +} camera_pixel_format_e; + + +/** + * @brief Enumerations of the camera display type. + */ +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_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 Enumerations of the camera rotation type. + */ +typedef enum +{ + CAMERA_ROTATION_NONE, /**< No rotation */ + CAMERA_ROTATION_90, /**< 90 degree rotation */ + CAMERA_ROTATION_180, /**< 180 degree rotation */ + CAMERA_ROTATION_270, /**< 270 degree rotation */ +} camera_rotation_e; + + +/** + * @brief Enumerations of the camera flip type. + */ +typedef enum +{ + CAMERA_FLIP_NONE, /**< No Flip */ + CAMERA_FLIP_HORIZONTAL, /**< Horizontal flip */ + CAMERA_FLIP_VERTICAL, /**< Vertical flip */ + CAMERA_FLIP_BOTH /** Horizontal and vertical flip */ +}camera_flip_e; + +/** + * @brief Enumerations of the camera display mode. + */ +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_SECURITY /**< Security policy */ +} camera_policy_e; + + +/** + * @brief Struct of the image data + */ + 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; + + +/** + * @brief Struct of the face detection + */ +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; + + +/** + * @brief Struct of the preview stream data + */ +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 */ + union { + struct { + 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 */ + + 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 */ + } data; +}camera_preview_data_s; + + +/** + * @} + */ + + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + + +/** + * @brief Enumerations of the color tone which provides an impression of looking through a tinted glass. + */ +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_mode_e; + + +/** + * @brief Enumerations of the white balance levels of the camera. + */ +typedef enum +{ + CAMERA_ATTR_WHITE_BALANCE_NONE = 0, /**< None */ + CAMERA_ATTR_WHITE_BALANCE_AUTOMATIC, /**< Automatic */ + CAMERA_ATTR_WHITE_BALANCE_DAYLIGHT, /**< Daylight */ + CAMERA_ATTR_WHITE_BALANCE_CLOUDY, /**< Cloudy */ + CAMERA_ATTR_WHITE_BALANCE_FLUORESCENT, /**< Fluorescent */ + CAMERA_ATTR_WHITE_BALANCE_INCANDESCENT, /**< Incandescent */ + CAMERA_ATTR_WHITE_BALANCE_SHADE, /**< Shade */ + CAMERA_ATTR_WHITE_BALANCE_HORIZON, /**< Horizon */ + CAMERA_ATTR_WHITE_BALANCE_FLASH, /**< Flash */ + 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. + */ +typedef enum +{ + CAMERA_ATTR_SCENE_MODE_NORMAL = 0, /**< Normal */ + CAMERA_ATTR_SCENE_MODE_PORTRAIT, /**< Portrait */ + CAMERA_ATTR_SCENE_MODE_LANDSCAPE, /**< Landscape */ + CAMERA_ATTR_SCENE_MODE_SPORTS, /**< Sports */ + CAMERA_ATTR_SCENE_MODE_PARTY_N_INDOOR, /**< Party & indoor */ + CAMERA_ATTR_SCENE_MODE_BEACH_N_INDOOR, /**< Beach & indoor */ + CAMERA_ATTR_SCENE_MODE_SUNSET, /**< Sunset */ + CAMERA_ATTR_SCENE_MODE_DUSK_N_DAWN, /**< Dusk & dawn */ + CAMERA_ATTR_SCENE_MODE_FALL_COLOR, /**< Fall */ + CAMERA_ATTR_SCENE_MODE_NIGHT_SCENE, /**< Night scene */ + CAMERA_ATTR_SCENE_MODE_FIREWORK, /**< Firework */ + CAMERA_ATTR_SCENE_MODE_TEXT, /**< Text */ + 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_e; + + +/** + * @brief Enumerations of the auto focus mode. + */ +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_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. + */ +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_e; + + +/** + * @brief Enumerations of the camera exposure modes. + */ +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_e; + + +/** + * @brief Enumerations for the orientation values of tag. + */ +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_e; + + +/** + * @brief Enumerations of the flash mode. + */ +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_e; + + +/** + * @brief Enumerations of the preview fps. + */ +typedef enum +{ + CAMERA_ATTR_FPS_AUTO = 0, /**< AUTO FPS */ + CAMERA_ATTR_FPS_8 = 8, /**< 8 FPS */ + CAMERA_ATTR_FPS_15 = 15, /**< 15 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_120 = 120 /**< 120 FPS */ +} camera_attr_fps_e; + +/** + * @brief Enumerations of the theater mode + */ +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_e; + +/** + * @brief Enumerations of HDR capture mode + */ +typedef enum +{ + 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; + + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_MODULE + * @{ + */ + + +/** + * @brief Called when the camera state changes. + * + * @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 + * @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(). + * @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 + * + * @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 + * @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. + * @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 + * + * @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() + * @see camera_cancel_focusing() + */ +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. + * + * @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. + * + * @param[in] frame 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() + * @see camera_unset_preview_cb() + */ +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. + * + * @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. + * + * @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() + * @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. + * + * @param[in] user_data The user data passed from the callback registration function + * + * @pre This callback function is invoked if you register this callback 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 + * + * @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 you register this callback 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 + * + * @param[in] faces The detected face array + * @param[in] count The length of 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); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @see camera_foreach_supported_preview_format() + */ +typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, + void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_destroy() + */ +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 + * + * @see camera_create() + */ +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()) + * @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. + * + * @see camera_stop_preview() + * @see camera_set_display() + * @see camera_set_preview_cb() + * @see camera_foreach_supported_preview_resolution() + * @see camera_set_preview_resolution() + * @see camera_get_preview_resolution() + * @see camera_foreach_supported_preview_format() + * @see camera_set_preview_format() + * @see camera_get_preview_format() + * @see camera_attr_foreach_supported_fps() + * @see camera_attr_set_preview_fps() + * @see camera_attr_get_preview_fps() + */ +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. + * + * @see camera_start_preview() + * @see camera_unset_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 + * @param[in] capturing_cb The callback for capturing data + * @param[in] completed_cb The callback for notification of completed + * @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. + * + * @see camera_start_preview() + * @see camera_start_continuous_capture(); + * @see camera_foreach_supported_capture_resolution() + * @see camera_set_capture_resolution() + * @see camera_get_capture_resolution() + * @see camera_foreach_supported_capture_format() + * @see camera_set_capture_format() + * @see camera_get_capture_format() + * @see camera_attr_set_image_quality() + * @see camera_attr_get_image_quality() + */ +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 + * + * @param[in] camera The handle to the camera + * @param[in] count The number of still images + * @param[in] interval The interval of capture ( millisecond ) + * @param[in] capturing_cb The callback for capturing data + * @param[in] completed_cb The callback for notification of completed + * @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 + * + * @post If it succeeds the camera state will be #CAMERA_STATE_CAPTURED. + * + * @see camera_start_preview() + * @see camera_start_capture(); + * @see camera_stop_continuous_capture() + * @see camera_is_supported_zero_shutter_lag() + */ +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. + * + * @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 + * + * @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 + * + * @see camera_create() + * @see camera_start_preview() + * @see camera_stop_preview() + * @see camera_start_capture() + */ +int camera_get_state(camera_h camera, camera_state_e *state); + +/** + * @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. + * + * @see camera_cancel_focusing() + * @see camera_set_focus_changed_cb() + * @see camera_focus_changed_cb() + * @see camera_attr_set_af_mode() + */ +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 + * + * @see camera_start_focusing() + * @see camera_focus_changed_cb() + */ +int camera_cancel_focusing(camera_h camera); + +/** + * @brief Sets the display handle to show preview images + * + * @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 + * + * @see camera_start_preview() + * @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()). + * + * @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 + * + * @see camera_start_preview() + * @see camera_get_preview_resolution() + * @see camera_foreach_supported_preview_resolution() + */ +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 + * + * @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 + * + * @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 + * + * @see camera_stop_face_detection() + * @see camera_face_detected_cb() + * @see camera_is_supported_face_detection() + */ +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 + * + * @pre This should be called after face detection was started. + * + * @see camera_start_face_detection() + * @see camera_is_supported_face_detection() + */ +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); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @brief Retrieves all supported camera preview resolutions by invoking callback function once for each supported camera preview resolution. + * + * @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. + * + * @see camera_set_preview_resolution() + * @see camera_get_preview_resolution() + * @see camera_supported_preview_resolution_cb() + */ +int camera_foreach_supported_preview_resolution(camera_h camera, + camera_supported_preview_resolution_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_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 + * + * @see camera_start_preview() + * @see camera_get_x11_display_rotation() + */ +int camera_set_x11_display_rotation(camera_h camera, camera_rotation_e rotation); + +/** + * @brief Gets the display rotation. + * @ingroup CAPI_MEDIA_CAMERA_X11_DISPLAY_MODULE + * + * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_X11. + * + * @param[in] camera The handle to the camera + * @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() + */ +int camera_get_x11_display_rotation(camera_h camera, camera_rotation_e *rotation); + +/** + * @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 + * @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() + */ +int camera_set_x11_display_flip(camera_h camera, camera_flip_e flip); + +/** + * @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() + */ +int camera_get_x11_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 + * + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see camera_is_x11_display_visible() + */ +int camera_set_x11_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 + * + * @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_visible() + */ +int camera_is_x11_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 + * + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see camera_get_x11_display_mode() + */ +int camera_set_x11_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 + * + * @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_mode() + */ +int camera_get_x11_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. + * + * @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 + * + * @see camera_set_capture_resolution() + * @see camera_foreach_supported_capture_resolution() + */ +int camera_get_capture_resolution(camera_h camera, int *width, int *height); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @brief Retrieves all supported camera capture 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 + * @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. + * + * @see camera_set_capture_resolution() + * @see camera_get_capture_resolution() + * @see camera_supported_capture_resolution_cb() + */ +int camera_foreach_supported_capture_resolution(camera_h camera, + camera_supported_capture_resolution_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_MODULE + * @{ + */ + + +/** + * @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. + * + * @see camera_start_capture() + * @see camera_get_capture_format() + * @see camera_foreach_supported_capture_format() + */ +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 + * + * @see camera_set_capture_format() + * @see camera_foreach_supported_capture_format() + */ +int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @brief Retrieves all supported camera capture formats by invoking 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 + * @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. + * + * @see camera_set_capture_format() + * @see camera_get_capture_format() + * @see camera_supported_capture_format_cb() + */ +int camera_foreach_supported_capture_format(camera_h camera, + camera_supported_capture_format_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_MODULE + * @{ + */ + +/** + * @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 + * + * @see camera_start_preview() + * @see camera_get_preview_format() + * @see camera_foreach_supported_preview_format() + */ +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 + * + * @see camera_set_preview_format() + * @see camera_foreach_supported_preview_format() + */ +int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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 + * @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. + * + * @see camera_set_preview_format() + * @see camera_get_preview_format() + * @see camera_supported_preview_format_cb() + */ +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 + * + * @see camera_start_face_detection() + * @see camera_stop_face_detection() + */ +bool camera_is_supported_face_detection(camera_h camera); + +/** + * @biref Gets zero shutter lag feature 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 + * + */ +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 + * + */ +int camera_get_device_count(camera_h camera, int *device_count); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_start_preview() + * @see camera_unset_preview_cb() + * @see camera_preview_cb() + */ +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 + * + * @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. + * + * @see camera_unset_state_changed_cb() + * @see camera_state_changed_cb() + */ +int camera_set_state_changed_cb(camera_h camera, camera_state_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_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 + * + * @see camera_unset_interrupted_cb() + * @see camera_interrupted_cb() + */ +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() + */ +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 + * @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. + * + * @see camera_start_focusing() + * @see camera_cancel_focusing() + * @see camera_unset_focus_changed_cb() + * @see camera_focus_changed_cb() + */ +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() + */ +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. + * + * @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() + */ +int camera_unset_error_cb(camera_h camera); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * @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. + * @see camera_attr_foreach_supported_exposure_mode() + * @see #camera_attr_exposure_mode_e + */ +typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode_e mode, + void *user_data); + +/** + * @brief Called to get each 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. + * @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. + * @see camera_attr_foreach_supported_whitebalance() + * @see #camera_attr_whitebalance_e + */ +typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e wb, + void *user_data); + +/** + * @brief Called to get each 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. + * @see camera_attr_foreach_supported_effect() + */ +typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect, + void *user_data); + +/** + * @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. + * @see camera_attr_foreach_supported_scene_mode() + * @see #camera_attr_scene_mode_e + */ +typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mode, + void *user_data); + +/** + * @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. + * @see camera_attr_foreach_supported_flash_mode() + */ +typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mode, + void *user_data); + +/** + * @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. + * @see camera_attr_foreach_supported_fps() + */ +typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @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 + * + * @see camera_start_preview() + * @see camera_attr_get_preview_fps() + * @see camera_attr_foreach_supported_fps() + */ +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 + * + * @see camera_attr_set_preview_fps() + * @see camera_attr_foreach_supported_fps() + */ +int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_preview_fps() + * @see camera_attr_get_preview_fps() + * @see camera_attr_supported_fps_cb() + */ +int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb callback, + void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @brief Sets the image quality. + * + * @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. + * + * @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 + * + * @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 + * + * @see camera_attr_get_zoom() + * @see camera_attr_get_zoom_range() + */ +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 + * + * @see camera_attr_set_zoom() + * @see camera_attr_get_zoom_range() + */ +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 + * + * @see camera_attr_set_zoom() + * @see camera_attr_get_zoom() + */ +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 + * + * @see camera_attr_get_af_mode() + * @see camera_attr_foreach_supported_af_mode() + * @see #camera_attr_af_mode_e + */ +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 + * + * @see camera_attr_foreach_supported_af_mode() + * @see camera_attr_set_af_mode() + * @see #camera_attr_af_mode_e + */ +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 + * + * @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 + * + * @see camera_attr_set_af_mode() + * @see camera_attr_set_af_area() + * + */ +int camera_attr_clear_af_area(camera_h camera); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_af_mode() + * @see camera_attr_get_af_mode() + * @see camera_attr_supported_af_mode_cb() + */ +int camera_attr_foreach_supported_af_mode(camera_h camera, + camera_attr_supported_af_mode_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @brief Sets the exposure mode. + * + * @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 + * + * @see camera_attr_get_exposure_mode() + * @see camera_attr_foreach_supported_exposure_mode() + */ +int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode); + +/** + * @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 + * + * @see camera_attr_set_exposure_mode() + * @see camera_attr_foreach_supported_exposure_mode() + */ +int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_exposure_mode() + * @see camera_attr_get_exposure_mode() + * @see camera_attr_supported_exposure_mode_cb() + */ +int camera_attr_foreach_supported_exposure_mode(camera_h camera, + camera_attr_supported_exposure_mode_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @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 + * + * @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 + * + * @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 + * + * @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 + * + * @see camera_attr_get_iso() + * @see camera_attr_foreach_supported_iso() + */ +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 + * + * @see camera_attr_set_iso() + * @see camera_attr_foreach_supported_iso() + */ +int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_iso() + * @see camera_attr_get_iso() + * @see camera_attr_supported_iso_cb() + */ +int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb callback, + void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + + +/** + * @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. + * + * @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 + * + * @see camera_attr_get_theater_mode() + */ +int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode); + + +/** + * @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 + * + * @see camera_attr_get_brightness() + * @see camera_attr_get_brightness_range() + */ +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 + * + * @see camera_attr_set_brightness() + * @see camera_attr_get_brightness_range() + */ +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 + * + * @see camera_attr_set_brightness() + * @see camera_attr_get_brightness() + */ +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 + * + * @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 + * + * @see camera_attr_set_contrast() + * @see camera_attr_get_contrast_range() + */ +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 + * + * @see camera_attr_set_contrast() + * @see camera_attr_get_contrast() + */ +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 + * + * @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 + * + * @see camera_attr_foreach_supported_whitebalance() + * @see camera_attr_set_whitebalance() + */ +int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *whitebalance); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_whitebalance() + * @see camera_attr_get_whitebalance() + * @see camera_attr_supported_whitebalance_cb() + */ +int camera_attr_foreach_supported_whitebalance(camera_h camera, + camera_attr_supported_whitebalance_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @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 + * + * @see camera_attr_foreach_supported_effect() + * @see camera_attr_get_effect() + */ +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 + * + * @see camera_attr_foreach_supported_effect() + * @see camera_attr_set_effect() + */ +int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_effect() + * @see camera_attr_get_effect() + * @see camera_attr_supported_effect_cb() + */ +int camera_attr_foreach_supported_effect(camera_h camera, + camera_attr_supported_effect_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @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 + * + * @see camera_attr_foreach_supported_scene_mode() + * @see camera_attr_get_scene_mode() + */ +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 + * + * @see camera_attr_foreach_supported_scene_mode() + * @see camera_attr_set_scene_mode() + */ +int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_scene_mode() + * @see camera_attr_get_scene_mode() + * @see camera_attr_supported_scene_mode_cb() + */ +int camera_attr_foreach_supported_scene_mode(camera_h camera, + camera_attr_supported_scene_mode_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @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 + * + * @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 + * + * @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() + */ +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() + */ +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 + * + * @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 + * + * @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() + */ +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() + */ +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() + */ +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() + */ +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() + */ +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 + * + * @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 + * + * @see camera_attr_foreach_supported_flash_mode() + * @see camera_attr_set_flash_mode() + */ +int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @{ + */ + +/** + * @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. + * + * @see camera_attr_set_flash_mode() + * @see camera_attr_get_flash_mode() + * @see camera_attr_supported_flash_mode_cb() + */ +int camera_attr_foreach_supported_flash_mode(camera_h camera, + camera_attr_supported_flash_mode_cb callback, void *user_data); + +/** + * @} + */ + +/** + * @addtogroup CAPI_MEDIA_CAMERA_ATTRIBUTES_MODULE + * @{ + */ + +/** + * @brief Gets the camera lens orientation angle. + * + * @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() + */ +int camera_attr_get_lens_orientation(camera_h camera, int *angle); + + +/** + * @brief Sets stream rotation + * + * @param[in] camera The handle to the camera + * @param[in] rotation The stream rotation + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_get_stream_rotation() + */ +int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation); + +/** + * @brief Gets stream rotation + * + * @param[in] camera The handle to the camera + * @param[out] rotation The stream rotation + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_set_stream_rotation() + */ +int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation); + + + +/** + * @brief Sets stream flip + * + * @param[in] camera The handle to the camera + * @param[in] flip The stream flip + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_set_stream_rotation() + */ +int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip); + +/** + * @brief Gets stream flip + * + * @param[in] camera The handle to the camera + * @param[out] flip The stream flip + * @return 0 on success, otherwise a negative error value. + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre The camera state must be CAMERA_STATE_CREATED. + * + * @see camera_attr_set_stream_rotation() + */ +int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip); + + + +/** + * @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 + * @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() + * @see camera_attr_is_supported_hdr_capture() + */ +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 + * + * @see camera_attr_get_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_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 + * + * @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 + * @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 + * + * @see camera_attr_set_hdr_mode() + * @see camera_attr_get_hdr_mode() + * @see camera_attr_unset_hdr_capture_progress_cb() + * @see camera_attr_is_supported_hdr_capture() + */ +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 + * + * @see camera_attr_set_hdr_mode() + * @see camera_attr_get_hdr_mode() + * @see camera_attr_set_hdr_capture_progress_cb() + * @see camera_attr_is_supported_hdr_capture() + */ +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 + * + * @see camera_attr_set_hdr_mode() + * @see camera_attr_get_hdr_mode() + * @see camera_attr_set_hdr_capture_progress_cb() + * @see camera_attr_unset_hdr_capture_progress_cb() + */ +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 + * + * @see camera_attr_is_enabled_anti_shake() + * @see camera_attr_is_supported_anti_shake() + * + */ +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 + * + * @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 + * + * @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 + * + * @see camera_attr_is_enabled_video_stabilization() + * @see camera_attr_is_supported_video_stabilization() + * + */ +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 + * + * @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 + * + * @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 + * + * @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 + * + * @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. + * + * @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 + */ +int camera_attr_disable_shutter_sound(camera_h camera, bool disable); + +/** + * @} + */ +#ifdef __cplusplus +} +#endif + +#endif /* __TIZEN_MULTIMEDIA_CAMERA_H__ */ + diff --git a/include/camera_private.h b/include/camera_private.h new file mode 100755 index 0000000..4b43ae6 --- /dev/null +++ b/include/camera_private.h @@ -0,0 +1,84 @@ +/* +* 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_MULTIMEDIA_CAMERA_PRIVATE_H__ +#define __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__ +#include <camera.h> +#include <mm_camcorder.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_DETECTED_FACE 20 + +typedef enum { + _CAMERA_EVENT_TYPE_STATE_CHANGE, + _CAMERA_EVENT_TYPE_FOCUS_CHANGE, + _CAMERA_EVENT_TYPE_CAPTURE_COMPLETE, + _CAMERA_EVENT_TYPE_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_NUM +}_camera_event_e; + +typedef struct _camera_s{ + MMHandleType mm_handle; + + void* user_cb[_CAMERA_EVENT_TYPE_NUM]; + void* user_data[_CAMERA_EVENT_TYPE_NUM]; + void* display_handle; + camera_display_type_e display_type; + int state; + + MMMessageCallback relay_message_callback; + void* relay_user_data; + int capture_count; + int capture_width; + int capture_height; + bool is_continuous_shot_break; + bool is_capture_completed; + int current_capture_count; + int current_capture_complete_count; + bool capture_resolution_modified; + camera_detected_face_s faceinfo[MAX_DETECTED_FACE]; + int num_of_faces; + bool hdr_keep_mode; + bool focus_area_valid; + bool is_used_in_recorder; + bool on_continuous_focusing; + int cached_focus_mode; +} camera_s; + +int _camera_get_mm_handle(camera_h camera , MMHandleType *handle); +int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data); +int __camera_start_continuous_focusing(camera_h camera); +int _camera_set_use(camera_h camera, bool used); +bool _camera_is_used(camera_h camera); + +#ifdef __cplusplus +} +#endif + +#endif //__TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__ + diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec new file mode 100755 index 0000000..607cb54 --- /dev/null +++ b/packaging/capi-media-camera.spec @@ -0,0 +1,60 @@ +Name: capi-media-camera +Summary: A Camera library in Tizen C API +Version: 0.1.3 +Release: 1 +Group: libdevel +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(mm-camcorder) +BuildRequires: pkgconfig(capi-base-common) +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description + + +%package devel +Summary: A Camera library in Tizen C API (Development) +Group: TO_BE/FILLED_IN +Requires: %{name} = %{version}-%{release} + +%description devel + + + +%prep +%setup -q + + +%build +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} + + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install +mkdir -p %{buildroot}/usr/share/license +cp LICENSE.APLv2 %{buildroot}/usr/share/license/%{name} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%manifest capi-media-camera.manifest +%{_libdir}/libcapi-media-camera.so.* +%{_datadir}/license/%{name} + + +%files devel +%{_includedir}/media/camera.h +%{_libdir}/pkgconfig/*.pc +%{_libdir}/libcapi-media-camera.so + + diff --git a/src/camera.c b/src/camera.c new file mode 100755 index 0000000..b128fdf --- /dev/null +++ b/src/camera.c @@ -0,0 +1,2745 @@ +/* +* 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 <math.h> +#include <camera.h> +#include <camera_private.h> +#include <glib.h> +#include <dlog.h> + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "TIZEN_N_CAMERA" + +static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * stream, void *user_data); +static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data); + + +static int __convert_camera_error_code(const char* func, int code){ + int ret = CAMERA_ERROR_NONE; + 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 : + ret = CAMERA_ERROR_INVALID_PARAMETER; + errorstr = "INVALID_PARAMETER"; + break; + 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 : + 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 : + 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 : + 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 : + ret = CAMERA_ERROR_INVALID_OPERATION; + errorstr = "INVALID_OPERATION"; + break; + + case MM_ERROR_CAMCORDER_RESOURCE_CREATION : + case MM_ERROR_COMMON_OUT_OF_MEMORY: + ret = CAMERA_ERROR_OUT_OF_MEMORY; + errorstr = "OUT_OF_MEMORY"; + break; + + case MM_ERROR_POLICY_BLOCKED: + ret = CAMERA_ERROR_SOUND_POLICY; + errorstr = "ERROR_SOUND_POLICY"; + break; + case MM_ERROR_POLICY_RESTRICTED: + ret = CAMERA_ERROR_SECURITY_RESTRICTED; + errorstr = "ERROR_RESTRICTED"; + 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); + return ret; +} + + +static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * stream, void *user_data){ + if( user_data == NULL || stream == NULL) + return 0; + + camera_s * handle = (camera_s*)user_data; + if( handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] ){ + camera_preview_data_s frame; + frame.format = stream->format; + if( frame.format == (camera_pixel_format_e)MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) + frame.format = MM_PIXEL_FORMAT_UYVY; + frame.width = stream->width; + frame.height = stream->height; + frame.timestamp = stream->timestamp; + frame.num_of_planes = stream->num_planes; + switch( stream->data_type ){ + case MM_CAM_STREAM_DATA_YUV420 : + 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 : + 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 : + 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 : + 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; + frame.data.triple_plane.y_size = stream->data.yuv420p.length_y; + 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 : + 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; + frame.data.triple_plane.y_size = stream->data.yuv422p.length_y; + frame.data.triple_plane.u_size = stream->data.yuv422p.length_u; + frame.data.triple_plane.v_size = stream->data.yuv422p.length_v; + break; + } + ((camera_preview_cb)handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW])(&frame, handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW]); + } + return 1; +} +static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data){ + if( user_data == NULL || frame == NULL) + return 0; + + camera_s * handle = (camera_s*)user_data; + handle->current_capture_count++; + if( handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] ){ + MMCamcorderCaptureDataType *scrnl = NULL; + int size = 0; + camera_image_data_s image = { NULL, 0, 0, 0, 0, NULL, 0 }; + camera_image_data_s thumb = { NULL, 0, 0, 0, 0, NULL, 0 }; + camera_image_data_s postview = { NULL, 0, 0, 0, 0, NULL, 0 }; + if( frame ){ + int ret; + unsigned char *exif; + int exif_size; + image.data = frame->data; + image.size = frame->length; + image.width = frame->width; + 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 ){ + image.exif = exif; + image.exif_size = exif_size; + } + } + + if( thumbnail ){ + thumb.data = thumbnail->data; + thumb.size = thumbnail->length; + thumb.width = thumbnail->width; + thumb.height = thumbnail->height; + thumb.format = thumbnail->format; + } + mm_camcorder_get_attributes( handle->mm_handle, NULL, "captured-screennail", &scrnl, &size,NULL ); + if( scrnl ){ + postview.data = scrnl->data; + postview.size = scrnl->length; + postview.width = scrnl->width; + postview.height = scrnl->height; + postview.format = scrnl->format; + } + + ((camera_capturing_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE])(&image, scrnl ? &postview : NULL, thumbnail ? &thumb : NULL, handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE]); + } + // update captured state + if( handle->capture_count == 1 && handle->hdr_keep_mode ){ + 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) + handle->is_capture_completed = true; + return 1; +} + +static camera_state_e __camera_state_convert(MMCamcorderStateType mm_state) +{ + camera_state_e state = CAMERA_STATE_NONE; + + switch( mm_state ){ + case MM_CAMCORDER_STATE_NONE: + state = CAMERA_STATE_NONE; + break; + case MM_CAMCORDER_STATE_NULL: + state = CAMERA_STATE_CREATED; + break; + case MM_CAMCORDER_STATE_READY: + state = CAMERA_STATE_CREATED; + break; + case MM_CAMCORDER_STATE_PREPARE: + state = CAMERA_STATE_PREVIEW; + break; + case MM_CAMCORDER_STATE_CAPTURING: + state = CAMERA_STATE_CAPTURING; + break; + case MM_CAMCORDER_STATE_RECORDING: + state = CAMERA_STATE_PREVIEW; + break; + case MM_CAMCORDER_STATE_PAUSED: + state = CAMERA_STATE_PREVIEW; + break; + default: + state = CAMERA_STATE_NONE; + break; + } + + return state; +} + + +static int __mm_camera_message_callback(int message, void *param, void *user_data){ + if( user_data == NULL || param == NULL ) + return 0; + + camera_s * handle = (camera_s*)user_data; + + if( handle->relay_message_callback ) + handle->relay_message_callback(message, param, handle->relay_user_data); + + MMMessageParamType *m = (MMMessageParamType*)param; + camera_state_e previous_state; + + + switch(message){ + case MM_MESSAGE_CAMCORDER_STATE_CHANGED: + case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM: + case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY: + if( message == MM_MESSAGE_CAMCORDER_STATE_CHANGED && (m->state.previous < MM_CAMCORDER_STATE_NONE || m->state.previous > MM_CAMCORDER_STATE_PAUSED || m->state.code != 0) ){ + LOGI( "Invalid state changed message"); + break; + } + + previous_state = handle->state; + handle->state = __camera_state_convert(m->state.current ); + camera_policy_e policy = CAMERA_POLICY_NONE; + if(message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM ) + policy = CAMERA_POLICY_SOUND; + else if( message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY ) + policy = CAMERA_POLICY_SECURITY; + + if( previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] ){ + ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(previous_state, handle->state, policy, handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); + } + + // 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] ) + ((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); + } + } + + break; + case MM_MESSAGE_CAMCORDER_FOCUS_CHANGED : + if( handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] ){ + ((camera_focus_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE])( m->code, handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE]); + } + break; + 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) ){ + //pseudo state change + previous_state = handle->state ; + handle->state = CAMERA_STATE_CAPTURED; + if( previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] ){ + ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(previous_state, handle->state, 0 , handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); + } + if( handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] ){ + ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); + } + } + break; + } + case MM_MESSAGE_CAMCORDER_VIDEO_CAPTURED: + case MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED: + { + MMCamRecordingReport *report = (MMCamRecordingReport *)m ->data; + if( report != NULL && report->recording_filename ){ + free(report->recording_filename ); + report->recording_filename = NULL; + } + if( report ){ + free(report); + report = NULL; + } + break; + } + case MM_MESSAGE_CAMCORDER_VIDEO_SNAPSHOT_CAPTURED: + { + if( handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] ){ + ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); + } + break; + } + case MM_MESSAGE_CAMCORDER_ERROR: + { + int errorcode = m->code; + 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 : + 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_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 : + camera_error = CAMERA_ERROR_OUT_OF_MEMORY; + break; + } + 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]); + + break; + } + case MM_MESSAGE_CAMCORDER_HDR_PROGRESS: + { + int percent = m->code; + if( handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] ) + ((camera_attr_hdr_progress_cb)handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS])(percent, handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS]); + break; + } + case MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO: + { + MMCamFaceDetectInfo *cam_fd_info = (MMCamFaceDetectInfo *)(m->data); + if ( cam_fd_info ) { + camera_detected_face_s faces[cam_fd_info->num_of_faces]; + handle->num_of_faces = cam_fd_info->num_of_faces > MAX_DETECTED_FACE ? MAX_DETECTED_FACE : cam_fd_info->num_of_faces; + int i; + for(i=0; i < handle->num_of_faces ; i++){ + faces[i].id = cam_fd_info->face_info[i].id; + faces[i].score = cam_fd_info->face_info[i].score; + faces[i].x = cam_fd_info->face_info[i].rect.x; + faces[i].y = cam_fd_info->face_info[i].rect.y; + faces[i].width = cam_fd_info->face_info[i].rect.width; + faces[i].height = cam_fd_info->face_info[i].rect.height; + handle->faceinfo[i] = faces[i]; //cache face coordinate + } + if( handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION] ) + ((camera_face_detected_cb)handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION])(faces, handle->num_of_faces, handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION]); + }else{ + handle->num_of_faces = 0; + } + break; + } + } + + return 1; +} + +static int __capture_completed_event_cb(void *data){ + camera_s *handle = (camera_s*)data; + if( handle->current_capture_count > 0 && handle->current_capture_count == handle->current_capture_complete_count && handle->state == CAMERA_STATE_CAPTURING ){ + //pseudo state change + camera_state_e previous_state = handle->state; + handle->state = CAMERA_STATE_CAPTURED; + if( previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] ){ + ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(previous_state, handle->state, 0 , handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); + } + if( handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] ){ + ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); + } + } + return false; +} + +int camera_create( camera_device_e device, camera_h* camera){ + + if( camera == NULL){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + MMCamPreset info; + 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; + + camera_s* handle = (camera_s*)malloc( sizeof(camera_s) ); + if(handle==NULL){ + LOGE("[%s] malloc fail",__func__); + 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){ + free(handle); + return __convert_camera_error_code(__func__,ret); + } + + 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); + + 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); + + handle->display_type = CAMERA_DISPLAY_TYPE_NONE; + + if( ret != MM_ERROR_NONE){ + LOGE("[%s] mm_camcorder_set_attributes fail(%x, %s)",__func__, ret, error); + mm_camcorder_destroy(handle->mm_handle); + free(error); + free(handle); + return __convert_camera_error_code(__func__, ret); + } + + handle->state = CAMERA_STATE_CREATED; + handle->relay_message_callback = NULL; + handle->relay_user_data = NULL; + handle->capture_resolution_modified = false; + handle->hdr_keep_mode = false; + handle->focus_area_valid = false; + handle->is_used_in_recorder = false; + handle->on_continuous_focusing = false; + handle->cached_focus_mode = -1; + mm_camcorder_set_message_callback(handle->mm_handle, __mm_camera_message_callback, (void*)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); + 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__); + return CAMERA_ERROR_INVALID_OPERATION; + } + + ret = mm_camcorder_destroy(handle->mm_handle); + + if( ret == MM_ERROR_NONE) + 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); + 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 ) + { + 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 + mm_camcorder_set_video_capture_callback( handle->mm_handle, (mm_camcorder_video_capture_callback)__mm_capture_callback, (void*)handle); + + MMCamcorderStateType state ; + mm_camcorder_get_state(handle->mm_handle, &state); + if( state != MM_CAMCORDER_STATE_READY){ + ret = mm_camcorder_realize(handle->mm_handle); + 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){ + mm_camcorder_unrealize(handle->mm_handle); + } + + return __convert_camera_error_code(__func__, ret); +} + +int camera_stop_preview(camera_h camera){ + 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; + MMCamcorderStateType state ; + mm_camcorder_get_state(handle->mm_handle, &state); + + if( state == MM_CAMCORDER_STATE_PREPARE ){ + ret = mm_camcorder_stop(handle->mm_handle); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + camera_s * handle = (camera_s*)camera; + 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); + 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); + handle->capture_resolution_modified = false; + } + mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAPTURE_COUNT , 1,NULL); + + handle->capture_count = 1; + handle->is_continuous_shot_break = false; + handle->current_capture_count = 0; + handle->current_capture_complete_count = 0; + handle->is_capture_completed = false; + + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)capturing_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)user_data; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)completed_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)user_data; + ret = mm_camcorder_capture_start(handle->mm_handle); + if( ret != 0 ){ + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = NULL; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = NULL; + } + + return __convert_camera_error_code(__func__, ret); +} + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( count < 2 || interval < 0 ){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + camera_s * handle = (camera_s*)camera; + + 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); + 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 ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAPTURE_COUNT , count, + MMCAM_CAPTURE_INTERVAL, interval, + NULL); + if( ret != 0 ){ + LOGE("[%s] (%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; + + if( ret != 0 ){ + LOGE("[%s] (%x) error get continuous shot attribute", ret); + } + + if( !supported_ZSL ){ + 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); + 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); + handle->capture_resolution_modified = true; + } + } + + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)capturing_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)user_data; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)completed_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)user_data; + + ret = mm_camcorder_capture_start(handle->mm_handle); + if( ret != 0 ){ + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = NULL; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = NULL; + } + + return __convert_camera_error_code(__func__,ret); + +} + +int camera_stop_continuous_capture(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; + 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); + return CAMERA_ERROR_INVALID_STATE; + } + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, "capture-break-cont-shot", 1, NULL); + if( ret == 0){ + handle->is_continuous_shot_break = true; + 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); + } + + return __convert_camera_error_code(__func__,ret); +} + +bool camera_is_supported_face_detection(camera_h camera){ + if( camera == NULL){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,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_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 ) + return true; + } + } + 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); + 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; + } + } + return false; +} + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + ret = mm_camcorder_get_attributes(handle->mm_handle, 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + 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); + 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 ){ + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + camera_s * handle = (camera_s*)camera; + int ret; + 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; + handle->num_of_faces = 0; + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + camera_s *handle = (camera_s*)camera; + camera_state_e capi_state; + MMCamcorderStateType mmstate ; + mm_camcorder_get_state(handle->mm_handle, &mmstate); + + capi_state = __camera_state_convert(mmstate); + + if( ( handle->state == CAMERA_STATE_CAPTURED || 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); + 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); + mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_AF_SCAN_RANGE , handle->cached_focus_mode, NULL); + handle->cached_focus_mode = -1; + } + + if( continuous ) + return __camera_start_continuous_focusing(camera); + else{ + mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FOCUS_MODE, handle->focus_area_valid ? MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO : MM_CAMCORDER_FOCUS_MODE_AUTO, NULL); + return __convert_camera_error_code(__func__, mm_camcorder_start_focusing(((camera_s*)camera)->mm_handle)); + } +} + +int __camera_start_continuous_focusing(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; + 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 + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_CONTINUOUS, NULL); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + camera_s *handle = (camera_s*)camera; + handle->on_continuous_focusing = false; + 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 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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270 ) + return CAMERA_ERROR_INVALID_PARAMETER; + + int ret; + camera_s * handle = (camera_s*)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_ROTATION , rotation, NULL); + return __convert_camera_error_code(__func__, ret); +} + +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( 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); + 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_capture_resolution(camera_h camera, int width, int height){ + 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; + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAPTURE_WIDTH, width ,MMCAM_CAPTURE_HEIGHT , height, NULL); + if( ret == 0 ){ + 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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + int ret; + camera_s * handle = (camera_s*)camera; + + if( format == CAMERA_PIXEL_FORMAT_UYVY ){ + bool supported_ITLV_UYVY = false; + 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++){ + 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, 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); + 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); + return __convert_camera_error_code(__func__, ret); + +} + +int camera_get_x11_display_rotation( camera_h camera, camera_rotation_e *rotation){ + if( camera == NULL || rotation == NULL ){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_ROTATION , rotation, NULL); + 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); + 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); + 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); + 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_DISPLAY_VISIBLE , &result, NULL); + if( ret == 0) + *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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( ratio < CAMERA_DISPLAY_MODE_LETTER_BOX || ratio > 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + 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); + 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); + 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; + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo preview_width; + MMCamAttrsInfo preview_height; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_WIDTH , &preview_width); + ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_HEIGHT , &preview_height); + + if( ret != CAMERA_ERROR_NONE ) + 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) ) + break; + } + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + int ret; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo capture_width; + MMCamAttrsInfo capture_height; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_WIDTH , &capture_width); + ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_HEIGHT , &capture_height); + + if( ret != CAMERA_ERROR_NONE ) + return __convert_camera_error_code(__func__, ret); + + int i; + for( i=0 ; i < capture_width.int_array.count ; i++) + { + if ( !foreach_cb(capture_width.int_array.array[i], capture_height.int_array.array[i],user_data) ) + break; + } + return CAMERA_ERROR_NONE; +} + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo format; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_FORMAT , &format); + + if( ret != CAMERA_ERROR_NONE ) + return __convert_camera_error_code(__func__, ret); + + int 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; + +} + + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + int ret; + camera_s * handle = (camera_s*)camera; + MMCamAttrsInfo format; + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT , &format); + + if( ret != CAMERA_ERROR_NONE ) + return __convert_camera_error_code(__func__, ret); + + int 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; + +} + + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + enum MMCamcorderPreviewType wide; + int capture_w, capture_h; + double ratio; + int ret; + camera_s * handle = (camera_s*)camera; + + camera_get_capture_resolution(camera, &capture_w, &capture_h); + ratio = (double)capture_w/(double)capture_h; + if( ratio > 1.5 ) + wide = MM_CAMCORDER_PREVIEW_TYPE_WIDE; + 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 ) + *width = width_info.int_array.array[wide]; + + if( height ) + *height = height_info.int_array.array[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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + int rotation; + ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation , NULL); + + switch( rotation ) { + case MM_DISPLAY_ROTATION_NONE: + *angle = 0; + break; + case MM_DISPLAY_ROTATION_90: + *angle = 270; + break; + case MM_DISPLAY_ROTATION_180: + *angle = 180; + break; + case MM_DISPLAY_ROTATION_270: + *angle = 90; + 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); + 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); + 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_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); + 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); + } + 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); + 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); + +} +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); + 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); + 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); + +} + + +int camera_attr_set_zoom(camera_h camera, int zoom){ + 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; + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_DIGITAL_ZOOM , zoom, NULL); + 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); + 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); + 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){ + handle->cached_focus_mode = mode; + LOGD("[%s] af mode will be set actually start focusing",__func__); + return __convert_camera_error_code(__func__, 0); + }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){ + case CAMERA_ATTR_AF_NONE: + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_NONE, + MMCAM_CAMERA_AF_SCAN_RANGE , MM_CAMCORDER_AUTO_FOCUS_NORMAL, NULL); + break; + 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); + 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); + 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); + break; + default: + return ret; + } + + return __convert_camera_error_code(__func__, ret); +} + +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); + 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); + 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 ) + 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); + 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; +} + +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); + 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 + MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1, //CAMCORDER_EXPOSURE_MODE_SPOT + MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1,//CAMCORDER_EXPOSURE_MODE_CUSTOM + }; + + 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); + +} + +int camera_attr_set_exposure(camera_h camera, int value){ + 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; + 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); + 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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + 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); + +} + +int camera_attr_set_contrast(camera_h camera, int level){ + 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; + 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); + 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); + +} + +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); + 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); + 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); + 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); + +} + + +int camera_attr_enable_tag(camera_h camera, bool enable){ + 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; + 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); + 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); + +} + +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); + 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); + +} + +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); + 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); + +} + +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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + +} + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + 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 ) + *max = ainfo.int_range.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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + int focus_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){ + 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; + 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; + } + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int maptable[] = { + CAMERA_ATTR_EXPOSURE_MODE_OFF, //MM_CAMCORDER_AUTO_EXPOSURE_OFF + CAMERA_ATTR_EXPOSURE_MODE_ALL, //MM_CAMCORDER_AUTO_EXPOSURE_ALL + CAMERA_ATTR_EXPOSURE_MODE_CENTER, //MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1 + CAMERA_ATTR_EXPOSURE_MODE_CENTER, //MM_CAMCORDER_AUTO_EXPOSURE_CENTER_2 + CAMERA_ATTR_EXPOSURE_MODE_CENTER, //MM_CAMCORDER_AUTO_EXPOSURE_CENTER_3 + CAMERA_ATTR_EXPOSURE_MODE_SPOT, //MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1 + CAMERA_ATTR_EXPOSURE_MODE_SPOT, //MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM,//MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM //MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 + }; + 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); + if( ret == CAMERA_ERROR_NONE ){ + *mode = maptable[abs(exposure_mode%9)]; + } + 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); + 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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + 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 ) + *max = ainfo.int_range.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); + 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); + +} + +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); + 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); + +} + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + 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 ) + *max = ainfo.int_range.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); + 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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + 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 ) + *max = ainfo.int_range.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); + 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); + +} + +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); + 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); + + if( ret != CAMERA_ERROR_NONE ) + return __convert_camera_error_code(__func__, ret); + + *effect = (camera_attr_effect_mode_e)tone; + + return __convert_camera_error_code(__func__, ret); +} + +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); + 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); + +} + + +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); + 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); + + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + 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); + if( ret == CAMERA_ERROR_NONE ){ + if( ndescription != NULL ) + *description = strdup(ndescription); + else + *description = strdup(""); + } + + 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); + 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); + +} +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + 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); + 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); + 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); + 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); + 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); + 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); + 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); + + 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) ) + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int maptable[] = { + CAMERA_ATTR_EXPOSURE_MODE_OFF, //MM_CAMCORDER_AUTO_EXPOSURE_OFF + CAMERA_ATTR_EXPOSURE_MODE_ALL, //MM_CAMCORDER_AUTO_EXPOSURE_ALL + CAMERA_ATTR_EXPOSURE_MODE_CENTER, //MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1 + -1, //MM_CAMCORDER_AUTO_EXPOSURE_CENTER_2 + -1, //MM_CAMCORDER_AUTO_EXPOSURE_CENTER_3 + CAMERA_ATTR_EXPOSURE_MODE_SPOT, //MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1 + -1, //MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM,//MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 + -1//MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 + }; + int ret; + 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){ + if ( !foreach_cb(maptable[info.int_array.array[i]],user_data) ) + break; + } + } + 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); + 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) ) + break; + } + 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); + 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); + 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_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); + 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_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++) + { + int effect = info.int_array.array[i]; + if ( !foreach_cb(effect,user_data) ) + break; + } + 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); + 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_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++) + { + if ( !foreach_cb(info.int_array.array[i],user_data) ) + break; + } + 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); + 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) ) + break; + } + 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); + 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) ) + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270 ) + return CAMERA_ERROR_INVALID_PARAMETER; + + int ret; + camera_s * handle = (camera_s*)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_ROTATION , rotation, NULL); + return __convert_camera_error_code(__func__, ret); +} + +int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation){ + if( camera == NULL || rotation == NULL ){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret; + camera_s * handle = (camera_s*)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_ROTATION , rotation, NULL); + return __convert_camera_error_code(__func__, ret); +} + +int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip){ + if( camera == NULL){ + LOGE( "[%s] INVALID_PARAMETER(0x%08x)",__func__,CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if( flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH ) + return CAMERA_ERROR_INVALID_PARAMETER; + + int ret; + camera_s * handle = (camera_s*)camera; + 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); + 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); + 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; +} + +bool _camera_is_used(camera_h camera){ + camera_s * handle = (camera_s*)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); + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + camera_s *handle = (camera_s*)camera; + handle->relay_message_callback = callback; + handle->relay_user_data = user_data; + + return CAMERA_ERROR_NONE; +} + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + 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 ){ + 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); + 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; + } + 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); + 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; + } + 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); + 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) { + return true; + } + } + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + camera_s * handle = (camera_s*)camera; + handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)callback; + handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)user_data; + return CAMERA_ERROR_NONE; +} + +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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + 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); + 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); + 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 ) + *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); + 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); + + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + 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); + 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); + 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 ) + *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); + 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); + + 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); + return CAMERA_ERROR_INVALID_PARAMETER; + } + 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); + 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); + 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 ) + *enabled = mode; + return __convert_camera_error_code(__func__, ret); +} + +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); + 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); + if( ret != 0 ){ + LOGE("[%s] CAMERA_ERROR_INVALID_OPERATION : not permitted disable shutter sound", __func__); + return CAMERA_ERROR_INVALID_OPERATION; + } + return CAMERA_ERROR_NONE; +} @@ -0,0 +1,652 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.8 // +-dbg-package debian/rules /^ dh_strip --dbg-package=capi-media-camera-dbg$/;" m +-sourcedir debian/rules /^ dh_install --sourcedir=debian\/tmp$/;" m +CAMERA_ATTR_AF_FULL include/camera.h /^ CAMERA_ATTR_AF_FULL, \/**< auto-focus in full mode(all range scan, limited by dev spec) *\/$/;" e enum:__anon17 +CAMERA_ATTR_AF_MACRO include/camera.h /^ CAMERA_ATTR_AF_MACRO, \/**< auto-focus in macro mode(close distance) *\/$/;" e enum:__anon17 +CAMERA_ATTR_AF_NONE include/camera.h /^ CAMERA_ATTR_AF_NONE = 0, \/**< auto-focus is not set *\/$/;" e enum:__anon17 +CAMERA_ATTR_AF_NORMAL include/camera.h /^ CAMERA_ATTR_AF_NORMAL, \/**< auto-focus normally *\/$/;" e enum:__anon17 +CAMERA_ATTR_EFFECT_ANTIQUE include/camera.h /^ CAMERA_ATTR_EFFECT_ANTIQUE, \/**< Antique *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_AQUA include/camera.h /^ CAMERA_ATTR_EFFECT_AQUA, \/**< Aqua *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_BLUE include/camera.h /^ CAMERA_ATTR_EFFECT_BLUE, \/**< Blue *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_EMBOSS include/camera.h /^ CAMERA_ATTR_EFFECT_EMBOSS, \/**< Emboss *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_GRAY include/camera.h /^ CAMERA_ATTR_EFFECT_GRAY, \/**< Gray *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_GREEN include/camera.h /^ CAMERA_ATTR_EFFECT_GREEN, \/**< Green *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_MONO include/camera.h /^ CAMERA_ATTR_EFFECT_MONO, \/**< Mono *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_NEGATIVE include/camera.h /^ CAMERA_ATTR_EFFECT_NEGATIVE, \/**< Negative *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_NONE include/camera.h /^ CAMERA_ATTR_EFFECT_NONE = 0, \/**< None *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_ORANGE include/camera.h /^ CAMERA_ATTR_EFFECT_ORANGE, \/**< Orange *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_OUTLINE include/camera.h /^ CAMERA_ATTR_EFFECT_OUTLINE, \/**< Outline *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_PINK include/camera.h /^ CAMERA_ATTR_EFFECT_PINK, \/**< Pink *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_PURPLE include/camera.h /^ CAMERA_ATTR_EFFECT_PURPLE, \/**< Purple *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_RED include/camera.h /^ CAMERA_ATTR_EFFECT_RED, \/**< Red *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_SEPIA include/camera.h /^ CAMERA_ATTR_EFFECT_SEPIA, \/**< Sepia *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_SKETCH include/camera.h /^ CAMERA_ATTR_EFFECT_SKETCH, \/**< Sketch *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_SOLARIZATION include/camera.h /^ CAMERA_ATTR_EFFECT_SOLARIZATION, \/**< Solarization *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_VIOLET include/camera.h /^ CAMERA_ATTR_EFFECT_VIOLET, \/**< Violet *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_WARM include/camera.h /^ CAMERA_ATTR_EFFECT_WARM, \/**< Warm *\/$/;" e enum:__anon14 +CAMERA_ATTR_EFFECT_YELLOW include/camera.h /^ CAMERA_ATTR_EFFECT_YELLOW, \/**< Yellow *\/$/;" e enum:__anon14 +CAMERA_ATTR_EXPOSURE_MODE_ALL include/camera.h /^ CAMERA_ATTR_EXPOSURE_MODE_ALL, \/**< All mode*\/$/;" e enum:__anon20 +CAMERA_ATTR_EXPOSURE_MODE_CENTER include/camera.h /^ CAMERA_ATTR_EXPOSURE_MODE_CENTER, \/**< Center mode*\/$/;" e enum:__anon20 +CAMERA_ATTR_EXPOSURE_MODE_CUSTOM include/camera.h /^ CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, \/**< Custom mode*\/$/;" e enum:__anon20 +CAMERA_ATTR_EXPOSURE_MODE_OFF include/camera.h /^ CAMERA_ATTR_EXPOSURE_MODE_OFF = 0, \/**< Off*\/$/;" e enum:__anon20 +CAMERA_ATTR_EXPOSURE_MODE_SPOT include/camera.h /^ CAMERA_ATTR_EXPOSURE_MODE_SPOT, \/**< Spot mode*\/$/;" e enum:__anon20 +CAMERA_ATTR_FLASH_MODE_AUTO include/camera.h /^ CAMERA_ATTR_FLASH_MODE_AUTO, \/**< Depending on intensity of light, strobe starts to flash. *\/$/;" e enum:__anon22 +CAMERA_ATTR_FLASH_MODE_FRONT_CURTAIN include/camera.h /^ CAMERA_ATTR_FLASH_MODE_FRONT_CURTAIN, \/**< Front curtain synchronization. *\/$/;" e enum:__anon22 +CAMERA_ATTR_FLASH_MODE_OFF include/camera.h /^ CAMERA_ATTR_FLASH_MODE_OFF = 0, \/**< Always off *\/$/;" e enum:__anon22 +CAMERA_ATTR_FLASH_MODE_ON include/camera.h /^ CAMERA_ATTR_FLASH_MODE_ON, \/**< Always splashes *\/$/;" e enum:__anon22 +CAMERA_ATTR_FLASH_MODE_PERMANENT include/camera.h /^ CAMERA_ATTR_FLASH_MODE_PERMANENT, \/**< keep turned on until turning off *\/$/;" e enum:__anon22 +CAMERA_ATTR_FLASH_MODE_REAR_CURTAIN include/camera.h /^ CAMERA_ATTR_FLASH_MODE_REAR_CURTAIN, \/**< Rear curtain synchronization. *\/$/;" e enum:__anon22 +CAMERA_ATTR_FLASH_MODE_REDEYE_REDUCTION include/camera.h /^ CAMERA_ATTR_FLASH_MODE_REDEYE_REDUCTION, \/**< Red eye reduction. Multiple flash before capturing. *\/$/;" e enum:__anon22 +CAMERA_ATTR_FLASH_MODE_SLOW_SYNC include/camera.h /^ CAMERA_ATTR_FLASH_MODE_SLOW_SYNC, \/**< Slow sync curtain synchronization*\/$/;" e enum:__anon22 +CAMERA_ATTR_FPS_120 include/camera.h /^ CAMERA_ATTR_FPS_120 = 120 \/**< 120 FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_FPS_15 include/camera.h /^ CAMERA_ATTR_FPS_15 = 15, \/**< 15 FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_FPS_24 include/camera.h /^ CAMERA_ATTR_FPS_24 = 24, \/**< 24 FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_FPS_25 include/camera.h /^ CAMERA_ATTR_FPS_25 = 25, \/**< 25 FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_FPS_30 include/camera.h /^ CAMERA_ATTR_FPS_30 = 30, \/**< 30 FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_FPS_60 include/camera.h /^ CAMERA_ATTR_FPS_60 = 60, \/**< 60 FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_FPS_8 include/camera.h /^ CAMERA_ATTR_FPS_8 = 8, \/**< 8 FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_FPS_AUTO include/camera.h /^ CAMERA_ATTR_FPS_AUTO = 0, \/**< AUTO FPS *\/$/;" e enum:__anon23 +CAMERA_ATTR_ISO_100 include/camera.h /^ CAMERA_ATTR_ISO_100, \/**< ISO 100*\/$/;" e enum:__anon19 +CAMERA_ATTR_ISO_1600 include/camera.h /^ CAMERA_ATTR_ISO_1600, \/**< ISO 1600*\/$/;" e enum:__anon19 +CAMERA_ATTR_ISO_200 include/camera.h /^ CAMERA_ATTR_ISO_200, \/**< ISO 200*\/$/;" e enum:__anon19 +CAMERA_ATTR_ISO_3200 include/camera.h /^ CAMERA_ATTR_ISO_3200, \/**< ISO 3200*\/$/;" e enum:__anon19 +CAMERA_ATTR_ISO_400 include/camera.h /^ CAMERA_ATTR_ISO_400, \/**< ISO 400*\/$/;" e enum:__anon19 +CAMERA_ATTR_ISO_50 include/camera.h /^ CAMERA_ATTR_ISO_50, \/**< ISO 50*\/$/;" e enum:__anon19 +CAMERA_ATTR_ISO_800 include/camera.h /^ CAMERA_ATTR_ISO_800, \/**< ISO 800*\/$/;" e enum:__anon19 +CAMERA_ATTR_ISO_AUTO include/camera.h /^ CAMERA_ATTR_ISO_AUTO = 0, \/**< ISO auto mode*\/$/;" e enum:__anon19 +CAMERA_ATTR_SCENE_MODE_BACKLIGHT include/camera.h /^ CAMERA_ATTR_SCENE_MODE_BACKLIGHT, \/**< Backlight *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_BEACH_N_INDOOR include/camera.h /^ CAMERA_ATTR_SCENE_MODE_BEACH_N_INDOOR, \/**< Beach & indoor *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_CANDLE_LIGHT include/camera.h /^ CAMERA_ATTR_SCENE_MODE_CANDLE_LIGHT, \/**< Candle light *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_DUSK_N_DAWN include/camera.h /^ CAMERA_ATTR_SCENE_MODE_DUSK_N_DAWN, \/**< Dusk & dawn *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_FALL_COLOR include/camera.h /^ CAMERA_ATTR_SCENE_MODE_FALL_COLOR, \/**< Fall *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_FIREWORK include/camera.h /^ CAMERA_ATTR_SCENE_MODE_FIREWORK, \/**< Firework *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_LANDSCAPE include/camera.h /^ CAMERA_ATTR_SCENE_MODE_LANDSCAPE, \/**< Landscape *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_NIGHT_SCENE include/camera.h /^ CAMERA_ATTR_SCENE_MODE_NIGHT_SCENE, \/**< Night scene *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_NORMAL include/camera.h /^ CAMERA_ATTR_SCENE_MODE_NORMAL = 0, \/**< Normal *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_PARTY_N_INDOOR include/camera.h /^ CAMERA_ATTR_SCENE_MODE_PARTY_N_INDOOR, \/**< Party & indoor *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_PORTRAIT include/camera.h /^ CAMERA_ATTR_SCENE_MODE_PORTRAIT, \/**< Portrait *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_SHOW_WINDOW include/camera.h /^ CAMERA_ATTR_SCENE_MODE_SHOW_WINDOW, \/**< Show window *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_SPORTS include/camera.h /^ CAMERA_ATTR_SCENE_MODE_SPORTS, \/**< Sports *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_SUNSET include/camera.h /^ CAMERA_ATTR_SCENE_MODE_SUNSET, \/**< Sunset *\/$/;" e enum:__anon16 +CAMERA_ATTR_SCENE_MODE_TEXT include/camera.h /^ CAMERA_ATTR_SCENE_MODE_TEXT, \/**< Text *\/$/;" e enum:__anon16 +CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_LEFT include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_LEFT = 4, \/**< Row #0 is bottom, Column #0 is left *\/$/;" e enum:__anon21 +CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_RIGHT include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_RIGHT = 3, \/**< Row #0 is bottom, Column #0 is right *\/$/;" e enum:__anon21 +CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM = 8, \/**< Row #0 is left, Column #0 is bottom *\/$/;" e enum:__anon21 +CAMERA_ATTR_TAG_ORIENTATION_LEFT_TOP include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_LEFT_TOP = 5, \/**< Row #0 is left, Column #0 is top *\/$/;" e enum:__anon21 +CAMERA_ATTR_TAG_ORIENTATION_RIGHT_BOTTOM include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_RIGHT_BOTTOM = 7, \/**< Row #0 is right, Column #0 is bottom *\/$/;" e enum:__anon21 +CAMERA_ATTR_TAG_ORIENTATION_RIGHT_TOP include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_RIGHT_TOP = 6, \/**< Row #0 is right, Column #0 is top *\/$/;" e enum:__anon21 +CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT = 1, \/**< Row #0 is top, Column #0 is left *\/$/;" e enum:__anon21 +CAMERA_ATTR_TAG_ORIENTATION_TOP_RIGHT include/camera.h /^ CAMERA_ATTR_TAG_ORIENTATION_TOP_RIGHT = 2, \/**< Row #0 is top, Column #0 is right *\/$/;" e enum:__anon21 +CAMERA_ATTR_WHITE_BALANCE_AUTOMATIC include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_AUTOMATIC, \/**< Automatic *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_CLOUDY include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_CLOUDY, \/**< Cloudy *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_CUSTOM include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_CUSTOM, \/**< Custom *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_DAYLIGHT include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_DAYLIGHT, \/**< Daylight *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_FLASH include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_FLASH, \/**< Flash *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_FLUORESCENT include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_FLUORESCENT, \/**< Fluorescent *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_HORIZON include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_HORIZON, \/**< Horizon *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_INCANDESCENT include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_INCANDESCENT, \/**< Incandescent *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_NONE include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_NONE = 0, \/**< None *\/$/;" e enum:__anon15 +CAMERA_ATTR_WHITE_BALANCE_SHADE include/camera.h /^ CAMERA_ATTR_WHITE_BALANCE_SHADE, \/**< Shade *\/$/;" e enum:__anon15 +CAMERA_DEVICE_CAMERA0 include/camera.h /^ CAMERA_DEVICE_CAMERA0 = 0, \/**< Primary camera *\/$/;" e enum:__anon9 +CAMERA_DEVICE_CAMERA1 include/camera.h /^ CAMERA_DEVICE_CAMERA1 \/**< Secondary camera *\/$/;" e enum:__anon9 +CAMERA_DISPLAY_MODE_CROPPED_FULL include/camera.h /^ CAMERA_DISPLAY_MODE_CROPPED_FULL, \/**< Cropped full screen*\/$/;" e enum:__anon13 +CAMERA_DISPLAY_MODE_FULL include/camera.h /^ CAMERA_DISPLAY_MODE_FULL, \/**< full screen*\/$/;" e enum:__anon13 +CAMERA_DISPLAY_MODE_LETTER_BOX include/camera.h /^ CAMERA_DISPLAY_MODE_LETTER_BOX = 0, \/**< Letter box*\/$/;" e enum:__anon13 +CAMERA_DISPLAY_MODE_ORIGIN_SIZE include/camera.h /^ CAMERA_DISPLAY_MODE_ORIGIN_SIZE, \/**< Origin size*\/$/;" e enum:__anon13 +CAMERA_DISPLAY_ROTATION_180 include/camera.h /^ CAMERA_DISPLAY_ROTATION_180, \/**< 180 degree rotation *\/$/;" e enum:__anon12 +CAMERA_DISPLAY_ROTATION_270 include/camera.h /^ CAMERA_DISPLAY_ROTATION_270, \/**< 270 degree rotation *\/$/;" e enum:__anon12 +CAMERA_DISPLAY_ROTATION_90 include/camera.h /^ CAMERA_DISPLAY_ROTATION_90, \/**< 90 degree rotation *\/$/;" e enum:__anon12 +CAMERA_DISPLAY_ROTATION_NONE include/camera.h /^ CAMERA_DISPLAY_ROTATION_NONE, \/**< No rotation of the display *\/$/;" e enum:__anon12 +CAMERA_DISPLAY_TYPE_EVAS include/camera.h /^ CAMERA_DISPLAY_TYPE_EVAS = 1, \/**< Evas object surface display *\/$/;" e enum:__anon11 +CAMERA_DISPLAY_TYPE_NONE include/camera.h /^ CAMERA_DISPLAY_TYPE_NONE = 3 \/**< This disposes of buffers *\/$/;" e enum:__anon11 +CAMERA_DISPLAY_TYPE_X11 include/camera.h /^ CAMERA_DISPLAY_TYPE_X11 = 0, \/**< X surface display *\/$/;" e enum:__anon11 +CAMERA_ERROR_CLASS include/camera.h 35;" d +CAMERA_ERROR_DEVICE include/camera.h /^ CAMERA_ERROR_DEVICE = CAMERA_ERROR_CLASS | 0x04, \/**< Device error *\/$/;" e enum:__anon7 +CAMERA_ERROR_INVALID_OPERATION include/camera.h /^ CAMERA_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, \/**< Internal error *\/$/;" e enum:__anon7 +CAMERA_ERROR_INVALID_PARAMETER include/camera.h /^ CAMERA_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, \/**< Invalid parameter *\/$/;" e enum:__anon7 +CAMERA_ERROR_INVALID_STATE include/camera.h /^ CAMERA_ERROR_INVALID_STATE = CAMERA_ERROR_CLASS | 0x02, \/**< Invalid state *\/$/;" e enum:__anon7 +CAMERA_ERROR_NONE include/camera.h /^ CAMERA_ERROR_NONE = TIZEN_ERROR_OK, \/**< Successful *\/$/;" e enum:__anon7 +CAMERA_ERROR_OUT_OF_MEMORY include/camera.h /^ CAMERA_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, \/**< Out of memory *\/$/;" e enum:__anon7 +CAMERA_ERROR_SOUND_POLICY include/camera.h /^ CAMERA_ERROR_SOUND_POLICY = CAMERA_ERROR_CLASS | 0x06, \/**< Blocked by Audio Session Manager *\/$/;" e enum:__anon7 +CAMERA_FOCUS_STATE_FAILED include/camera.h /^ CAMERA_FOCUS_STATE_FAILED, \/**< Focus failed*\/$/;" e enum:__anon18 +CAMERA_FOCUS_STATE_FOCUSED include/camera.h /^ CAMERA_FOCUS_STATE_FOCUSED, \/**< Focus success*\/$/;" e enum:__anon18 +CAMERA_FOCUS_STATE_ONGOING include/camera.h /^ CAMERA_FOCUS_STATE_ONGOING, \/**< Focus in progress*\/$/;" e enum:__anon18 +CAMERA_FOCUS_STATE_RELEASED include/camera.h /^ CAMERA_FOCUS_STATE_RELEASED = 0, \/**< Focus released.*\/$/;" e enum:__anon18 +CAMERA_MODE_IMAGE include/camera_private.h /^ CAMERA_MODE_IMAGE = MM_CAMCORDER_MODE_IMAGE, \/**< Still image capture mode *\/$/;" e enum:__anon6 +CAMERA_MODE_VIDEO include/camera_private.h /^ CAMERA_MODE_VIDEO = MM_CAMCORDER_MODE_VIDEO \/**< Video recording mode *\/$/;" e enum:__anon6 +CAMERA_PIXEL_FORMAT_422P include/camera.h /^ CAMERA_PIXEL_FORMAT_422P, \/**< YUV422(Y:U:V) planar pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_ARGB include/camera.h /^ CAMERA_PIXEL_FORMAT_ARGB, \/**< ARGB pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_I420 include/camera.h /^ CAMERA_PIXEL_FORMAT_I420, \/**< I420 pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_INVALID include/camera.h /^ CAMERA_PIXEL_FORMAT_INVALID = -1, \/**< Invalid pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_JPEG include/camera.h /^ CAMERA_PIXEL_FORMAT_JPEG, \/**< Encoded pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_NV12 include/camera.h /^ CAMERA_PIXEL_FORMAT_NV12, \/**< NV12 pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_NV12T include/camera.h /^ CAMERA_PIXEL_FORMAT_NV12T, \/**< NV12 Tiled pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_NV16 include/camera.h /^ CAMERA_PIXEL_FORMAT_NV16, \/**< NV16 pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_NV21 include/camera.h /^ CAMERA_PIXEL_FORMAT_NV21, \/**< NV21 pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_RGB565 include/camera.h /^ CAMERA_PIXEL_FORMAT_RGB565, \/**< RGB565 pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_RGB888 include/camera.h /^ CAMERA_PIXEL_FORMAT_RGB888, \/**< RGB888 pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_RGBA include/camera.h /^ CAMERA_PIXEL_FORMAT_RGBA, \/**< RGBA pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_UYVY include/camera.h /^ CAMERA_PIXEL_FORMAT_UYVY, \/**< UYVY pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_YUYV include/camera.h /^ CAMERA_PIXEL_FORMAT_YUYV, \/**< YUYV(YUY2) pixel format *\/$/;" e enum:__anon10 +CAMERA_PIXEL_FORMAT_YV12 include/camera.h /^ CAMERA_PIXEL_FORMAT_YV12, \/**< YV12 pixel format *\/$/;" e enum:__anon10 +CAMERA_STATE_CAPTURED include/camera.h /^ CAMERA_STATE_CAPTURED \/**< After capturing *\/$/;" e enum:__anon8 +CAMERA_STATE_CAPTURING include/camera.h /^ CAMERA_STATE_CAPTURING, \/**< While capturing *\/$/;" e enum:__anon8 +CAMERA_STATE_CREATED include/camera.h /^ CAMERA_STATE_CREATED, \/**< Created, but not initialized yet *\/$/;" e enum:__anon8 +CAMERA_STATE_NONE include/camera.h /^ CAMERA_STATE_NONE, \/**< Before create *\/$/;" e enum:__anon8 +CAMERA_STATE_PREVIEW include/camera.h /^ CAMERA_STATE_PREVIEW, \/**< Preview *\/$/;" e enum:__anon8 +CC TC/testcase/Makefile /^CC ?= gcc$/;" m +CFLAGS TC/testcase/Makefile /^CFLAGS = -I. `pkg-config --cflags $(PKGS)`$/;" m +CFLAGS debian/rules /^CFLAGS = -Wall -g$/;" m +CMAKE_BUILD_DIR debian/rules /^CMAKE_BUILD_DIR ?= $(CURDIR)\/cmake_build_tmp$/;" m +CMAKE_ROOT_DIR debian/rules /^CMAKE_ROOT_DIR ?= $(CURDIR)$/;" m +DLOG_D src/camera.c 37;" d file: +DLOG_I src/camera.c 36;" d file: +DLOG_V src/camera.c 35;" d file: +GET_DISPLAY include/camera.h 140;" d +GmainThread TC/testcase/utc_media_camera_lifecycle.c /^gpointer GmainThread(gpointer data){$/;" f +GmainThread TC/testcase/utc_media_camera_setting.c /^gpointer GmainThread(gpointer data){$/;" f +GmainThread TC/testcase/utc_media_camera_working.c /^gpointer GmainThread(gpointer data){$/;" f +LDFLAGS TC/testcase/Makefile /^LDFLAGS = `pkg-config --libs $(PKGS)`$/;" m +LOG_TAG src/camera.c 32;" d file: +LOG_TAG src/camera.c 34;" d file: +MY_ASSERT TC/testcase/utc_media_camera_attr.c 22;" d file: +MY_ASSERT TC/testcase/utc_media_camera_lifecycle.c 25;" d file: +MY_ASSERT TC/testcase/utc_media_camera_setting.c 26;" d file: +MY_ASSERT TC/testcase/utc_media_camera_working.c 23;" d file: +PKGS TC/testcase/Makefile /^PKGS = capi-media-camera dlog glib-2.0$/;" m +TCS TC/testcase/Makefile /^TCS = utc_media_camera_attr \\$/;" m +_CAMERA_EVENT_TYPE_CAPTURE include/camera_private.h /^ _CAMERA_EVENT_TYPE_CAPTURE, $/;" e enum:__anon5 +_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE include/camera_private.h /^ _CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,$/;" e enum:__anon5 +_CAMERA_EVENT_TYPE_ERROR include/camera_private.h /^ _CAMERA_EVENT_TYPE_ERROR, $/;" e enum:__anon5 +_CAMERA_EVENT_TYPE_FOCUS_CHANGE include/camera_private.h /^ _CAMERA_EVENT_TYPE_FOCUS_CHANGE, $/;" e enum:__anon5 +_CAMERA_EVENT_TYPE_NUM include/camera_private.h /^ _CAMERA_EVENT_TYPE_NUM$/;" e enum:__anon5 +_CAMERA_EVENT_TYPE_PREVIEW include/camera_private.h /^ _CAMERA_EVENT_TYPE_PREVIEW,$/;" e enum:__anon5 +_CAMERA_EVENT_TYPE_STATE_CHANGE include/camera_private.h /^ _CAMERA_EVENT_TYPE_STATE_CHANGE,$/;" e enum:__anon5 +__TIZEN_MULTIMEDIA_CAMERA_H__ include/camera.h 26;" d +__TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__ include/camera_private.h 27;" d +_af_mode_test_cb TC/testcase/utc_media_camera_working.c /^bool _af_mode_test_cb(camera_attr_af_mode_e mode, void *user_data){$/;" f +_af_mode_test_cb test/multimedia_camera_test.c /^bool _af_mode_test_cb(camera_attr_af_mode_e mode, void *user_data){$/;" f +_camera_event_e include/camera_private.h /^}_camera_event_e;$/;" t typeref:enum:__anon5 +_camera_preview_test_cb TC/testcase/utc_media_camera_working.c /^ void _camera_preview_test_cb(void *stream_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_camera_preview_test_cb test/multimedia_camera_test.c /^ void _camera_preview_test_cb(void *stream_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_camera_s include/camera_private.h /^typedef struct _camera_s{$/;" s +_camera_state_convert src/camera.c /^camera_state_e _camera_state_convert(MMCamcorderStateType mm_state)$/;" f +_capture_completed_cb TC/testcase/utc_media_camera_setting.c /^void _capture_completed_cb(void *user_data)$/;" f +_capture_format_cb TC/testcase/utc_media_camera_setting.c /^bool _capture_format_cb(camera_pixel_format_e format , void *user_data)$/;" f +_capture_format_cb2 TC/testcase/utc_media_camera_setting.c /^bool _capture_format_cb2(camera_pixel_format_e format , void *user_data)$/;" f +_capture_resolution_cb TC/testcase/utc_media_camera_setting.c /^bool _capture_resolution_cb(int width, int height, void *user_data)$/;" f +_capture_resolution_cb2 TC/testcase/utc_media_camera_setting.c /^bool _capture_resolution_cb2(int width, int height, void *user_data)$/;" f +_capture_test2_cb TC/testcase/utc_media_camera_working.c /^void _capture_test2_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_capture_test2_cb test/multimedia_camera_test.c /^void _capture_test2_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_capture_test3_cb TC/testcase/utc_media_camera_working.c /^void _capture_test3_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_capture_test3_cb test/multimedia_camera_test.c /^void _capture_test3_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_capture_test_cb TC/testcase/utc_media_camera_working.c /^void _capture_test_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_capture_test_cb test/multimedia_camera_test.c /^void _capture_test_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data){$/;" f +_capturing_cb TC/testcase/utc_media_camera_setting.c /^void _capturing_cb(void* image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format , void *user_data)$/;" f +_cb_af_mode TC/testcase/utc_media_camera_attr.c /^bool _cb_af_mode(camera_attr_af_mode_e mode, void *user_data)$/;" f +_cb_effect_cb TC/testcase/utc_media_camera_attr.c /^bool _cb_effect_cb(camera_attr_effect_mode_e effect , void *user_data)$/;" f +_cb_exposure_mode TC/testcase/utc_media_camera_attr.c /^bool _cb_exposure_mode(camera_attr_exposure_mode_e mode , void *user_data)$/;" f +_cb_flash_mode_cb TC/testcase/utc_media_camera_attr.c /^bool _cb_flash_mode_cb(camera_attr_flash_mode_e mode, void *user_data)$/;" f +_cb_fps_cb TC/testcase/utc_media_camera_attr.c /^bool _cb_fps_cb(camera_attr_fps_e fps, void *user_data)$/;" f +_cb_iso TC/testcase/utc_media_camera_attr.c /^bool _cb_iso(camera_attr_iso_e iso , void *user_data)$/;" f +_cb_scene_mode_cb TC/testcase/utc_media_camera_attr.c /^bool _cb_scene_mode_cb(camera_attr_scene_mode_e mode , void *user_data)$/;" f +_cb_whitebalance_cb TC/testcase/utc_media_camera_attr.c /^bool _cb_whitebalance_cb(camera_attr_whitebalance_e wb , void *user_data)$/;" f +_changed_cb TC/testcase/utc_media_camera_setting.c /^void _changed_cb(camera_state_e previous , camera_state_e current , bool by_asm, void *user_data)$/;" f +_convert_camera_error_code src/camera.c /^int _convert_camera_error_code(int code){$/;" f +_effect_test_cb TC/testcase/utc_media_camera_working.c /^bool _effect_test_cb(camera_attr_effect_mode_e effect, void *user_data){$/;" f +_effect_test_cb test/multimedia_camera_test.c /^bool _effect_test_cb(camera_attr_effect_mode_e effect, void *user_data){$/;" f +_error_cb TC/testcase/utc_media_camera_setting.c /^void _error_cb(int error, camera_state_e current_state, void *user_data)$/;" f +_exposure_mode_test_cb TC/testcase/utc_media_camera_working.c /^bool _exposure_mode_test_cb(camera_attr_exposure_mode_e mode, void *user_data){$/;" f +_exposure_mode_test_cb test/multimedia_camera_test.c /^bool _exposure_mode_test_cb(camera_attr_exposure_mode_e mode, void *user_data){$/;" f +_flash_mode_test_cb TC/testcase/utc_media_camera_working.c /^bool _flash_mode_test_cb(camera_attr_flash_mode_e mode, void *user_data){$/;" f +_flash_mode_test_cb test/multimedia_camera_test.c /^bool _flash_mode_test_cb(camera_attr_flash_mode_e mode, void *user_data){$/;" f +_focus_changed_cb TC/testcase/utc_media_camera_setting.c /^void _focus_changed_cb(camera_focus_state_e state, void *user_data)$/;" f +_focus_changed_cb2 test/multimedia_camera_test.c /^void _focus_changed_cb2(camera_focus_state_e state, void *user_data){$/;" f +_iso_test_cb TC/testcase/utc_media_camera_working.c /^bool _iso_test_cb(camera_attr_iso_e iso, void *user_data){$/;" f +_iso_test_cb test/multimedia_camera_test.c /^bool _iso_test_cb(camera_attr_iso_e iso, void *user_data){$/;" f +_preview_cb TC/testcase/utc_media_camera_setting.c /^void _preview_cb(void* stream_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data)$/;" f +_preview_format_cb TC/testcase/utc_media_camera_setting.c /^bool _preview_format_cb(camera_pixel_format_e format , void *user_data)$/;" f +_preview_format_cb2 TC/testcase/utc_media_camera_setting.c /^bool _preview_format_cb2(camera_pixel_format_e format , void *user_data)$/;" f +_preview_format_test_cb TC/testcase/utc_media_camera_working.c /^bool _preview_format_test_cb(camera_pixel_format_e format, void *user_data){$/;" f +_preview_format_test_cb test/multimedia_camera_test.c /^bool _preview_format_test_cb(camera_pixel_format_e format, void *user_data){$/;" f +_preview_fps_cb TC/testcase/utc_media_camera_working.c /^bool _preview_fps_cb(camera_attr_fps_e fps, void *user_data){$/;" f +_preview_fps_cb test/multimedia_camera_test.c /^bool _preview_fps_cb(camera_attr_fps_e fps, void *user_data){$/;" f +_preview_resolution_cb TC/testcase/utc_media_camera_setting.c /^bool _preview_resolution_cb(int width, int height, void *user_data )$/;" f +_preview_resolution_cb2 TC/testcase/utc_media_camera_setting.c /^bool _preview_resolution_cb2(int width, int height, void *user_data )$/;" f +_scene_mode_test_cb TC/testcase/utc_media_camera_working.c /^bool _scene_mode_test_cb (camera_attr_scene_mode_e mode, void *user_data){$/;" f +_scene_mode_test_cb test/multimedia_camera_test.c /^bool _scene_mode_test_cb (camera_attr_scene_mode_e mode, void *user_data){$/;" f +_state_change_test_cb TC/testcase/utc_media_camera_working.c /^void _state_change_test_cb(camera_state_e previous , camera_state_e current , bool by_asm, void *user_data){$/;" f +_state_change_test_cb test/multimedia_camera_test.c /^void _state_change_test_cb(camera_state_e previous , camera_state_e current , bool by_asm, void *user_data){$/;" f +_whitebalance_test_cb TC/testcase/utc_media_camera_working.c /^bool _whitebalance_test_cb(camera_attr_whitebalance_e wb, void *user_data){$/;" f +_whitebalance_test_cb test/multimedia_camera_test.c /^bool _whitebalance_test_cb(camera_attr_whitebalance_e wb, void *user_data){$/;" f +af_mode_test TC/testcase/utc_media_camera_working.c /^int af_mode_test(camera_h camera){$/;" f +af_mode_test test/multimedia_camera_test.c /^int af_mode_test(camera_h camera){$/;" f +appdata test/multimedia_camera_test.c /^}appdata;$/;" t typeref:struct:__anon24 file: +brightness_test TC/testcase/utc_media_camera_working.c /^int brightness_test(camera_h camera){$/;" f +brightness_test test/multimedia_camera_test.c /^int brightness_test(camera_h camera){$/;" f +camera TC/testcase/utc_media_camera_attr.c /^camera_h camera;$/;" v +camera TC/testcase/utc_media_camera_setting.c /^camera_h camera;$/;" v +camera TC/testcase/utc_media_camera_working.c /^ camera_h camera;$/;" m struct:__anon1 file: +camera test/multimedia_camera_test.c /^ camera_h camera;$/;" m struct:__anon25 file: +camera_attr_af_mode_e include/camera.h /^} camera_attr_af_mode_e;$/;" t typeref:enum:__anon17 +camera_attr_effect_mode_e include/camera.h /^} camera_attr_effect_mode_e;$/;" t typeref:enum:__anon14 +camera_attr_enable_tag src/camera.c /^int camera_attr_enable_tag(camera_h camera, bool enable){$/;" f +camera_attr_exposure_mode_e include/camera.h /^} camera_attr_exposure_mode_e;$/;" t typeref:enum:__anon20 +camera_attr_flash_mode_e include/camera.h /^} camera_attr_flash_mode_e;$/;" t typeref:enum:__anon22 +camera_attr_foreach_supported_af_mode src/camera.c /^int camera_attr_foreach_supported_af_mode( camera_h camera, camera_attr_supported_af_mode_cb foreach_cb , void *user_data){$/;" f +camera_attr_foreach_supported_effect src/camera.c /^int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data){$/;" f +camera_attr_foreach_supported_exposure_mode src/camera.c /^int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data){$/;" f +camera_attr_foreach_supported_flash_mode src/camera.c /^int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data){$/;" f +camera_attr_foreach_supported_fps src/camera.c /^int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data){$/;" f +camera_attr_foreach_supported_iso src/camera.c /^int camera_attr_foreach_supported_iso( camera_h camera, camera_attr_supported_iso_cb foreach_cb , void *user_data){$/;" f +camera_attr_foreach_supported_scene_mode src/camera.c /^int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data){$/;" f +camera_attr_foreach_supported_whitebalance src/camera.c /^int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data){$/;" f +camera_attr_fps_e include/camera.h /^} camera_attr_fps_e;$/;" t typeref:enum:__anon23 +camera_attr_get_af_mode src/camera.c /^int camera_attr_get_af_mode( camera_h camera, camera_attr_af_mode_e *mode){$/;" f +camera_attr_get_brightness src/camera.c /^int camera_attr_get_brightness(camera_h camera, int *level){$/;" f +camera_attr_get_contrast src/camera.c /^int camera_attr_get_contrast(camera_h camera, int *level){$/;" f +camera_attr_get_effect src/camera.c /^int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect){$/;" f +camera_attr_get_exposure src/camera.c /^int camera_attr_get_exposure(camera_h camera, int *value){$/;" f +camera_attr_get_exposure_mode src/camera.c /^int camera_attr_get_exposure_mode( camera_h camera, camera_attr_exposure_mode_e *mode){$/;" f +camera_attr_get_flash_mode src/camera.c /^int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode){$/;" f +camera_attr_get_hue src/camera.c /^int camera_attr_get_hue(camera_h camera, int *level){$/;" f +camera_attr_get_image_quality src/camera.c /^int camera_attr_get_image_quality(camera_h camera, int *quality){$/;" f +camera_attr_get_iso src/camera.c /^int camera_attr_get_iso( camera_h camera, camera_attr_iso_e *iso){$/;" f +camera_attr_get_lens_orientation src/camera.c /^int camera_attr_get_lens_orientation(camera_h camera, int *angle) {$/;" f +camera_attr_get_preview_fps src/camera.c /^int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps){$/;" f +camera_attr_get_saturation src/camera.c /^int camera_attr_get_saturation(camera_h camera, int *level){$/;" f +camera_attr_get_scene_mode src/camera.c /^int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode){$/;" f +camera_attr_get_sharpness src/camera.c /^int camera_attr_get_sharpness(camera_h camera, int *level){$/;" f +camera_attr_get_tag_altitude src/camera.c /^int camera_attr_get_tag_altitude(camera_h camera, double *altitude){$/;" f +camera_attr_get_tag_image_description src/camera.c /^int camera_attr_get_tag_image_description(camera_h camera, char **description){$/;" f +camera_attr_get_tag_latitude src/camera.c /^int camera_attr_get_tag_latitude(camera_h camera, double *latitude){$/;" f +camera_attr_get_tag_longitude src/camera.c /^int camera_attr_get_tag_longitude(camera_h camera, double *longtitude){$/;" f +camera_attr_get_tag_orientation src/camera.c /^int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation){$/;" f +camera_attr_get_tag_software src/camera.c /^int camera_attr_get_tag_software(camera_h camera, char **software){$/;" f +camera_attr_get_whitebalance src/camera.c /^int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb){$/;" f +camera_attr_get_zoom src/camera.c /^int camera_attr_get_zoom(camera_h camera, int *zoom){$/;" f +camera_attr_is_enabled_tag src/camera.c /^int camera_attr_is_enabled_tag(camera_h camera, bool *enable){$/;" f +camera_attr_iso_e include/camera.h /^} camera_attr_iso_e;$/;" t typeref:enum:__anon19 +camera_attr_scene_mode_e include/camera.h /^} camera_attr_scene_mode_e;$/;" t typeref:enum:__anon16 +camera_attr_set_af_mode src/camera.c /^int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode){$/;" f +camera_attr_set_af_touch src/camera.c /^int camera_attr_set_af_touch(camera_h camera, int x , int y, int width, int height ){$/;" f +camera_attr_set_brightness src/camera.c /^int camera_attr_set_brightness(camera_h camera, int level){$/;" f +camera_attr_set_contrast src/camera.c /^int camera_attr_set_contrast(camera_h camera, int level){$/;" f +camera_attr_set_effect src/camera.c /^int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect){$/;" f +camera_attr_set_exposure src/camera.c /^int camera_attr_set_exposure(camera_h camera, int value){$/;" f +camera_attr_set_exposure_mode src/camera.c /^int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode){$/;" f +camera_attr_set_flash_mode src/camera.c /^int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode){$/;" f +camera_attr_set_hue src/camera.c /^int camera_attr_set_hue(camera_h camera, int level){$/;" f +camera_attr_set_image_quality src/camera.c /^int camera_attr_set_image_quality(camera_h camera, int quality){$/;" f +camera_attr_set_iso src/camera.c /^int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso){$/;" f +camera_attr_set_preview_fps src/camera.c /^int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps){$/;" f +camera_attr_set_saturation src/camera.c /^int camera_attr_set_saturation(camera_h camera, int level){$/;" f +camera_attr_set_scene_mode src/camera.c /^int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode){$/;" f +camera_attr_set_sharpness src/camera.c /^int camera_attr_set_sharpness(camera_h camera, int level){$/;" f +camera_attr_set_tag_altitude src/camera.c /^int camera_attr_set_tag_altitude(camera_h camera, double altitude){$/;" f +camera_attr_set_tag_image_description src/camera.c /^int camera_attr_set_tag_image_description(camera_h camera, const char *description){$/;" f +camera_attr_set_tag_latitude src/camera.c /^int camera_attr_set_tag_latitude(camera_h camera, double latitude){$/;" f +camera_attr_set_tag_longitude src/camera.c /^int camera_attr_set_tag_longitude(camera_h camera, double longtitude){$/;" f +camera_attr_set_tag_orientation src/camera.c /^int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation){$/;" f +camera_attr_set_tag_software src/camera.c /^int camera_attr_set_tag_software(camera_h camera, const char *software){$/;" f +camera_attr_set_whitebalance src/camera.c /^int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb){$/;" f +camera_attr_set_zoom src/camera.c /^int camera_attr_set_zoom(camera_h camera, int zoom){$/;" f +camera_attr_supported_af_mode_cb include/camera.h /^typedef bool (*camera_attr_supported_af_mode_cb)(camera_attr_af_mode_e mode, void *user_data);$/;" t +camera_attr_supported_effect_cb include/camera.h /^typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect,$/;" t +camera_attr_supported_exposure_mode_cb include/camera.h /^typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode_e mode,$/;" t +camera_attr_supported_flash_mode_cb include/camera.h /^typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mode,$/;" t +camera_attr_supported_fps_cb include/camera.h /^typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_data);$/;" t +camera_attr_supported_iso_cb include/camera.h /^typedef bool (*camera_attr_supported_iso_cb)(camera_attr_iso_e iso, void *user_data);$/;" t +camera_attr_supported_scene_mode_cb include/camera.h /^typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mode,$/;" t +camera_attr_supported_whitebalance_cb include/camera.h /^typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e wb,$/;" t +camera_attr_tag_orientation_e include/camera.h /^} camera_attr_tag_orientation_e;$/;" t typeref:enum:__anon21 +camera_attr_whitebalance_e include/camera.h /^} camera_attr_whitebalance_e;$/;" t typeref:enum:__anon15 +camera_attribute_test test/multimedia_camera_test.c /^int camera_attribute_test(){$/;" f +camera_cancel_focusing src/camera.c /^int camera_cancel_focusing( camera_h camera ){$/;" f +camera_capture_completed_cb include/camera.h /^typedef void (*camera_capture_completed_cb)(void *user_data);$/;" t +camera_capturing_cb include/camera.h /^typedef void (*camera_capturing_cb)(void *image_buffer, int buffer_size, int width, int height,$/;" t +camera_create src/camera.c /^int camera_create( camera_device_e device, camera_h* camera){$/;" f +camera_destroy src/camera.c /^ int camera_destroy(camera_h camera){$/;" f +camera_device_e include/camera.h /^} camera_device_e;$/;" t typeref:enum:__anon9 +camera_display_h include/camera.h /^typedef void *camera_display_h;$/;" t +camera_display_mode_e include/camera.h /^} camera_display_mode_e;$/;" t typeref:enum:__anon13 +camera_display_rotation_e include/camera.h /^} camera_display_rotation_e;$/;" t typeref:enum:__anon12 +camera_display_type_e include/camera.h /^} camera_display_type_e;$/;" t typeref:enum:__anon11 +camera_error_cb include/camera.h /^typedef void (*camera_error_cb)(int error, camera_state_e current_state, void *user_data);$/;" t +camera_error_e include/camera.h /^} camera_error_e;$/;" t typeref:enum:__anon7 +camera_focus_changed_cb include/camera.h /^typedef void (*camera_focus_changed_cb)(camera_focus_state_e state, void *user_data);$/;" t +camera_focus_state_e include/camera.h /^} camera_focus_state_e;$/;" t typeref:enum:__anon18 +camera_foreach_supported_capture_format src/camera.c /^int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data){$/;" f +camera_foreach_supported_capture_resolution src/camera.c /^int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data){$/;" f +camera_foreach_supported_preview_format src/camera.c /^int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data){$/;" f +camera_foreach_supported_preview_resolution src/camera.c /^int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data){$/;" f +camera_get_capture_format src/camera.c /^int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format){$/;" f +camera_get_capture_resolution src/camera.c /^int camera_get_capture_resolution(camera_h camera, int *width, int *height){$/;" f +camera_get_preview_format src/camera.c /^int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format){$/;" f +camera_get_preview_resolution src/camera.c /^int camera_get_preview_resolution(camera_h camera, int *width, int *height){$/;" f +camera_get_state src/camera.c /^int camera_get_state(camera_h camera, camera_state_e * state){$/;" f +camera_get_x11_display_mode src/camera.c /^int camera_get_x11_display_mode( camera_h camera , camera_display_mode_e* ratio){$/;" f +camera_get_x11_display_rotation src/camera.c /^int camera_get_x11_display_rotation( camera_h camera, camera_display_rotation_e *rotation){$/;" f +camera_h include/camera.h /^typedef struct camera_s *camera_h;$/;" t typeref:struct:camera_s +camera_is_x11_display_visible src/camera.c /^int camera_is_x11_display_visible(camera_h camera, bool* visible){$/;" f +camera_lens_rotation_test test/multimedia_camera_test.c /^void camera_lens_rotation_test(){$/;" f +camera_mode_e include/camera_private.h /^} camera_mode_e;$/;" t typeref:enum:__anon6 +camera_pixel_format_e include/camera.h /^} camera_pixel_format_e;$/;" t typeref:enum:__anon10 +camera_preview_cb include/camera.h /^typedef void (*camera_preview_cb)(void *stream_buffer, int buffer_size, int width, int height,$/;" t +camera_preview_test test/multimedia_camera_test.c /^int camera_preview_test(){$/;" f +camera_preview_test_s TC/testcase/utc_media_camera_working.c /^} camera_preview_test_s;$/;" t typeref:struct:__anon1 file: +camera_preview_test_s test/multimedia_camera_test.c /^} camera_preview_test_s;$/;" t typeref:struct:__anon25 file: +camera_s include/camera_private.h /^} camera_s;$/;" t typeref:struct:_camera_s +camera_set_capture_completed_cb src/camera.c /^int camera_set_capture_completed_cb(camera_h camera, camera_capture_completed_cb callback, void* user_data){$/;" f +camera_set_capture_format src/camera.c /^int camera_set_capture_format(camera_h camera, camera_pixel_format_e format){$/;" f +camera_set_capture_resolution src/camera.c /^int camera_set_capture_resolution(camera_h camera, int width, int height){$/;" f +camera_set_capturing_cb src/camera.c /^int camera_set_capturing_cb( camera_h camera, camera_capturing_cb callback, void* user_data ){$/;" f +camera_set_display src/camera.c /^int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display){$/;" f +camera_set_error_cb src/camera.c /^int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data){$/;" f +camera_set_focus_changed_cb src/camera.c /^int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void* user_data){$/;" f +camera_set_mode src/camera.c /^int camera_set_mode(camera_h camera, camera_mode_e mode ){$/;" f +camera_set_preview_cb src/camera.c /^int camera_set_preview_cb( camera_h camera, camera_preview_cb callback, void* user_data ){$/;" f +camera_set_preview_format src/camera.c /^int camera_set_preview_format(camera_h camera, camera_pixel_format_e format){$/;" f +camera_set_preview_resolution src/camera.c /^int camera_set_preview_resolution(camera_h camera, int width, int height){$/;" f +camera_set_state_changed_cb src/camera.c /^int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void* user_data){$/;" f +camera_set_x11_display_mode src/camera.c /^int camera_set_x11_display_mode( camera_h camera , camera_display_mode_e ratio){$/;" f +camera_set_x11_display_rotation src/camera.c /^int camera_set_x11_display_rotation(camera_h camera, camera_display_rotation_e rotation){$/;" f +camera_set_x11_display_visible src/camera.c /^int camera_set_x11_display_visible(camera_h camera, bool visible){$/;" f +camera_start_capture src/camera.c /^int camera_start_capture(camera_h camera){$/;" f +camera_start_focusing src/camera.c /^int camera_start_focusing( camera_h camera ){$/;" f +camera_start_preview src/camera.c /^int camera_start_preview(camera_h camera){$/;" f +camera_state_change_test test/multimedia_camera_test.c /^int camera_state_change_test(){$/;" f +camera_state_changed_cb include/camera.h /^typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e current,$/;" t +camera_state_e include/camera.h /^} camera_state_e;$/;" t typeref:enum:__anon8 +camera_stop_preview src/camera.c /^int camera_stop_preview(camera_h camera){$/;" f +camera_supported_capture_format_cb include/camera.h /^typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format,$/;" t +camera_supported_capture_resolution_cb include/camera.h /^typedef bool (*camera_supported_capture_resolution_cb)(int width, int height, void *user_data);$/;" t +camera_supported_preview_format_cb include/camera.h /^typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format,$/;" t +camera_supported_preview_resolution_cb include/camera.h /^typedef bool (*camera_supported_preview_resolution_cb)(int width, int height, void *user_data);$/;" t +camera_test test/multimedia_camera_test.c /^int camera_test(){$/;" f +camera_unset_capture_completed_cb src/camera.c /^int camera_unset_capture_completed_cb(camera_h camera){$/;" f +camera_unset_capturing_cb src/camera.c /^int camera_unset_capturing_cb( camera_h camera){$/;" f +camera_unset_error_cb src/camera.c /^int camera_unset_error_cb(camera_h camera){$/;" f +camera_unset_focus_changed_cb src/camera.c /^int camera_unset_focus_changed_cb(camera_h camera){$/;" f +camera_unset_preview_cb src/camera.c /^int camera_unset_preview_cb( camera_h camera){$/;" f +camera_unset_state_changed_cb src/camera.c /^int camera_unset_state_changed_cb(camera_h camera){$/;" f +capture_cb TC/testcase/utc_media_camera_working.c /^void capture_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data)$/;" f +capture_complete TC/testcase/utc_media_camera_working.c /^int capture_complete(void *user_data){$/;" f +capture_complete test/multimedia_camera_test.c /^int capture_complete(void *user_data){$/;" f +capture_resolution_test test/multimedia_camera_test.c /^int capture_resolution_test(){$/;" f +capture_resolution_test_cb TC/testcase/utc_media_camera_working.c /^bool capture_resolution_test_cb(int width, int height, void *user_data){$/;" f +capture_resolution_test_cb test/multimedia_camera_test.c /^bool capture_resolution_test_cb(int width, int height, void *user_data){$/;" f +capture_test test/multimedia_camera_test.c /^int capture_test(){$/;" f +capturing_cb test/multimedia_camera_test.c /^void capturing_cb(void *image_buffer, int buffer_size, int width, int height, camera_pixel_format_e format, void *user_data)$/;" f +cleanup TC/testcase/utc_media_camera_attr.c /^static void cleanup(void)$/;" f file: +cleanup TC/testcase/utc_media_camera_lifecycle.c /^static void cleanup(void)$/;" f file: +cleanup TC/testcase/utc_media_camera_setting.c /^static void cleanup(void)$/;" f file: +cleanup TC/testcase/utc_media_camera_working.c /^static void cleanup(void)$/;" f file: +contrast_test TC/testcase/utc_media_camera_working.c /^int contrast_test(camera_h camera){$/;" f +contrast_test test/multimedia_camera_test.c /^int contrast_test(camera_h camera){$/;" f +count TC/testcase/utc_media_camera_working.c /^ int count;$/;" m struct:__anon3 file: +count test/multimedia_camera_test.c /^ int count;$/;" m struct:__anon27 file: +display_handle include/camera_private.h /^ void* display_handle;$/;" m struct:_camera_s +display_type include/camera_private.h /^ camera_display_type_e display_type;$/;" m struct:_camera_s +effect_test TC/testcase/utc_media_camera_working.c /^int effect_test(camera_h camera){$/;" f +effect_test test/multimedia_camera_test.c /^int effect_test(camera_h camera){$/;" f +event_thread TC/testcase/utc_media_camera_lifecycle.c /^static GThread *event_thread;$/;" v file: +event_thread TC/testcase/utc_media_camera_working.c /^static GThread *event_thread;$/;" v file: +expected_height TC/testcase/utc_media_camera_working.c /^ int expected_height;$/;" m struct:__anon4 file: +expected_height test/multimedia_camera_test.c /^ int expected_height;$/;" m struct:__anon28 file: +expected_width TC/testcase/utc_media_camera_working.c /^ int expected_width;$/;" m struct:__anon4 file: +expected_width test/multimedia_camera_test.c /^ int expected_width;$/;" m struct:__anon28 file: +exposure_mode_test TC/testcase/utc_media_camera_working.c /^int exposure_mode_test(camera_h camera){$/;" f +exposure_mode_test test/multimedia_camera_test.c /^int exposure_mode_test(camera_h camera){$/;" f +exposure_test TC/testcase/utc_media_camera_working.c /^int exposure_test(camera_h camera){$/;" f +exposure_test test/multimedia_camera_test.c /^int exposure_test(camera_h camera){$/;" f +flash_mode_test TC/testcase/utc_media_camera_working.c /^int flash_mode_test(camera_h camera){$/;" f +flash_mode_test test/multimedia_camera_test.c /^int flash_mode_test(camera_h camera){$/;" f +focus_test test/multimedia_camera_test.c /^void focus_test(){$/;" f +g_af_test_pass TC/testcase/utc_media_camera_working.c /^bool g_af_test_pass ; $/;" v +g_af_test_pass test/multimedia_camera_test.c /^bool g_af_test_pass ; $/;" v +g_exposure_mode_pass TC/testcase/utc_media_camera_working.c /^bool g_exposure_mode_pass;$/;" v +g_exposure_mode_pass test/multimedia_camera_test.c /^bool g_exposure_mode_pass;$/;" v +g_iso_test_pass TC/testcase/utc_media_camera_working.c /^bool g_iso_test_pass ;$/;" v +g_iso_test_pass test/multimedia_camera_test.c /^bool g_iso_test_pass ;$/;" v +g_mainloop TC/testcase/utc_media_camera_lifecycle.c /^static GMainLoop *g_mainloop = NULL;$/;" v file: +g_mainloop TC/testcase/utc_media_camera_setting.c /^static GMainLoop *g_mainloop = NULL;$/;" v file: +g_mainloop TC/testcase/utc_media_camera_working.c /^static GMainLoop *g_mainloop = NULL;$/;" v file: +g_preview_fps_pass TC/testcase/utc_media_camera_working.c /^bool g_preview_fps_pass;$/;" v +g_preview_fps_pass test/multimedia_camera_test.c /^bool g_preview_fps_pass;$/;" v +gps_test TC/testcase/utc_media_camera_working.c /^int gps_test(camera_h camera){$/;" f +gps_test test/multimedia_camera_test.c /^int gps_test(camera_h camera){$/;" f +height TC/testcase/utc_media_camera_working.c /^ int height[100];$/;" m struct:__anon3 file: +height test/multimedia_camera_test.c /^ int height[100];$/;" m struct:__anon27 file: +image_quality_test TC/testcase/utc_media_camera_working.c /^int image_quality_test(camera_h camera){$/;" f +image_quality_test test/multimedia_camera_test.c /^int image_quality_test(camera_h camera){$/;" f +img test/multimedia_camera_test.c /^Evas_Object* img;$/;" v +in_format TC/testcase/utc_media_camera_working.c /^ camera_pixel_format_e in_format;$/;" m struct:__anon1 file: +in_format test/multimedia_camera_test.c /^ camera_pixel_format_e in_format;$/;" m struct:__anon25 file: +iscalled TC/testcase/utc_media_camera_working.c /^ bool iscalled;$/;" m struct:__anon1 file: +iscalled TC/testcase/utc_media_camera_working.c /^ bool iscalled;$/;" m struct:__anon2 file: +iscalled test/multimedia_camera_test.c /^ bool iscalled;$/;" m struct:__anon25 file: +iscalled test/multimedia_camera_test.c /^ bool iscalled;$/;" m struct:__anon26 file: +iscaptured TC/testcase/utc_media_camera_working.c /^ bool iscaptured;$/;" m struct:__anon2 file: +iscaptured test/multimedia_camera_test.c /^ bool iscaptured;$/;" m struct:__anon26 file: +iscapturing TC/testcase/utc_media_camera_working.c /^ bool iscapturing;$/;" m struct:__anon2 file: +iscapturing test/multimedia_camera_test.c /^ bool iscapturing;$/;" m struct:__anon26 file: +iso_test TC/testcase/utc_media_camera_working.c /^int iso_test(camera_h camera){$/;" f +iso_test test/multimedia_camera_test.c /^int iso_test(camera_h camera){$/;" f +ispass TC/testcase/utc_media_camera_working.c /^ bool ispass;$/;" m struct:__anon4 file: +ispass test/multimedia_camera_test.c /^ bool ispass;$/;" m struct:__anon28 file: +ispreviewed TC/testcase/utc_media_camera_working.c /^ bool ispreviewed;$/;" m struct:__anon2 file: +ispreviewed test/multimedia_camera_test.c /^ bool ispreviewed;$/;" m struct:__anon26 file: +mEvasWindow test/multimedia_camera_test.c /^Evas_Object* mEvasWindow;$/;" v +main test/multimedia_camera_test.c /^int main(int argc, char ** argv)$/;" f +mm_capture_callback src/camera.c /^gboolean mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data){$/;" f +mm_handle include/camera_private.h /^ MMHandleType mm_handle;$/;" m struct:_camera_s +mm_message_callback src/camera.c /^int mm_message_callback(int message, void *param, void *user_data){$/;" f +mm_videostream_callback src/camera.c /^gboolean mm_videostream_callback(MMCamcorderVideoStreamDataType * stream, void *user_data){$/;" f +preview_fps_test TC/testcase/utc_media_camera_working.c /^int preview_fps_test(camera_h camera)$/;" f +preview_fps_test test/multimedia_camera_test.c /^int preview_fps_test(camera_h camera)$/;" f +preview_resolution_cb test/multimedia_camera_test.c /^bool preview_resolution_cb(int width, int height, void *user_data)$/;" f +preview_test test/multimedia_camera_test.c /^void preview_test(){$/;" f +preview_test_data TC/testcase/utc_media_camera_working.c /^}preview_test_data;$/;" t typeref:struct:__anon4 file: +preview_test_data test/multimedia_camera_test.c /^}preview_test_data;$/;" t typeref:struct:__anon28 file: +preview_win TC/testcase/utc_media_camera_working.c /^int preview_win = 0; $/;" v +preview_win test/multimedia_camera_test.c /^Ecore_X_Window preview_win;$/;" v +resolution_stack TC/testcase/utc_media_camera_working.c /^} resolution_stack;$/;" t typeref:struct:__anon3 file: +resolution_stack test/multimedia_camera_test.c /^} resolution_stack;$/;" t typeref:struct:__anon27 file: +result TC/testcase/utc_media_camera_working.c /^ bool result;$/;" m struct:__anon1 file: +result test/multimedia_camera_test.c /^ bool result;$/;" m struct:__anon25 file: +rotation_test test/multimedia_camera_test.c /^void rotation_test(){$/;" f +scene_mode_test TC/testcase/utc_media_camera_working.c /^int scene_mode_test(camera_h camera){$/;" f +scene_mode_test test/multimedia_camera_test.c /^int scene_mode_test(camera_h camera){$/;" f +startup TC/testcase/utc_media_camera_attr.c /^static void startup(void)$/;" f file: +startup TC/testcase/utc_media_camera_lifecycle.c /^static void startup(void)$/;" f file: +startup TC/testcase/utc_media_camera_setting.c /^static void startup(void)$/;" f file: +startup TC/testcase/utc_media_camera_working.c /^static void startup(void)$/;" f file: +state TC/testcase/utc_media_camera_working.c /^ camera_state_e state;$/;" m struct:__anon2 file: +state include/camera_private.h /^ int state;$/;" m struct:_camera_s +state test/multimedia_camera_test.c /^ camera_state_e state;$/;" m struct:__anon26 file: +state_cb TC/testcase/utc_media_camera_working.c /^void state_cb(camera_state_e previous , camera_state_e current , int by_asm, void *user_data){$/;" f +state_cb test/multimedia_camera_test.c /^void state_cb(camera_state_e previous , camera_state_e current , int by_asm, const void *user_data){$/;" f +state_change_data TC/testcase/utc_media_camera_working.c /^} state_change_data;$/;" t typeref:struct:__anon2 file: +state_change_data test/multimedia_camera_test.c /^} state_change_data;$/;" t typeref:struct:__anon26 file: +stillshot_test test/multimedia_camera_test.c /^int stillshot_test(){$/;" f +tag_enable_test TC/testcase/utc_media_camera_working.c /^int tag_enable_test(camera_h camera){$/;" f +tag_enable_test test/multimedia_camera_test.c /^int tag_enable_test(camera_h camera){$/;" f +tag_image_description_test TC/testcase/utc_media_camera_working.c /^int tag_image_description_test(camera_h camera){$/;" f +tag_image_description_test test/multimedia_camera_test.c /^int tag_image_description_test(camera_h camera){$/;" f +tag_orientation_test TC/testcase/utc_media_camera_working.c /^int tag_orientation_test(camera_h camera){$/;" f +tag_orientation_test test/multimedia_camera_test.c /^int tag_orientation_test(camera_h camera){$/;" f +tag_software_test TC/testcase/utc_media_camera_working.c /^int tag_software_test(camera_h camera){$/;" f +tag_software_test test/multimedia_camera_test.c /^int tag_software_test(camera_h camera){$/;" f +test_main test/multimedia_camera_test.c /^void* test_main(void *arg){$/;" f +tet_cleanup TC/testcase/utc_media_camera_attr.c /^void (*tet_cleanup)(void) = cleanup;$/;" v +tet_cleanup TC/testcase/utc_media_camera_lifecycle.c /^void (*tet_cleanup)(void) = cleanup;$/;" v +tet_cleanup TC/testcase/utc_media_camera_setting.c /^void (*tet_cleanup)(void) = cleanup;$/;" v +tet_cleanup TC/testcase/utc_media_camera_working.c /^void (*tet_cleanup)(void) = cleanup;$/;" v +tet_startup TC/testcase/utc_media_camera_attr.c /^void (*tet_startup)(void) = startup;$/;" v +tet_startup TC/testcase/utc_media_camera_lifecycle.c /^void (*tet_startup)(void) = startup;$/;" v +tet_startup TC/testcase/utc_media_camera_setting.c /^void (*tet_startup)(void) = startup;$/;" v +tet_startup TC/testcase/utc_media_camera_working.c /^void (*tet_startup)(void) = startup;$/;" v +tet_testlist TC/testcase/utc_media_camera_attr.c /^struct tet_testlist tet_testlist[] = {$/;" v typeref:struct:tet_testlist +tet_testlist TC/testcase/utc_media_camera_lifecycle.c /^struct tet_testlist tet_testlist[] = {$/;" v typeref:struct:tet_testlist +tet_testlist TC/testcase/utc_media_camera_setting.c /^struct tet_testlist tet_testlist[] = {$/;" v typeref:struct:tet_testlist +tet_testlist TC/testcase/utc_media_camera_working.c /^struct tet_testlist tet_testlist[] = {$/;" v typeref:struct:tet_testlist +user_cb include/camera_private.h /^ void* user_cb[_CAMERA_EVENT_TYPE_NUM];$/;" m struct:_camera_s +user_data include/camera_private.h /^ void* user_data[_CAMERA_EVENT_TYPE_NUM];$/;" m struct:_camera_s +utc_camera_foreach_supported_capture_format_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_capture_format_negative(void)$/;" f file: +utc_camera_foreach_supported_capture_format_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_capture_format_positive(void)$/;" f file: +utc_camera_foreach_supported_capture_resolution_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_capture_resolution_negative(void)$/;" f file: +utc_camera_foreach_supported_capture_resolution_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_capture_resolution_positive(void)$/;" f file: +utc_camera_foreach_supported_preview_format_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_preview_format_negative(void)$/;" f file: +utc_camera_foreach_supported_preview_format_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_preview_format_positive(void)$/;" f file: +utc_camera_foreach_supported_preview_resolution_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_preview_resolution_negative(void)$/;" f file: +utc_camera_foreach_supported_preview_resolution_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_foreach_supported_preview_resolution_positive(void)$/;" f file: +utc_camera_get_capture_format_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_capture_format_negative(void)$/;" f file: +utc_camera_get_capture_format_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_capture_format_positive(void)$/;" f file: +utc_camera_get_capture_resolution_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_capture_resolution_negative(void)$/;" f file: +utc_camera_get_capture_resolution_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_capture_resolution_positive(void)$/;" f file: +utc_camera_get_display_rotation_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_display_rotation_negative(void)$/;" f file: +utc_camera_get_display_rotation_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_display_rotation_positive(void)$/;" f file: +utc_camera_get_preview_format_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_preview_format_negative(void)$/;" f file: +utc_camera_get_preview_format_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_preview_format_positive(void)$/;" f file: +utc_camera_get_preview_resolution_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_preview_resolution_negative(void)$/;" f file: +utc_camera_get_preview_resolution_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_preview_resolution_positive(void)$/;" f file: +utc_camera_get_x11_display_mode_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_x11_display_mode_negative(void){$/;" f file: +utc_camera_get_x11_display_mode_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_get_x11_display_mode_positive(void){$/;" f file: +utc_camera_is_x11_display_visible_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_is_x11_display_visible_negative(void){$/;" f file: +utc_camera_is_x11_display_visible_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_is_x11_display_visible_positive(void){$/;" f file: +utc_camera_set_capture_completed_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capture_completed_cb_negative(void)$/;" f file: +utc_camera_set_capture_completed_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capture_completed_cb_positive(void)$/;" f file: +utc_camera_set_capture_format_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capture_format_negative(void)$/;" f file: +utc_camera_set_capture_format_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capture_format_positive(void)$/;" f file: +utc_camera_set_capture_resolution_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capture_resolution_negative(void)$/;" f file: +utc_camera_set_capture_resolution_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capture_resolution_positive(void)$/;" f file: +utc_camera_set_capturing_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capturing_cb_negative(void)$/;" f file: +utc_camera_set_capturing_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_capturing_cb_positive(void)$/;" f file: +utc_camera_set_display_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_display_negative(void)$/;" f file: +utc_camera_set_display_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_display_positive(void)$/;" f file: +utc_camera_set_display_rotation_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_display_rotation_negative(void)$/;" f file: +utc_camera_set_display_rotation_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_display_rotation_positive(void)$/;" f file: +utc_camera_set_error_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_error_cb_negative(void)$/;" f file: +utc_camera_set_error_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_error_cb_positive(void)$/;" f file: +utc_camera_set_focus_changed_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_focus_changed_cb_negative(void)$/;" f file: +utc_camera_set_focus_changed_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_focus_changed_cb_positive(void)$/;" f file: +utc_camera_set_preview_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_preview_cb_negative(void)$/;" f file: +utc_camera_set_preview_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_preview_cb_positive(void)$/;" f file: +utc_camera_set_preview_format_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_preview_format_negative(void)$/;" f file: +utc_camera_set_preview_format_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_preview_format_positive(void)$/;" f file: +utc_camera_set_preview_resolution_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_preview_resolution_negative(void)$/;" f file: +utc_camera_set_preview_resolution_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_preview_resolution_positive(void)$/;" f file: +utc_camera_set_state_changed_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_state_changed_cb_negative(void)$/;" f file: +utc_camera_set_state_changed_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_state_changed_cb_positive(void)$/;" f file: +utc_camera_set_x11_display_mode_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_x11_display_mode_negative(void){$/;" f file: +utc_camera_set_x11_display_mode_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_x11_display_mode_positive(void){$/;" f file: +utc_camera_set_x11_display_visible_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_x11_display_visible_negative(void){$/;" f file: +utc_camera_set_x11_display_visible_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_set_x11_display_visible_positive(void){$/;" f file: +utc_camera_unset_capture_completed_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_capture_completed_cb_negative(void)$/;" f file: +utc_camera_unset_capture_completed_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_capture_completed_cb_positive(void)$/;" f file: +utc_camera_unset_capturing_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_capturing_cb_negative(void)$/;" f file: +utc_camera_unset_capturing_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_capturing_cb_positive(void)$/;" f file: +utc_camera_unset_error_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_error_cb_negative(void)$/;" f file: +utc_camera_unset_error_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_error_cb_positive(void)$/;" f file: +utc_camera_unset_focus_changed_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_focus_changed_cb_negative(void)$/;" f file: +utc_camera_unset_focus_changed_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_focus_changed_cb_positive(void)$/;" f file: +utc_camera_unset_preview_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_preview_cb_negative(void)$/;" f file: +utc_camera_unset_preview_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_preview_cb_positive(void)$/;" f file: +utc_camera_unset_state_changed_cb_negative TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_state_changed_cb_negative(void)$/;" f file: +utc_camera_unset_state_changed_cb_positive TC/testcase/utc_media_camera_setting.c /^static void utc_camera_unset_state_changed_cb_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_af_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_af_mode_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_af_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_af_mode_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_effect_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_effect_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_effect_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_effect_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_exposure_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_exposure_mode_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_exposure_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_exposure_mode_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_flash_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_flash_mode_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_flash_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_flash_mode_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_fps_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_fps_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_fps_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_fps_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_iso_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_iso_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_iso_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_iso_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_scene_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_scene_mode_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_scene_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_scene_mode_positive(void)$/;" f file: +utc_media_camera_attr_foreach_supported_whitebalance_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_whitebalance_negative(void)$/;" f file: +utc_media_camera_attr_foreach_supported_whitebalance_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_foreach_supported_whitebalance_positive(void)$/;" f file: +utc_media_camera_attr_get_effect_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_effect_negative(void)$/;" f file: +utc_media_camera_attr_get_effect_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_effect_positive(void)$/;" f file: +utc_media_camera_attr_get_flash_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_flash_mode_negative(void)$/;" f file: +utc_media_camera_attr_get_flash_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_flash_mode_positive(void)$/;" f file: +utc_media_camera_attr_get_image_quality_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_image_quality_negative(void)$/;" f file: +utc_media_camera_attr_get_image_quality_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_image_quality_positive(void)$/;" f file: +utc_media_camera_attr_get_lens_orientation_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_lens_orientation_negative(void)$/;" f file: +utc_media_camera_attr_get_lens_orientation_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_lens_orientation_positive(void)$/;" f file: +utc_media_camera_attr_get_preview_fps_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_preview_fps_negative(void)$/;" f file: +utc_media_camera_attr_get_preview_fps_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_preview_fps_positive(void)$/;" f file: +utc_media_camera_attr_get_scene_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_scene_mode_negative(void)$/;" f file: +utc_media_camera_attr_get_scene_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_scene_mode_positive(void)$/;" f file: +utc_media_camera_attr_get_tag_altitude_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_altitude_negative(void)$/;" f file: +utc_media_camera_attr_get_tag_altitude_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_altitude_positive(void)$/;" f file: +utc_media_camera_attr_get_tag_image_description_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_image_description_negative(void)$/;" f file: +utc_media_camera_attr_get_tag_image_description_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_image_description_positive(void)$/;" f file: +utc_media_camera_attr_get_tag_latitude_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_latitude_negative(void)$/;" f file: +utc_media_camera_attr_get_tag_latitude_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_latitude_positive(void)$/;" f file: +utc_media_camera_attr_get_tag_longitude_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_longitude_negative(void)$/;" f file: +utc_media_camera_attr_get_tag_longitude_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_longitude_positive(void)$/;" f file: +utc_media_camera_attr_get_tag_orientation_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_orientation_negative(void)$/;" f file: +utc_media_camera_attr_get_tag_orientation_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_orientation_positive(void)$/;" f file: +utc_media_camera_attr_get_tag_software_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_software_negative(void)$/;" f file: +utc_media_camera_attr_get_tag_software_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_get_tag_software_positive(void)$/;" f file: +utc_media_camera_attr_is_enable_tag_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_is_enable_tag_negative(void)$/;" f file: +utc_media_camera_attr_is_enable_tag_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_is_enable_tag_positive(void)$/;" f file: +utc_media_camera_attr_set_af_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_af_mode_negative(void)$/;" f file: +utc_media_camera_attr_set_af_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_af_mode_positive(void)$/;" f file: +utc_media_camera_attr_set_brightness_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_brightness_negative(void)$/;" f file: +utc_media_camera_attr_set_brightness_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_brightness_positive(void)$/;" f file: +utc_media_camera_attr_set_contrast_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_contrast_negative(void)$/;" f file: +utc_media_camera_attr_set_contrast_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_contrast_positive(void)$/;" f file: +utc_media_camera_attr_set_exposure_mode_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_exposure_mode_negative(void)$/;" f file: +utc_media_camera_attr_set_exposure_mode_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_exposure_mode_positive(void)$/;" f file: +utc_media_camera_attr_set_exposure_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_exposure_negative(void)$/;" f file: +utc_media_camera_attr_set_exposure_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_exposure_positive(void)$/;" f file: +utc_media_camera_attr_set_image_quality_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_image_quality_negative(void)$/;" f file: +utc_media_camera_attr_set_image_quality_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_image_quality_positive(void)$/;" f file: +utc_media_camera_attr_set_iso_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_iso_negative(void)$/;" f file: +utc_media_camera_attr_set_iso_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_iso_positive(void)$/;" f file: +utc_media_camera_attr_set_preview_fps_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_preview_fps_negative(void)$/;" f file: +utc_media_camera_attr_set_preview_fps_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_preview_fps_positive(void)$/;" f file: +utc_media_camera_attr_set_whitebalance_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_whitebalance_negative(void)$/;" f file: +utc_media_camera_attr_set_whitebalance_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_whitebalance_positive(void)$/;" f file: +utc_media_camera_attr_set_zoom_negative TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_zoom_negative(void)$/;" f file: +utc_media_camera_attr_set_zoom_positive TC/testcase/utc_media_camera_attr.c /^static void utc_media_camera_attr_set_zoom_positive(void)$/;" f file: +utc_media_camera_attribute_test TC/testcase/utc_media_camera_working.c /^void utc_media_camera_attribute_test(void)$/;" f +utc_media_camera_cancel_focusing_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_cancel_focusing_negative(void)$/;" f file: +utc_media_camera_cancel_focusing_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_cancel_focusing_positive(void)$/;" f file: +utc_media_camera_capture_test TC/testcase/utc_media_camera_working.c /^void utc_media_camera_capture_test(void){$/;" f +utc_media_camera_create_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_create_negative(void)$/;" f file: +utc_media_camera_create_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_create_positive(void)$/;" f file: +utc_media_camera_destroy_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_destroy_negative(void)$/;" f file: +utc_media_camera_destroy_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_destroy_positive(void)$/;" f file: +utc_media_camera_get_state_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_get_state_negative(void)$/;" f file: +utc_media_camera_get_state_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_get_state_positive(void)$/;" f file: +utc_media_camera_preview_test TC/testcase/utc_media_camera_working.c /^void utc_media_camera_preview_test(void)$/;" f +utc_media_camera_start_capture_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_start_capture_negative(void)$/;" f file: +utc_media_camera_start_capture_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_start_capture_positive(void)$/;" f file: +utc_media_camera_start_focusing_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_start_focusing_negative(void)$/;" f file: +utc_media_camera_start_focusing_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_start_focusing_positive(void)$/;" f file: +utc_media_camera_start_preview_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_start_preview_negative(void)$/;" f file: +utc_media_camera_start_preview_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_start_preview_positive(void)$/;" f file: +utc_media_camera_state_change_test TC/testcase/utc_media_camera_working.c /^void utc_media_camera_state_change_test(void){$/;" f +utc_media_camera_stop_preview_negative TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_stop_preview_negative(void)$/;" f file: +utc_media_camera_stop_preview_positive TC/testcase/utc_media_camera_lifecycle.c /^static void utc_media_camera_stop_preview_positive(void)$/;" f file: +utc_media_capture_resolution_test TC/testcase/utc_media_camera_working.c /^void utc_media_capture_resolution_test(void){$/;" f +whitebalance_test TC/testcase/utc_media_camera_working.c /^int whitebalance_test(camera_h camera){$/;" f +whitebalance_test test/multimedia_camera_test.c /^int whitebalance_test(camera_h camera){$/;" f +width TC/testcase/utc_media_camera_working.c /^ int width[100];$/;" m struct:__anon3 file: +width test/multimedia_camera_test.c /^ int width[100];$/;" m struct:__anon27 file: +win test/multimedia_camera_test.c /^ Evas_Object* win;$/;" m struct:__anon24 file: +zoom_test TC/testcase/utc_media_camera_working.c /^int zoom_test(camera_h camera){$/;" f +zoom_test test/multimedia_camera_test.c /^int zoom_test(camera_h camera){$/;" f diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..73c466c --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,21 @@ +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 new file mode 100755 index 0000000..1c65f3c --- /dev/null +++ b/test/multimedia_camera_test.c @@ -0,0 +1,1582 @@ +/* +* 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; +} + |