2 * Copyright (C) 2014 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef ANDROID_AUDIO_CHANNELS_H
18 #define ANDROID_AUDIO_CHANNELS_H
25 * Expands or contracts sample data from one interleaved channel format to another.
26 * Expanded channels are filled with zeros and put at the end of each audio frame.
27 * Contracted channels are omitted from the end of each audio frame.
29 * \param in_buff points to the buffer of samples
30 * \param in_buff_chans Specifies the number of channels in the input buffer.
31 * \param out_buff points to the buffer to receive converted samples.
32 * \param out_buff_chans Specifies the number of channels in the output buffer.
33 * \param sample_size_in_bytes Specifies the number of bytes per sample. 1, 2, 3, 4 are
35 * \param num_in_bytes size of input buffer in BYTES
38 * the number of BYTES of output data or 0 if an error occurs.
41 * The out and sums buffers must either be completely separate (non-overlapping), or
42 * they must both start at the same address. Partially overlapping buffers are not supported.
44 size_t adjust_channels(const void* in_buff, size_t in_buff_chans,
45 void* out_buff, size_t out_buff_chans,
46 unsigned sample_size_in_bytes, size_t num_in_bytes);
49 * Expands or contracts sample data from one interleaved channel format to another.
50 * Extra expanded channels are left alone in the output buffer.
51 * Contracted channels are omitted from the end of each audio frame.
53 * \param in_buff points to the buffer of samples
54 * \param in_buff_chans Specifies the number of channels in the input buffer.
55 * \param out_buff points to the buffer to receive converted samples.
56 * \param out_buff_chans Specifies the number of channels in the output buffer.
57 * \param sample_size_in_bytes Specifies the number of bytes per sample. 1, 2, 3, 4 are
59 * \param num_in_bytes size of input buffer in BYTES
62 * the number of BYTES of output data or 0 if an error occurs.
65 * The out and in buffers must either be completely separate (non-overlapping), or
66 * they must both start at the same address. Partially overlapping buffers are not supported.
68 size_t adjust_selected_channels(const void* in_buff, size_t in_buff_chans,
69 void* out_buff, size_t out_buff_chans,
70 unsigned sample_size_in_bytes, size_t num_in_bytes);