summaryrefslogtreecommitdiff
path: root/include/avsys-audio.h
blob: 8fd6ea517476bcda2ad958bc11905580763d6e88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
/*
 * avsystem
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Jonghyuk Choi <jhchoi.choi@samsung.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef __AVSYS_AUDIO_H__
#define __AVSYS_AUDIO_H__

#include "avsys-types.h"
#include "avsys-error.h"

#ifdef __cplusplus
	extern "C" {
#endif

/**
	@addtogroup AVSYSTEM
	@{

	@par
	This part describes the interface with audio input/output.
 */

#define AVSYS_AUDIO_VOLUME_MAX_MULTIMEDIA	16
#define AVSYS_AUDIO_VOLUME_MAX_BASIC		8
#define AVSYS_AUDIO_VOLUME_MAX_SINGLE		1

/**
 * Enumerations for audio mode
 */
enum avsys_audio_mode_t {
	AVSYS_AUDIO_MODE_OUTPUT,				/**< Output mode of handle */
	AVSYS_AUDIO_MODE_OUTPUT_CLOCK,			/**< Output mode of gst audio only mode */
	AVSYS_AUDIO_MODE_OUTPUT_VIDEO,			/**< Output mode of gst video mode */
	AVSYS_AUDIO_MODE_OUTPUT_LOW_LATENCY,	/**< Output mode for low latency play mode. typically for game */
	AVSYS_AUDIO_MODE_INPUT,					/**< Input mode of handle */
	AVSYS_AUDIO_MODE_INPUT_HIGH_LATENCY,	/**< Input mode for high latency capture mode. */
	AVSYS_AUDIO_MODE_INPUT_LOW_LATENCY,		/**< Input mode for low latency capture mode. typically for VoIP */
	AVSYS_AUDIO_MODE_CALL_OUT,				/**< for voice call establish */
	AVSYS_AUDIO_MODE_CALL_IN,				/**< for voice call establish */
	AVSYS_AUDIO_MODE_OUTPUT_AP_CALL,		/**< for VT call on thin modem */
	AVSYS_AUDIO_MODE_INPUT_AP_CALL,			/**< for VT call on thin modem */
	AVSYS_AUDIO_MODE_NUM,					/**< Number of mode */
};

/**
 * Enumerations for audio format
 */
enum avsys_audio_format_t {
	AVSYS_AUDIO_FORMAT_UNKNOWN	= -1,					/**< Invalid audio format */
	AVSYS_AUDIO_FORMAT_8BIT,							/**< Unsigned 8Bit */
	AVSYS_AUDIO_FORMAT_16BIT,							/**< Signed 16bit Little Endian */
	AVSYS_AUDIO_FORMAT_MIN = AVSYS_AUDIO_FORMAT_8BIT,	/**< Minimum value 8-bit integer per sample */
	AVSYS_AUDIO_FORMAT_MAX = AVSYS_AUDIO_FORMAT_16BIT,	/**< Maximum value 16-bit integer per sample */
};


/*
 * Enums for volume types
 */
enum avsys_audio_volume_type_t {
	AVSYS_AUDIO_VOLUME_TYPE_SYSTEM,
	AVSYS_AUDIO_VOLUME_TYPE_NOTIFICATION,
	AVSYS_AUDIO_VOLUME_TYPE_ALARM,
	AVSYS_AUDIO_VOLUME_TYPE_RINGTONE,
	AVSYS_AUDIO_VOLUME_TYPE_MEDIA,
	AVSYS_AUDIO_VOLUME_TYPE_CALL,
	AVSYS_AUDIO_VOLUME_TYPE_FIXED,
	AVSYS_AUDIO_VOLUME_TYPE_EXT_SYSTEM_JAVA,
	AVSYS_AUDIO_VOLUME_TYPE_MEDIA_HL,
	AVSYS_AUDIO_VOLUME_TYPE_NUM,
	AVSYS_AUDIO_VOLUME_TYPE_MAX = AVSYS_AUDIO_VOLUME_TYPE_NUM,
	AVSYS_AUDIO_VOLUME_TYPE_EXT_SYSTEM_ANDROID = AVSYS_AUDIO_VOLUME_TYPE_FIXED,
};

