Merge branch 'tizen_3.0' into tizen
[platform/core/multimedia/libmm-sound.git] / focus_server / include / mm_sound_mgr_focus.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Sangchul Lee <sc11.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_SOUND_MGR_FOCUS_H__
23 #define __MM_SOUND_MGR_FOCUS_H__
24
25 #include "../include/mm_sound.h"
26 #include "../include/mm_sound_focus.h"
27 #include "../include/mm_sound_stream.h"
28 #include "../include/mm_ipc.h"
29 #include "mm_sound_mgr_focus_ipc.h"
30
31 typedef enum
32 {
33         FOCUS_COMMAND_RELEASE,
34         FOCUS_COMMAND_ACQUIRE,
35 } focus_command_e;
36
37 typedef enum
38 {
39         FOCUS_TYPE_PLAYBACK = 1,
40         FOCUS_TYPE_CAPTURE,
41         FOCUS_TYPE_BOTH,
42 } focus_type_e;
43
44 typedef enum
45 {
46         FOCUS_STATUS_DEACTIVATED,
47         FOCUS_STATUS_ACTIVATED_PLAYBACK,
48         FOCUS_STATUS_ACTIVATED_CAPTURE,
49         FOCUS_STATUS_ACTIVATED_BOTH,
50 } focus_status_e;
51
52 typedef struct {
53         int pid;
54         int handle_id;
55         char stream_type[MAX_STREAM_TYPE_LEN];
56         char ext_info[MM_SOUND_NAME_NUM];
57         focus_type_e request_type;
58         int option;
59         void *callback;
60         void *cbdata;
61         bool reacquisition;
62
63         /* It will be removed when the session concept is completely left out*/
64         bool is_for_session;
65 } _mm_sound_mgr_focus_param_t;
66
67 typedef struct _taken_by_id
68 {
69         int pid;
70         int handle_id;
71         bool by_session;
72 } _focus_taken_by_id_t;
73
74 typedef struct {
75         int pid;
76         int handle_id;
77         int priority;
78         bool is_for_watch;
79         char stream_type[MAX_STREAM_TYPE_LEN];
80         char ext_info[NUM_OF_STREAM_IO_TYPE][MM_SOUND_NAME_NUM];
81         int option[NUM_OF_STREAM_IO_TYPE];
82         focus_status_e status;
83         _focus_taken_by_id_t taken_by_id[NUM_OF_STREAM_IO_TYPE];
84         _focus_taken_by_id_t taken_backup[NUM_OF_STREAM_IO_TYPE];
85         void *callback;
86         void *cbdata;
87         bool reacquisition;
88
89         /* These will be removed when the session concept is completely left out*/
90         bool is_for_session;
91         bool reacquisition_with_released_state;
92 } focus_node_t;
93
94 int MMSoundMgrFocusInit(void);
95 int MMSoundMgrFocusFini(void);
96 int mm_sound_mgr_focus_create_node (const _mm_sound_mgr_focus_param_t *param);
97 int mm_sound_mgr_focus_destroy_node (const _mm_sound_mgr_focus_param_t *param);
98 int mm_sound_mgr_focus_set_reacquisition (const _mm_sound_mgr_focus_param_t *param);
99 int mm_sound_mgr_focus_get_stream_type_of_acquired_focus(focus_type_e focus_type, char **stream_type, int *option, char **ext_info);
100 int mm_sound_mgr_focus_request_acquire (const _mm_sound_mgr_focus_param_t *param);
101 int mm_sound_mgr_focus_request_release (const _mm_sound_mgr_focus_param_t *param);
102 int mm_sound_mgr_focus_set_watch_cb (const _mm_sound_mgr_focus_param_t *param);
103 int mm_sound_mgr_focus_unset_watch_cb (const _mm_sound_mgr_focus_param_t *param);
104 int mm_sound_mgr_focus_emergent_exit(const _mm_sound_mgr_focus_param_t *param);
105
106 #endif /* __MM_SOUND_MGR_FOCUS_H__ */
107