Merge from mobile product code for backward compatibility
[platform/core/api/audio-io.git] / include / CPulseStreamSpec.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_MEDIA_AUDIO_IO_CPULSESTREAM_SPEC_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_CPULSESTREAM_SPEC_H__
19
20
21 #ifdef __cplusplus
22
23
24 #include <pulse/pulseaudio.h>
25
26
27 namespace tizen_media_audio {
28
29
30     /**
31      * class CPulseStreamSpec
32      */
33     class CPulseStreamSpec {
34     public:
35         /* Enums */
36         enum class EStreamLatency : unsigned int {
37             STREAM_LATENCY_INPUT_LOW,
38             STREAM_LATENCY_INPUT_MID,
39             STREAM_LATENCY_INPUT_HIGH,
40             STREAM_LATENCY_INPUT_VOIP,
41             STREAM_LATENCY_INPUT_DEFAULT,
42             STREAM_LATENCY_OUTPUT_LOW,
43             STREAM_LATENCY_OUTPUT_MID,
44             STREAM_LATENCY_OUTPUT_HIGH,
45             STREAM_LATENCY_OUTPUT_VOIP,
46             STREAM_LATENCY_OUTPUT_DEFAULT,
47             STREAM_LATENCY_OUTPUT_DEFAULT_ASYNC,
48             STREAM_LATENCY_MAX
49         };
50
51         /* Constructor & Destructor */
52         CPulseStreamSpec();
53         CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo);
54         CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo, int customLatency);
55         ~CPulseStreamSpec();
56
57         /* Setter & Getter */
58         EStreamLatency getStreamLatency();
59         const char*    getStreamLatencyToString();
60         CAudioInfo&    getAudioInfo();
61         pa_sample_spec getSampleSpec();
62         pa_channel_map getChannelMap();
63         const char*    getStreamName();
64
65     private:
66         /* Private Methods */
67         void __adjustSpec();
68
69         /* Members */
70         EStreamLatency __mLatency;
71         CAudioInfo     __mAudioInfo;
72         pa_sample_spec __mSampleSpec;
73         pa_channel_map __mChannelMap;
74         const char*    __mStreamName;
75     };
76
77
78 } /* namespace tizen_media_audio */
79
80 #endif
81 #endif /* __TIZEN_MEDIA_AUDIO_IO_CPULSESTREAM_SPEC_H__ */