summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCMakeLists.txt2
-rwxr-xr-xinclude/camera.h30
-rwxr-xr-xpackaging/capi-media-camera.spec5
-rwxr-xr-xsrc/camera.c31
4 files changed, 49 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 673daab..f9ba3e3 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,7 @@ SET(service "media")
SET(submodule "camera")
# for package file
-SET(dependents "dlog mm-camcorder capi-base-common")
+SET(dependents "dlog audio-session-mgr mm-camcorder capi-base-common")
SET(pc_dependents "capi-base-common")
SET(fw_name "${project_prefix}-${service}-${submodule}")
diff --git a/include/camera.h b/include/camera.h
index 5894d67..0261436 100755
--- a/include/camera.h
+++ b/include/camera.h
@@ -46,16 +46,18 @@ extern "C" {
*/
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_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_SOUND_POLICY_BY_CALL = CAMERA_ERROR_CLASS | 0x0a, /**< Blocked by Audio Session Manager - CALL */
+ CAMERA_ERROR_SOUND_POLICY_BY_ALARM = CAMERA_ERROR_CLASS | 0x0b, /**< Blocked by Audio Session Manager - ALARM */
} camera_error_e;
@@ -188,9 +190,11 @@ typedef enum
*/
typedef enum
{
- CAMERA_POLICY_NONE = 0, /**< None */
- CAMERA_POLICY_SOUND, /**< Sound policy */
- CAMERA_POLICY_SECURITY /**< Security policy */
+ CAMERA_POLICY_NONE = 0, /**< None */
+ CAMERA_POLICY_SOUND, /**< Sound policy */
+ CAMERA_POLICY_SOUND_BY_CALL, /**< Sound policy by CALL */
+ CAMERA_POLICY_SOUND_BY_ALARM, /**< Sound policy by ALARM */
+ CAMERA_POLICY_SECURITY /**< Security policy */
} camera_policy_e;
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index 23b1380..5aa412b 100755
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -1,13 +1,14 @@
Name: capi-media-camera
Summary: A Camera library in Tizen C API
-Version: 0.1.3
-Release: 1
+Version: 0.1.4
+Release: 0
Group: libdevel
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(mm-camcorder)
+BuildRequires: pkgconfig(audio-session-mgr)
BuildRequires: pkgconfig(capi-base-common)
%description
diff --git a/src/camera.c b/src/camera.c
index b128fdf..e99d2d3 100755
--- a/src/camera.c
+++ b/src/camera.c
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <mm.h>
+#include <audio-session-manager-types.h>
#include <mm_camcorder.h>
#include <mm_types.h>
#include <math.h>
@@ -114,6 +115,14 @@ static int __convert_camera_error_code(const char* func, int code){
ret = CAMERA_ERROR_SOUND_POLICY;
errorstr = "ERROR_SOUND_POLICY";
break;
+ case MM_ERROR_POLICY_BLOCKED_BY_CALL:
+ ret = CAMERA_ERROR_SOUND_POLICY_BY_CALL;
+ errorstr = "ERROR_SOUND_POLICY_BY_CALL";
+ break;
+ case MM_ERROR_POLICY_BLOCKED_BY_ALARM:
+ ret = CAMERA_ERROR_SOUND_POLICY_BY_ALARM;
+ errorstr = "ERROR_SOUND_POLICY_BY_ALARM";
+ break;
case MM_ERROR_POLICY_RESTRICTED:
ret = CAMERA_ERROR_SECURITY_RESTRICTED;
errorstr = "ERROR_RESTRICTED";
@@ -293,10 +302,26 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat
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 )
+ if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM) {
+ switch (m->state.code) {
+ case ASM_EVENT_SOURCE_CALL_START:
+ policy = CAMERA_POLICY_SOUND_BY_CALL;
+ LOGE("CAMERA_POLICY_SOUND_BY_CALL");
+ break;
+ case ASM_EVENT_SOURCE_ALARM_START:
+ case ASM_EVENT_SOURCE_ALARM_END:
+ policy = CAMERA_POLICY_SOUND_BY_ALARM;
+ LOGE("CAMERA_POLICY_SOUND_BY_ALARM");
+ break;
+ default:
+ policy = CAMERA_POLICY_SOUND;
+ LOGE("CAMERA_POLICY_SOUND");
+ break;
+ }
+ } else if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY) {
policy = CAMERA_POLICY_SECURITY;
+ LOGE("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]);