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_AUDIO_CODEC_H_ 7 #define COMMON_CRAS_AUDIO_CODEC_H_ 8 9 /* A audio codec that transforms audio between different formats. 10 * decode - Function to decode audio samples. Returns the number of decoded 11 * bytes of input buffer, number of decoded bytes of output buffer 12 * will be filled in count. 13 * encode - Function to encode audio samples. Returns the number of encoded 14 * bytes of input buffer, number of encoded bytes of output buffer 15 * will be filled in count. 16 * priv_data - Private data for specific use. 17 */ 18 struct cras_audio_codec { 19 int (*decode)(struct cras_audio_codec *codec, const void *input, 20 size_t input_len, void *output, size_t output_len, 21 size_t *count); 22 int (*encode)(struct cras_audio_codec *codec, const void *input, 23 size_t intput_len, void *output, size_t output_len, 24 size_t *count); 25 void *priv_data; 26 }; 27 28 #endif /* COMMON_CRAS_AUDIO_CODEC_H_ */ 29