enum avsys_audio_priority_t {
	AVSYS_AUDIO_PRIORITY_0 = 0,	/*< deprecated. use AVSYS_AUDIO_PRIORITY_NORMAL or AVSYS_AUDIO_PRIORITY_SOLO instead */
	AVSYS_AUDIO_PRIORITY_NORMAL = AVSYS_AUDIO_PRIORITY_0,
	AVSYS_AUDIO_PRIORITY_SOLO,
	AVSYS_AUDIO_PRIORITY_SOLO_WITH_TRANSITION_EFFECT,
	AVSYS_AUDIO_PRIORITY_MAX,
};

enum avsys_audio_device_t {
	AVSYS_AUDIO_DEVICE_TYPE_SPK = 0,
	AVSYS_AUDIO_DEVICE_TYPE_RECV,
	AVSYS_AUDIO_DEVICE_TYPE_HEADSET,
	AVSYS_AUDIO_DEVICE_TYPE_HANDSFREE,
	AVSYS_AUDIO_DEVICE_TYPE_BT,
	AVSYS_AUDIO_DEVICE_TYPE_NUM,
	AVSYS_AUDIO_DEVICE_TYPE_MAX = AVSYS_AUDIO_DEVICE_TYPE_NUM,
};

/**
 * Enumerations for audio channel
 */
enum avsys_audio_channel_t {
	AVSYS_AUDIO_CHANNEL_LEFT,			/**< front-left channel */
	AVSYS_AUDIO_CHANNEL_RIGHT,			/**< front-righth channel */
	AVSYS_AUDIO_CHANNEL_NUM,			/**< Number of channels */
};

/**
 * Enumerations for audio mute condition
 */
enum avsys_audio_mute_t {
	AVSYS_AUDIO_UNMUTE = 0,				/**< Unmute state */
	AVSYS_AUDIO_MUTE,					/**< Mute state */
	AVSYS_AUDIO_UNMUTE_NOLOCK,			/** < Unmute without lock */
	AVSYS_AUDIO_MUTE_NOLOCK,			/** < Mute without lock */
};

/**
 * Enumerations for priority command
 */
enum avsys_audio_priority_cmd_t {
	AVSYS_AUDIO_SET_PRIORITY = 0,		/**< Command set priority */
	AVSYS_AUDIO_UNSET_PRIORITY,			/**< Command unset priority */
};

/**
 * Structure for sound device parameters.
 */
typedef struct {
	int		mode;						/**< Open mode (In/Out) */
	int		priority;					/**< Priority of sound handle */
	int		channels;					/**< Number of channels */
	int		samplerate;					/**< Sampling rate */
	int		format;						/**< Sampling format */
	int		handle_route;				/**< Handle route information. refer. avsys_audio_handle_route_t */
	int		vol_type;					/**< volume type */
	int		allow_mix;
} avsys_audio_param_t;


/**
 * Structure for volume information.
 */
typedef struct {
	int	level[AVSYS_AUDIO_CHANNEL_NUM];	/**< Array of volume level for each channel */
} avsys_audio_volume_t;

/* NEW PATH DEFINE */
 /**
  *
  */
enum avsys_audio_path_ex {
	AVSYS_AUDIO_PATH_EX_NONE = 0,
	AVSYS_AUDIO_PATH_EX_SPK,
	AVSYS_AUDIO_PATH_EX_RECV,
	AVSYS_AUDIO_PATH_EX_HEADSET,
	AVSYS_AUDIO_PATH_EX_BTHEADSET,
	AVSYS_AUDIO_PATH_EX_A2DP,
	AVSYS_AUDIO_PATH_EX_HANDSFREE,
	AVSYS_AUDIO_PATH_EX_HDMI,
	AVSYS_AUDIO_PATH_EX_DOCK,
	AVSYS_AUDIO_PATH_EX_USBAUDIO,
	AVSYS_AUDIO_PATH_EX_OUTMAX,
	AVSYS_AUDIO_PATH_EX_MIC = 1,
	AVSYS_AUDIO_PATH_EX_HEADSETMIC,
	AVSYS_AUDIO_PATH_EX_BTMIC,
	AVSYS_AUDIO_PATH_EX_FMINPUT,
	AVSYS_AUDIO_PATH_EX_HANDSFREEMIC,
	AVSYS_AUDIO_PATH_EX_INMAX,
};

