RDK Documentation (Open Sourced RDK Components)
audiocapturemgr_iarm.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 #ifndef _AUDIOCAPTUREMGR_IARM_H_
20 #define _AUDIOCAPTUREMGR_IARM_H_
21 #include "basic_types.h"
22 
23 /**
24  * @addtogroup AUDIO_CAPTURE_MANAGER_API
25  * @{
26  */
27 
28 #define IARMBUS_AUDIOCAPTUREMGR_NAME "audiocapturemgr"
29 /*Original API list*/
30 #define IARMBUS_AUDIOCAPTUREMGR_ENABLE "enableCapture"
31 #define IARMBUS_AUDIOCAPTUREMGR_REQUEST_SAMPLE "requestSample"
32 
33 /*New API list*/
34 #define IARMBUS_AUDIOCAPTUREMGR_OPEN "open"
35 #define IARMBUS_AUDIOCAPTUREMGR_CLOSE "close"
36 #define IARMBUS_AUDIOCAPTUREMGR_START "start"
37 #define IARMBUS_AUDIOCAPTUREMGR_STOP "stop"
38 #define IARMBUS_AUDIOCAPTUREMGR_GET_DEFAULT_AUDIO_PROPS "getDefaultAudioProperties"
39 #define IARMBUS_AUDIOCAPTUREMGR_GET_AUDIO_PROPS "getAudioProperties"
40 #define IARMBUS_AUDIOCAPTUREMGR_GET_OUTPUT_PROPS "getOutputProperties"
41 #define IARMBUS_AUDIOCAPTUREMGR_SET_AUDIO_PROPERTIES "setAudioProperties"
42 #define IARMBUS_AUDIOCAPTUREMGR_SET_OUTPUT_PROPERTIES "setOutputProperties"
43 
44 /*End API list*/
45 
46 #define AUDIOCAPTUREMGR_FILENAME_PREFIX "audio_sample"
47 #define AUDIOCAPTUREMGR_FILE_PATH "/opt/"
48 
49 #ifdef __cplusplus
50 namespace audiocapturemgr
51 {
52 #endif
53 
54  typedef enum
55  {
56  BUFFERED_FILE_OUTPUT = 0,
57  REALTIME_SOCKET,
58  MAX_SUPPORTED_OUTPUT_TYPES
59  }iarmbus_output_type_t;
60 
61  typedef int session_id_t;
62  typedef enum
63  {
64  DATA_CAPTURE_IARM_EVENT_AUDIO_CLIP_READY = 0,
65  IARMBUS_MAX_ACM_EVENT
66  }iarmbus_events_t;
67 
68  typedef enum
69  {
70  ACM_RESULT_SUCCESS = 0,
71  ACM_RESULT_UNSUPPORTED_API,
72  ACM_RESULT_STREAM_UNAVAILABLE,
73  ACM_RESULT_DURATION_OUT_OF_BOUNDS,
74  ACM_RESULT_BAD_SESSION_ID,
75  ACM_RESULT_INVALID_ARGUMENTS,
76  ACM_RESULT_GENERAL_FAILURE,
77  ACM_RESULT_PRECAPTURE_DURATION_TOO_LONG = 254,
78  ACM_RESULT_PRECAPTURE_NOT_SUPPORTED = 255
79  }iarmbus_audiocapturemgr_result_t;
80 
81 
82  typedef enum {
83  acmFormate16BitStereo, /* !< Stereo, 16 bits per sample interleaved into a 32-bit word. */
84  acmFormate24BitStereo, /* !< Stereo, 24 bits per sample. The data is aligned to 32-bits,
85  left-justified. Left and right channels will interleave
86  one sample per 32-bit word. */
87  acmFormate16BitMonoLeft, /* !< Mono, 16 bits per sample interleaved into a 32-bit word. Left channel samples only. */
88  acmFormate16BitMonoRight, /* !< Mono, 16 bits per sample interleaved into a 32-bit word. Right channel samples only. */
89  acmFormate16BitMono, /* !< Mono, 16 bits per sample interleaved into a 32-bit word. Left and Right channels mixed. */
90  acmFormate24Bit5_1, /* !< 5.1 Multichannel, 24 bits per sample. The data is aligned to 32-bits,
91  left-justified. Channels will interleave
92  one sample per 32-bit word, ordered L,R,Ls,Rs,C,LFE. */
93  acmFormateMax
94  } iarmbus_acm_format;
95 
96 
97  typedef enum {
98  acmFreqe16000, /*!< 16KHz */
99  acmFreqe24000, /*!< 24kHz */
100  acmFreqe32000, /*!< 32KHz */
101  acmFreqe44100, /*!< 44.1KHz */
102  acmFreqe48000, /*!< 48KHz */
103  acmFreqeMax
105 
106 
107  typedef struct
108  {
109  unsigned int result;
110  float max_duration;
112 
113  typedef struct
114  {
115  iarmbus_acm_format format;
116  iarmbus_acm_freq sampling_frequency;
117  size_t fifo_size;
118  size_t threshold;
119  unsigned int delay_compensation_ms;
121 
122 
123 
124  typedef struct
125  {
126  float duration;
127  bool is_precapture;
129 
130  typedef struct
131  {
132  char dataLocator[64];
134 
135  #define MAX_OUTPUT_PATH_LEN 256
136  typedef struct
137  {
138  union
139  {
140  char file_path[MAX_OUTPUT_PATH_LEN]; //!< get unix domain socket name (ip out)
141  unsigned int buffer_duration; //!< set precapture duration (music id)
142  unsigned int max_buffer_duration; //!< get max supported buffer duration (music id)
143  }output;
145 
146  typedef struct
147  {
148  int source;//!< 0 for primary, increasing by 1 for each new source.
149  iarmbus_output_type_t output_type;
151 
152  typedef struct
153  {
154  session_id_t session_id;
155  int result;
156  union
157  {
158  iarmbus_open_args arg_open;
159  audio_properties_ifce_t arg_audio_properties;
160  iarmbus_request_payload_t arg_sample_request;
161  iarmbus_delivery_props_t arg_output_props;
162  }details;
164 
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif //_AUDIOCAPTUREMGR_IARM_H_
171 
172 /**
173  * @}
174  */
175 
176 
acmFreqe44100
@ acmFreqe44100
Definition: audiocapturemgr_iarm.h:101
iarmbus_open_args
Definition: audiocapturemgr_iarm.h:146
acmFreqe32000
@ acmFreqe32000
Definition: audiocapturemgr_iarm.h:100
iarmbus_delivery_props_t
Definition: audiocapturemgr_iarm.h:136
iarmbus_open_args::source
int source
0 for primary, increasing by 1 for each new source.
Definition: audiocapturemgr_iarm.h:148
iarmbus_notification_payload_t
Definition: audiocapturemgr_iarm.h:130
acmFreqe16000
@ acmFreqe16000
Definition: audiocapturemgr_iarm.h:98
iarmbus_acm_freq
iarmbus_acm_freq
Definition: audiocapturemgr_iarm.h:97
audio_properties_ifce_t
Definition: audiocapturemgr_iarm.h:113
acmFreqe24000
@ acmFreqe24000
Definition: audiocapturemgr_iarm.h:99
iarmbus_enable_payload_t
Definition: audiocapturemgr_iarm.h:107
acmFreqe48000
@ acmFreqe48000
Definition: audiocapturemgr_iarm.h:102
iarmbus_acm_arg_t
Definition: audiocapturemgr_iarm.h:152
iarmbus_request_payload_t
Definition: audiocapturemgr_iarm.h:124