• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef COMMON_CRAS_SBC_CODEC_H_
7 #define COMMON_CRAS_SBC_CODEC_H_
8 
9 #include <sbc/sbc.h>
10 
11 #include "cras_audio_codec.h"
12 
13 /* Creates an sbc codec.
14  * Args:
15  *    freq: frequency for sbc encoder settings.
16  *    mode: mode for sbc encoder settings.
17  *    subbands: subbands for sbc encoder settings.
18  *    alloc: allocation method for sbc encoder settings.
19  *    blocks: blocks for sbc encoder settings.
20  *    bitpool: bitpool for sbc encoder settings.
21  */
22 struct cras_audio_codec *cras_sbc_codec_create(uint8_t freq, uint8_t mode,
23 					       uint8_t subbands, uint8_t alloc,
24 					       uint8_t blocks, uint8_t bitpool);
25 
26 /* Creates an mSBC codec, which is a version of SBC codec used for
27  * wideband speech mode of HFP. */
28 struct cras_audio_codec *cras_msbc_codec_create();
29 
30 /* Destroys an sbc codec.
31  * Args:
32  *    codec: the codec to destroy.
33  */
34 void cras_sbc_codec_destroy(struct cras_audio_codec *codec);
35 
36 /* Gets codesize, the input block size of sbc codec in bytes.
37  */
38 int cras_sbc_get_codesize(struct cras_audio_codec *codec);
39 
40 /* Gets frame_length, the output block size of sbc codec in bytes.
41  */
42 int cras_sbc_get_frame_length(struct cras_audio_codec *codec);
43 
44 #endif /* COMMON_CRAS_SBC_CODEC_H_ */
45