enum avsys_audio_gain_ex {
	AVSYS_AUDIO_GAIN_EX_KEYTONE = 0,
	AVSYS_AUDIO_GAIN_EX_RINGTONE,
	AVSYS_AUDIO_GAIN_EX_ALARMTONE,
	AVSYS_AUDIO_GAIN_EX_CALLTONE,
	AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER,
	AVSYS_AUDIO_GAIN_EX_VIDEOPLAYER,
	AVSYS_AUDIO_GAIN_EX_VOICECALL,
	AVSYS_AUDIO_GAIN_EX_VIDEOCALL,
	AVSYS_AUDIO_GAIN_EX_FMRADIO,
	AVSYS_AUDIO_GAIN_EX_VOICEREC,
	AVSYS_AUDIO_GAIN_EX_CAMCORDER,
	AVSYS_AUDIO_GAIN_EX_CAMERA,
	AVSYS_AUDIO_GAIN_EX_GAME,
	AVSYS_AUDIO_GAIN_EX_MAX,
	AVSYS_AUDIO_GAIN_EX_PDA_PLAYBACK = AVSYS_AUDIO_GAIN_EX_KEYTONE,
};

typedef enum {
	AVSYS_AUDIO_EXT_DEVICE_FMRADIO = 0,
	AVSYS_AUDIO_EXT_DEVICE_NUM
}avsysaudio_ext_device_t;


typedef enum {
	AVSYS_AUDIO_ROUTE_POLICY_DEFAULT,
	AVSYS_AUDIO_ROUTE_POLICY_IGNORE_A2DP,
	AVSYS_AUDIO_ROUTE_POLICY_HANDSET_ONLY,
	AVSYS_AUDIO_ROUTE_POLICY_MAX,
}avsys_audio_route_policy_t; /* system global configuration */

enum avsys_audio_handle_route_t{
	AVSYS_AUDIO_HANDLE_ROUTE_FOLLOWING_POLICY,
	AVSYS_AUDIO_HANDLE_ROUTE_HANDSET_ONLY,
}; /* custom routing per handle */

typedef enum {
	AVSYS_AUDIO_ROUTE_DEVICE_UNKNOWN = -1,
	AVSYS_AUDIO_ROUTE_DEVICE_HANDSET,
	AVSYS_AUDIO_ROUTE_DEVICE_BLUETOOTH,
	AVSYS_AUDIO_ROUTE_DEVICE_EARPHONE,
	AVSYS_AUDIO_ROUTE_DEVICE_NUM,
}avsys_audio_playing_devcie_t;/* routing device */

/* path option */
#define AVSYS_AUDIO_PATH_OPTION_NONE			0x00000000	/*!< Sound path option none */
#define AVSYS_AUDIO_PATH_OPTION_DUAL_OUT		0x00000002	/*!< SPK or Recv with headset sound path. used for Ringtone or Alarm */
#define AVSYS_AUDIO_PATH_OPTION_VOICECALL_REC	0x00000010	/*!< Voice call recording path option */
#define AVSYS_AUDIO_PATH_OPTION_USE_SUBMIC		0x00000020	/*!< Use sub-mic when call or recording */
#define AVSYS_AUDIO_PATH_OPTION_USE_STEREOMIC	0x00000040	/*!< Use stereo mic when recording */
#define AVSYS_AUDIO_PATH_OPTION_FORCED			0x01000000	/*!< Forced sound path setting. only for booting animation */


/**
 * This function make instance for audio system, and retreives handle.
 *
 * @param	param		[in]	Parameters of audio system.
 * @param	phandle		[out]	Handle of audio system.
 * @param	size		[out]	Recomended buffer size.
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 *			on failure.
 * @remark
 * @see
 */
int avsys_audio_open(avsys_audio_param_t *param, avsys_handle_t *phandle, int *size);

