Rebase code with tizen 2.3 with following additional changes
[platform/core/multimedia/libmm-sound.git] / include / mm_sound_pa_client.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@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  #ifndef __MM_SOUND_PA_CLIENT__
22  #define __MM_SOUND_PA_CLIENT__
23
24 #include <pulse/simple.h>
25 #include <pulse/error.h>
26 #include <pulse/proplist.h>
27 #include <pulse/channelmap.h>
28 #include <pulse/pulseaudio.h>
29 #include <pulse/ext-policy.h>
30 #include "include/mm_sound.h"
31
32 typedef enum {
33         HANDLE_ROUTE_POLICY_DEFAULT,
34         HANDLE_ROUTE_POLICY_OUT_AUTO,
35         HANDLE_ROUTE_POLICY_OUT_HANDSET,
36         HANDLE_ROUTE_POLICY_OUT_ALL,
37         HANDLE_ROUTE_POLICY_IN_MIRRORING,
38         HANDLE_ROUTE_POLICY_IN_VOIP,
39 }MMSoundHandleRoutePolicy; /* custom route policy per handle */
40
41 typedef enum {
42         HANDLE_PRIORITY_NORMAL,
43         HANDLE_PRIORITY_SOLO,
44         HANDLE_PRIORITY_MAX,
45 }MMSoundHandlePriority;
46
47 typedef enum {
48         HANDLE_MODE_OUTPUT,                             /**< Output mode of handle */
49         HANDLE_MODE_OUTPUT_CLOCK,                       /**< Output mode of gst audio only mode */
50         HANDLE_MODE_OUTPUT_VIDEO,                       /**< Output mode of gst video mode */
51         HANDLE_MODE_OUTPUT_LOW_LATENCY, /**< Output mode for low latency play mode. typically for game */
52         HANDLE_MODE_INPUT,                                      /**< Input mode of handle */
53         HANDLE_MODE_INPUT_HIGH_LATENCY, /**< Input mode for high latency capture mode. */
54         HANDLE_MODE_INPUT_LOW_LATENCY,          /**< Input mode for low latency capture mode. typically for VoIP */
55         HANDLE_MODE_CALL_OUT,                           /**< for voice call establish */
56         HANDLE_MODE_CALL_IN,                            /**< for voice call establish */
57         HANDLE_MODE_OUTPUT_AP_CALL,             /**< for VT call on thin modem */
58         HANDLE_MODE_INPUT_AP_CALL,                      /**< for VT call on thin modem */
59         HANDLE_MODE_NUM,                                        /**< Number of mode */
60 }MMSoundHandleMode;
61
62 enum mm_sound_handle_direction_t {
63         HANDLE_DIRECTION_NONE,
64         HANDLE_DIRECTION_IN,
65         HANDLE_DIRECTION_OUT,
66 };
67
68 typedef struct mm_sound_handle_route_info{
69         MMSoundHandleRoutePolicy policy;
70         mm_sound_device_in device_in;
71         mm_sound_device_out device_out;
72         bool do_not_restore;
73 }mm_sound_handle_route_info;
74
75 int mm_sound_pa_open(MMSoundHandleMode mode, mm_sound_handle_route_info *route_info, MMSoundHandlePriority priority, int volume_config, pa_sample_spec* ss, pa_channel_map* channel_map, int* size);
76 int mm_sound_pa_read(const int handle, void* buf, const int size);
77 int mm_sound_pa_write(const int handle, void* buf, const int size);
78 int mm_sound_pa_close(const int handle);
79 int mm_sound_pa_cork(const int handle, const int cork);
80 int mm_sound_pa_drain(const int handle);
81 int mm_sound_pa_set_volume_by_type(const int type, const int value);
82 int mm_sound_pa_get_latency(const int handle, int* latency);
83 int mm_sound_pa_set_call_mute(const int type, const int mute, int direction);
84 int mm_sound_pa_get_volume_max(const int type, int* step);
85 int mm_sound_pa_get_volume_level(const int handle, const int type, int* level);
86 int mm_sound_pa_set_volume_level(const int handle, const int type, int level);
87 int mm_sound_pa_set_mute(const int handle, const int type, int direction, int mute);
88 int mm_sound_pa_get_mute(const int handle, const int type, int direction, int* mute);
89 int mm_sound_pa_corkall(int cork);
90
91 #endif