Add focus auto reacquirement option setting api
[platform/core/multimedia/libmm-sound.git] / include / mm_sound_focus.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2014 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 /**
23  * @file                mm_sound_focus.h
24  * @brief               Application interface library for sound module.
25  * @date
26  *
27  * Application interface library for sound module.
28  */
29
30 #ifndef __MM_SOUND_FOCUS_H__
31 #define __MM_SOUND_FOCUS_H__
32
33 #ifdef __cplusplus
34         extern "C" {
35 #endif
36
37 typedef enum {
38         FOCUS_IS_RELEASED,
39         FOCUS_IS_ACQUIRED,
40 } mm_sound_focus_state_e;
41
42 typedef enum {
43         FOCUS_NONE,
44         FOCUS_FOR_PLAYBACK,
45         FOCUS_FOR_CAPTURE,
46         FOCUS_FOR_BOTH,
47 } mm_sound_focus_type_e;
48
49 int mm_sound_focus_get_id(int *id);
50 int mm_sound_focus_is_cb_thread(bool *result);
51
52 typedef void (*mm_sound_focus_changed_cb) (int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data);
53 int mm_sound_register_focus(int id, const char *stream_type, mm_sound_focus_changed_cb callback, void *user_data);
54 int mm_sound_register_focus_for_session(int id, int pid, const char *stream_type, mm_sound_focus_changed_cb callback, void *user_data);
55 int mm_sound_unregister_focus(int id);
56 int mm_sound_set_focus_reacquisition(int id, bool reacquisition);
57 int mm_sound_get_focus_reacquisition(int id, bool *reacquisition);
58 int mm_sound_acquire_focus(int id, mm_sound_focus_type_e focus_type, const char *additional_info);
59 int mm_sound_release_focus(int id, mm_sound_focus_type_e focus_type, const char *additional_info);
60
61 typedef void (*mm_sound_focus_changed_watch_cb) (int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data);
62 int mm_sound_set_focus_watch_callback(mm_sound_focus_type_e focus_type, mm_sound_focus_changed_watch_cb callback, void *user_data, int *id);
63 int mm_sound_set_focus_watch_callback_for_session(int pid, mm_sound_focus_type_e focus_type, mm_sound_focus_changed_watch_cb callback, void *user_data, int *id);
64 int mm_sound_unset_focus_watch_callback(int id);
65
66 typedef void (*mm_sound_focus_session_interrupt_cb) (mm_sound_focus_state_e state, const char *reason_for_change, bool is_wcb, void *user_data);
67 int mm_sound_focus_set_session_interrupt_callback(mm_sound_focus_session_interrupt_cb callback, void *user_data);
68 int mm_sound_focus_unset_session_interrupt_callback(void);
69
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif  /* __MM_SOUND_FOCUS_H__ */
76