Manage focus cb thread and focus watch cb thread separately
[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 #include <stdbool.h>
38
39 typedef enum {
40         FOCUS_IS_RELEASED,
41         FOCUS_IS_ACQUIRED,
42 } mm_sound_focus_state_e;
43
44 typedef enum {
45         FOCUS_NONE,
46         FOCUS_FOR_PLAYBACK,
47         FOCUS_FOR_CAPTURE,
48         FOCUS_FOR_BOTH,
49 } mm_sound_focus_type_e;
50
51 int mm_sound_focus_is_cb_thread(bool *result, bool *is_for_watching);
52
53 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, int option, const char *ext_info, void *user_data);
54 int mm_sound_register_focus(const char *stream_type, mm_sound_focus_changed_cb callback, void *user_data, int *id);
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_get_stream_type_of_acquired_focus(int focus_type, char **stream_type, int *option, char **ext_info);
59 int mm_sound_acquire_focus(int id, mm_sound_focus_type_e focus_type, const char *ext_info);
60 int mm_sound_release_focus(int id, mm_sound_focus_type_e focus_type, const char *ext_info);
61 int mm_sound_acquire_focus_with_option(int id, mm_sound_focus_type_e focus_type, int option, const char *ext_info);
62 int mm_sound_release_focus_with_option(int id, mm_sound_focus_type_e focus_type, int option, const char *ext_info);
63 int mm_sound_update_focus_status(int id, unsigned int status);
64 int mm_sound_deliver_focus(int src_id, int dst_id, mm_sound_focus_type_e focus_type);
65
66 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 *ext_info, void *user_data);
67 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);
68 int mm_sound_unset_focus_watch_callback(int id);
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif  /* __MM_SOUND_FOCUS_H__ */
75