1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 #ifndef ANDROID_AUDIO_CHANNELS_H 18 #define ANDROID_AUDIO_CHANNELS_H 19 20 /** \cond */ 21 __BEGIN_DECLS 22 /** \endcond */ 23 24 /** 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. 28 * 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 34 * currently valid. 35 * \param num_in_bytes size of input buffer in BYTES 36 * 37 * \return 38 * the number of BYTES of output data or 0 if an error occurs. 39 * 40 * \note 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. 43 */ 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); 47 48 /** \cond */ 49 __END_DECLS 50 /** \endcond */ 51 52 #endif 53