Rebase code with tizen 2.3 with following additional changes
[platform/core/multimedia/libmm-sound.git] / include / mm_sound_device.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_device.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_DEVICE_H__
31 #define __MM_SOUND_DEVICE_H__
32
33 #include <glib.h>
34
35 #ifdef __cplusplus
36         extern "C" {
37 #endif
38
39 #define MAX_DEVICE_NAME_NUM 256
40 typedef struct {
41         int type;
42         int io_direction;
43         int id;
44         char name[MAX_DEVICE_NAME_NUM];
45         int state;
46 } mm_sound_device_t;
47
48 typedef struct {
49         GList *list;
50 } mm_sound_device_list_t;
51
52 typedef enum {
53         DEVICE_IO_DIRECTION_IN,
54         DEVICE_IO_DIRECTION_OUT,
55         DEVICE_IO_DIRECTION_BOTH,
56 } device_io_direction_e;
57
58 typedef enum {
59         DEVICE_STATE_DEACTIVATED,
60         DEVICE_STATE_ACTIVATED,
61 } device_state_e;
62
63 typedef enum {
64         DEVICE_CHANGED_INFO_STATE,
65         DEVICE_CHANGED_INFO_IO_DIRECTION,
66 } device_changed_info_e;
67
68 typedef enum
69 {
70         DEVICE_UPDATE_STATUS_DISCONNECTED = 0,
71         DEVICE_UPDATE_STATUS_CONNECTED,
72         DEVICE_UPDATE_STATUS_CHANGED_INFO_STATE,
73         DEVICE_UPDATE_STATUS_CHANGED_INFO_IO_DIRECTION,
74 } device_update_status_e;
75
76 typedef enum
77 {
78         DEVICE_TYPE_BUILTIN_SPEAKER,   /**< Built-in speaker. */
79         DEVICE_TYPE_BUILTIN_RECEIVER,  /**< Built-in receiver. */
80         DEVICE_TYPE_BUILTIN_MIC,       /**< Built-in mic. */
81         DEVICE_TYPE_AUDIOJACK,         /**< Audio jack such as headphone, headset, and so on. */
82         DEVICE_TYPE_BLUETOOTH,         /**< Bluetooth */
83         DEVICE_TYPE_HDMI,              /**< HDMI. */
84         DEVICE_TYPE_MIRRORING,         /**< MIRRORING. */
85         DEVICE_TYPE_USB_AUDIO,         /**< USB Audio. */
86 } device_type_e;
87
88 typedef enum {
89         DEVICE_IO_DIRECTION_IN_FLAG      = 0x0001,  /**< Flag for input devices */
90         DEVICE_IO_DIRECTION_OUT_FLAG     = 0x0002,  /**< Flag for output devices */
91         DEVICE_IO_DIRECTION_BOTH_FLAG    = 0x0004,  /**< Flag for input/output devices (both directions are available) */
92         DEVICE_TYPE_INTERNAL_FLAG        = 0x0010,  /**< Flag for built-in devices */
93         DEVICE_TYPE_EXTERNAL_FLAG        = 0x0020,  /**< Flag for external devices */
94         DEVICE_STATE_DEACTIVATED_FLAG    = 0x1000,  /**< Flag for deactivated devices */
95         DEVICE_STATE_ACTIVATED_FLAG      = 0x2000,  /**< Flag for activated devices */
96         DEVICE_ALL_FLAG                  = 0xFFFF,  /**< Flag for all devices */
97 } device_flag_e;
98
99 typedef enum {
100         DEVICE_IO_DIRECTION_FLAGS      = 0x000F,  /**< Flag for io direction */
101         DEVICE_TYPE_FLAGS              = 0x00F0,  /**< Flag for device type */
102         DEVICE_STATE_FLAGS             = 0xF000,  /**< Flag for device state */
103 } device_flags_type_e;
104
105 #define IS_INTERNAL_DEVICE(x_device_type) (((DEVICE_TYPE_BUILTIN_SPEAKER <= x_device_type) && (x_device_type <= DEVICE_TYPE_BUILTIN_MIC)) ? true : false)
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif  /* __MM_SOUND_DEVICE_H__ */
112