/**
 * This function is to close sound handle and release allocated resources.
 *
 * @param	handle		[in]	Handle of audio system
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_close(avsys_handle_t handle);

/**
 * This function is to stop playback stream immediately. this drops all buffer remaining data.
 *
 * @param	handle		[in]	Playback handle of audio system
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_flush(avsys_handle_t handle);

/**
 * This function is to stop playback stream after all remaining buffer data played.
 *
 * @param	handle		[in]	Playback handle of audio system
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_drain(avsys_handle_t handle);

/**
 * This function is turn on speaker amp.
 *
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_ampon(void) __attribute__((deprecated));

/**
 * This function is turn off speaker amp.
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_ampoff(void) __attribute__((deprecated));

/**
 * This function is to read pcm data from sound handle.
 *
 * @param	handle		[in]	Handle of audio system
 * @param	buf			[in]	Buffer of audio data to read
 * @param	size		[in]	Size of buffer
 *
 * @return	This function returns number of bytes read, or negative value with
 *			error code on failure.
 * @remark
 * @see
 */
int avsys_audio_read(avsys_handle_t handle, void *buf, int size);

/**
 * This function is to write audio data to sound handle.
 *
 * @param	handle		[in]	Handle of audio system
 * @param	buf			[in]	Buffer of audio data to write
 * @param	size		[in]	Size of buffer
 *
 * @return	This function returns number of bytes written, or negative value
 *			with error code on failure.
 * @remark
 * @see
 */
int avsys_audio_write(avsys_handle_t handle, void *buf, int size);

int avsys_audio_set_volume_table(int gain_type, int dev_type, int step, int lv, int rv);
int avsys_audio_get_volume_table(int gain_type, int dev_type, int step, int *lv, int *rv);

int avsys_audio_set_volume_fadeup(avsys_handle_t handle);

/**
 * This function is to get volume max.
 *
 * @param	vol_type		[in]	Type of volume table
 * @param	max			[out]	number of volume steps
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_get_volume_max_ex(int volume_table, int *max_step);

/**
 * This function is to set relative mute of sound handle.
 *
 * @param	handle		[in]	Handle of audio system
 * @param	mute		[in]	Mute information to set
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 *  mute is AVSYS_AUDIO_MUTE : mute
 *  mute is AVSYS_AUDIO_UNMUTE : unmute
 * @see
 */
int avsys_audio_set_mute(avsys_handle_t handle, int mute);


/**
 * This function is to set mute of sound handle with fade out effect.
 *
 * @param	handle		[in]	Handle of audio system
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_set_mute_fadedown(avsys_handle_t handle);

/**
 * This function is to get relative mute of sound handle.
 *
 * @param	handle		[in]	Handle of audio system
 * @param	pmute		[out] Pointer to mute information to retrieve
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 *  pmute is AVSYS_AUDIO_MUTE : mute
 *  pmute is AVSYS_AUDIO_UNMUTE : unmute
 * @see	avsys_audio_mute_t
 */
int avsys_audio_get_mute(avsys_handle_t handle, int* pmute);


/**
 * This function is to set amp on external device
 *
 * @param	device		[in]	External audio device type
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 *  mute is AVSYS_AUDIO_MUTE : mute
 *  mute is AVSYS_AUDIO_UNMUTE : unmute
 * @see avsysaudio_ext_device_t
 */
int avsys_audio_ext_device_ampon(avsysaudio_ext_device_t device);

/**
 * This function is to set amp off external device
 *
 * @param	device		[in]	External audio device type
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 *  pmute is AVSYS_AUDIO_MUTE : mute
 *  pmute is AVSYS_AUDIO_UNMUTE : unmute
 * @see avsysaudio_ext_device_t
 */
int avsys_audio_ext_device_ampoff(avsysaudio_ext_device_t device);

/**
 * This function is to set status of external device
 *
 * @param	device		[in]	External audio device type
 * @param	onoff		[in]	1 for on , 0 for off
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see avsysaudio_ext_device_t
 */
int avsys_audio_set_ext_device_status(avsysaudio_ext_device_t device_type, int onoff);

/**
 * This function is to get status of external device
 *
 * @param	device		[in]	External audio device type
 * @param	onoff		[out]	1 for on , 0 for off
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see avsys_audio_set_ext_device_status
 */
