1 /* 2 * Copyright (C) 2018 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 18 #pragma once 19 20 #include <system/audio.h> 21 #include <system/audio_policy.h> 22 #include <binder/Parcelable.h> 23 24 namespace android { 25 26 enum product_strategy_t : uint32_t; 27 const product_strategy_t PRODUCT_STRATEGY_NONE = static_cast<product_strategy_t>(-1); 28 29 using AttributesVector = std::vector<audio_attributes_t>; 30 using StreamTypeVector = std::vector<audio_stream_type_t>; 31 32 using TrackSecondaryOutputsMap = std::map<audio_port_handle_t, std::vector<audio_io_handle_t>>; 33 34 constexpr bool operator==(const audio_attributes_t &lhs, const audio_attributes_t &rhs) 35 { 36 return lhs.usage == rhs.usage && lhs.content_type == rhs.content_type && 37 lhs.flags == rhs.flags && (std::strcmp(lhs.tags, rhs.tags) == 0); 38 } 39 constexpr bool operator!=(const audio_attributes_t &lhs, const audio_attributes_t &rhs) 40 { 41 return !(lhs==rhs); 42 } 43 44 constexpr bool operator==(const audio_offload_info_t &lhs, const audio_offload_info_t &rhs) 45 { 46 return lhs.version == rhs.version && lhs.size == rhs.size && 47 lhs.sample_rate == rhs.sample_rate && lhs.channel_mask == rhs.channel_mask && 48 lhs.format == rhs.format && lhs.stream_type == rhs.stream_type && 49 lhs.bit_rate == rhs.bit_rate && lhs.duration_us == rhs.duration_us && 50 lhs.has_video == rhs.has_video && lhs.is_streaming == rhs.is_streaming && 51 lhs.bit_width == rhs.bit_width && lhs.offload_buffer_size == rhs.offload_buffer_size && 52 lhs.usage == rhs.usage && lhs.encapsulation_mode == rhs.encapsulation_mode && 53 lhs.content_id == rhs.content_id && lhs.sync_id == rhs.sync_id; 54 } 55 constexpr bool operator!=(const audio_offload_info_t &lhs, const audio_offload_info_t &rhs) 56 { 57 return !(lhs==rhs); 58 } 59 60 constexpr bool operator==(const audio_config_t &lhs, const audio_config_t &rhs) 61 { 62 return lhs.sample_rate == rhs.sample_rate && lhs.channel_mask == rhs.channel_mask && 63 lhs.format == rhs.format && lhs.offload_info == rhs.offload_info; 64 } 65 constexpr bool operator!=(const audio_config_t &lhs, const audio_config_t &rhs) 66 { 67 return !(lhs==rhs); 68 } 69 70 constexpr bool operator==(const audio_config_base_t &lhs, const audio_config_base_t &rhs) 71 { 72 return lhs.sample_rate == rhs.sample_rate && lhs.channel_mask == rhs.channel_mask && 73 lhs.format == rhs.format; 74 } 75 constexpr bool operator!=(const audio_config_base_t &lhs, const audio_config_base_t &rhs) 76 { 77 return !(lhs==rhs); 78 } 79 80 enum volume_group_t : uint32_t; 81 static const volume_group_t VOLUME_GROUP_NONE = static_cast<volume_group_t>(-1); 82 83 } // namespace android 84 85