summaryrefslogtreecommitdiff
path: root/cras/src/common/cras_audio_codec.h
blob: 01277ea0bab3e1ffe0828fac967513fb5612740f (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
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef COMMON_CRAS_AUDIO_CODEC_H_
#define COMMON_CRAS_AUDIO_CODEC_H_

/* A audio codec that transforms audio between different formats.
 * decode - Function to decode audio samples. Returns the number of decoded
 *   bytes of input buffer, number of decoded bytes of output buffer
 *   will be filled in count.
 * encode - Function to encode audio samples. Returns the number of encoded
 *   bytes of input buffer, number of encoded bytes of output buffer
 *   will be filled in count.
 * priv_data - Private data for specific use.
 */
struct cras_audio_codec {
	int (*decode)(struct cras_audio_codec *codec, const void *input,
		      size_t input_len, void *output, size_t output_len,
		      size_t *count);
	int (*encode)(struct cras_audio_codec *codec, const void *input,
		      size_t intput_len, void *output, size_t output_len,
		      size_t *count);
	void *priv_data;
};

#endif /* COMMON_CRAS_AUDIO_CODEC_H_ */