int avsys_audio_get_ext_device_status(avsysaudio_ext_device_t device_type, int *onoff);
/**
 * This function is to set sound path of sound device.
 *
 * @param	path		[in]	value of sound gain
 * @param	output		[in]	value of output device
 * @param	input		[in]	value of input device
 * @param	option		[in]	value of sound path option
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 *			AVSYS_STATE_ERR_RANGE_OVER : input path value is invalid range
 *			AVSYS_STATE_ERR_INTERNAL   : internal device error
 * @remark
 * @see
 */
int avsys_audio_set_path_ex(int gain, int out, int in, int option);

/**
 * This function is to get sound path of sound device.
 *
 * @param	path		[out]	value of sound gain
 * @param	output		[out]	value of output device
 * @param	input		[out]	value of input device
 * @param	option		[out]	value of sound path option
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 *			AVSYS_STATE_ERR_INTERNAL   : internal device error
 * @remark
 * @see
 */
int avsys_audio_get_path_ex(int *gain, int *out, int *in, int *option);

/**
 * This function is to set relative global mute of sound device.
 *
 * @param	mute		[in]	Global mute information to retreive
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 *  mute is avsys_audio_mute_disable : unmute
 *  mute is avsys_audio_mute_enable  : mute
 *  others     : ignore
 * @see avsys_audio_mute_t
 */
int avsys_audio_set_global_mute(int mute);

/**
 * This function is to get relative global mute of sound device.
 *
 * @param	pmute		[out]	Pointer to global mute information to retreive
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * *pbmute is avsys_audio_mute_disable or avsys_audio_mute_enable
 * @see
 */
int avsys_audio_get_global_mute(int* pmute);

/**
 * This function is to get number of remaining audio frames in hw buffer.
 *
 * @param	handle		[in]	handle to get delay frames
 * @param	frame_delay	[out]	value of number of remaining audio frames
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_delay(avsys_handle_t handle, int *frame_delay);

/**
 * This function is to reset audio stream. (drops all remaining audio frames in  device buffer)
 *
 * @param	handle		[in]	handle to reset
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_reset(avsys_handle_t handle);

/**
 * This function is to get period time and buffer time of audio stream.
 *
 * @param	handle		[in]	handle to get period & buffer time
 * @param	period_time	[out]	value of period time in microsecond.
 * @param	buffer_time	[out]	value of buffer time in microsecond.
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_get_period_buffer_time(avsys_handle_t handle, unsigned int *period_time, unsigned int *buffer_time);

/**
 * This function is to cork stream.
 *
 * @param	handle		[in]	handle to cork
 * @param	cork		[in]	cork=1, uncork=0
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_cork (avsys_handle_t handle, int cork);

/**
 * This function is to check whether stream is corked or not.
 *
 * @param	handle		[in]	handle to cork
 * @param	is_corked	[out]	corked is 1, otherwise 0
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_is_corked (avsys_handle_t handle, int *is_corked);

/**
 * This function is to get audio capturing status of system.
 *
 * @param	on_capture	[out]	capture status.
 * 								zero if there is no capture instance.
 * 								positive value if there is capture instance
 *
 * @return	This function returns AVSYS_STATE_SUCCESS on success, or negative
 *			value with error code.
 * @remark
 * @see
 */
int avsys_audio_get_capture_status(int *on_capture);

int avsys_audio_earjack_manager_init(int *earjack_type, int *waitfd);
int avsys_audio_earjack_manager_wait(int waitfd, int *current_earjack_type, int *new_earjack_type, int *need_mute);
int avsys_audio_earjack_manager_process(int new_earjack_type);
int avsys_audio_earjack_manager_deinit(int waitfd);
int avsys_audio_earjack_manager_get_type(void);
int avsys_audio_earjack_manager_unlock(void);

int avsys_audio_set_route_policy(avsys_audio_route_policy_t route);
int avsys_audio_get_route_policy(avsys_audio_route_policy_t *route);
int avsys_audio_get_current_playing_volume_type(int *volume_type);
int avsys_audio_set_volume_by_type(const int volume_type, const int volume_value);
int avsys_audio_set_primary_volume(const int pid, const int type);
int avsys_audio_clear_primary_volume(const int pid);
int avsys_audio_hibernation_reset(int *vol);
/**
	@}
 */

#ifdef __cplusplus
	}
#endif

#endif /* __AVSYS_AUDIO_H__ */