Add support for SOUND_STREAM_TYPE_SOLO by internal API 96/60196/4
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 24 Feb 2016 06:20:40 +0000 (15:20 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 24 Feb 2016 08:31:35 +0000 (17:31 +0900)
[Version] Release 0.3.43
[Profile] Common
[Issue Type] New feature

Change-Id: I029d410dbc69051353e5cdd7c3c868520f7382ff
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/sound_manager_internal.h
include/sound_manager_private.h
packaging/capi-media-sound-manager.spec
src/sound_manager.c
src/sound_manager_internal.c
src/sound_manager_private.c

index c1fa6429ff417b7be991ed6bc5efee20a66d8789..d6eab564d0a255f740388784b3ffd583d8c49461 100644 (file)
@@ -66,6 +66,7 @@ typedef enum {
        SOUND_STREAM_TYPE_VIDEO_CALL,          /**< Sound stream type for video-call */
        SOUND_STREAM_TYPE_RADIO,               /**< Sound stream type for radio */
        SOUND_STREAM_TYPE_LOOPBACK,            /**< Sound stream type for loopback */
+       SOUND_STREAM_TYPE_SOLO,                /**< Sound stream type for solo */
 } sound_stream_type_internal_e;
 
 /**
index 146e27dd850993b843cec0a918a2098b0a30e7d4..feb3c657bc8562b6e699d813f366d6dc099b6bab 100644 (file)
@@ -154,6 +154,7 @@ typedef struct _manual_route_info_s {
 typedef struct _sound_stream_info_s {
        unsigned int index;
        char *stream_type;
+       bool is_focus_unavailable;
        pa_threaded_mainloop *pa_mainloop;
        pa_context *pa_context;
        stream_conf_info_s stream_conf_info;
@@ -233,6 +234,8 @@ int _convert_stream_type(sound_stream_type_e enum_type, char **stream_type);
 
 int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_enum, char **stream_type);
 
+void _set_focus_availability(sound_stream_info_s *stream_info);
+
 int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_focus_change_reason_e *change_reason);
 
 int _convert_device_type(sound_device_type_e device_type_enum, char **device_type);
index fdd19ffce0b0d77899c1d29186e90a29ba2b92ba..e609da699a2eb49815c3495eaa6f04d458dd3be6 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.42
+Version:    0.3.43
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 1a555d4b4839ae2e129b034226c96a7e8a8d0755..12d1e3b6a893d6b14bade6439e16bb30f03b8aa7 100644 (file)
@@ -197,6 +197,7 @@ int sound_manager_create_stream_information(sound_stream_type_e stream_type, sou
                memset(stream_h, 0, sizeof(sound_stream_info_s));
                ret = _convert_stream_type(stream_type, &stream_h->stream_type);
                if (ret == MM_ERROR_NONE) {
+                       _set_focus_availability(stream_h);
                        ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data);
                        if (ret == MM_ERROR_NONE) {
                                *stream_info = (sound_stream_info_h)stream_h;
@@ -310,6 +311,9 @@ int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_fo
 
        SM_INSTANCE_CHECK(stream_h);
 
+       if (stream_h->is_focus_unavailable)
+               return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+
        ret = mm_sound_acquire_focus(stream_h->index, (mm_sound_focus_type_e)focus_mask, additional_info);
        if (ret == MM_ERROR_NONE) {
                stream_h->acquired_focus |= focus_mask;
index a8c885957728cad4cd27e160b1ed48b784965e0a..411eab28783e36234cf8a708fd3c948d1397e70c 100644 (file)
@@ -84,6 +84,7 @@ int sound_manager_create_stream_information_internal(sound_stream_type_internal_
                memset(stream_h, 0, sizeof(sound_stream_info_s));
                ret = _convert_stream_type_for_internal(stream_type, &stream_h->stream_type);
                if (ret == MM_ERROR_NONE) {
+                       _set_focus_availability(stream_h);
                        ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data);
                        if (!ret) {
                                *stream_info = (sound_stream_info_h)stream_h;
index 4db3b3cdaa0e0d0d4e06070dbd117403538333e3..723f265d37def92dd15abd3e5e77bda4f521c08c 100644 (file)
@@ -153,7 +153,7 @@ int _convert_stream_type(sound_stream_type_e stream_type_enum, char **stream_typ
                ret = MM_ERROR_SOUND_INTERNAL;
                break;
        }
-       LOGI("stream_type[%s]", stream_type);
+       LOGI("stream_type[%s]", *stream_type);
 
        return ret;
 }
@@ -184,6 +184,9 @@ int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_e
        case SOUND_STREAM_TYPE_LOOPBACK:
                *stream_type = "loopback";
                break;
+       case SOUND_STREAM_TYPE_SOLO:
+               *stream_type = "solo";
+               break;
        default:
                LOGE("could not find the stream_type[%d] in this switch case statement", stream_type_enum);
                ret = MM_ERROR_SOUND_INTERNAL;
@@ -194,6 +197,20 @@ int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_e
        return ret;
 }
 
+void _set_focus_availability(sound_stream_info_s *stream_info)
+{
+       if (stream_info == NULL || stream_info->stream_type == NULL) {
+               LOGE("invalid argument");
+               return;
+       }
+       if (!strncmp(stream_info->stream_type, "solo", SOUND_STREAM_TYPE_LEN)) {
+               stream_info->is_focus_unavailable = true;
+               LOGI("this stream_type[%s] does not support focus", stream_info->stream_type);
+       }
+
+       return;
+}
+
 int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_focus_change_reason_e *change_reason)
 {
        int ret = MM_ERROR_NONE;