1/* 2 * Copyright 2023 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 17syntax = "proto3"; 18 19package mmc; 20 21option optimize_for = LITE_RUNTIME; 22 23// union of Lc3 config and codec parameters 24message Lc3Param { 25 // encoder/decoder config 26 int32 dt_us = 1; 27 int32 sr_hz = 2; 28 int32 sr_pcm_hz = 3; 29 30 // encode/decode parameter 31 enum PcmFmt { 32 kLc3PcmFormatS16 = 0; 33 kLc3PcmFormatS24 = 1; 34 } 35 36 PcmFmt fmt = 4; 37 int32 stride = 5; 38} 39 40// corresponding to SBC_ENC_PARAMS 41message SbcEncoderParam { 42 enum SamplingFreq { 43 kSbcSf16000 = 0; 44 kSbcSf32000 = 1; 45 kSbcSf44100 = 2; 46 kSbcSf48000 = 3; 47 } 48 49 enum ChannelMode { 50 kSbcMono = 0; 51 kSbcDual = 1; 52 kSbcStereo = 2; 53 kSbcJointStereo = 3; 54 } 55 56 enum AllocationMethod { 57 kSbcLoudNess = 0; 58 kSbcSnr = 1; 59 } 60 61 // Default to be kSbcFormatGeneral for SBC if not assigned. 62 // Assigning to kSbcFormatMsbc for MSBC. 63 enum Format { 64 kSbcFormatGeneral = 0; 65 kSbcFormatMsbc = 1; 66 } 67 68 // encoder config 69 int32 num_of_subbands = 1; 70 int32 num_of_channels = 2; 71 int32 num_of_blocks = 3; 72 int32 bit_pool = 4; 73 int32 bit_rate = 5; 74 SamplingFreq sampling_freq = 6; 75 ChannelMode channel_mode = 7; 76 AllocationMethod allocation_method = 8; 77 Format format = 9; 78} 79 80message SbcDecoderParam { 81 // decoder config 82 int32 max_channels = 1; 83 int32 stride = 2; 84 bool enhanced = 3; 85} 86 87message AacEncoderParam { 88 // encoder config 89 int32 sample_rate = 1; 90 int32 channel_count = 2; 91 int32 bit_rate = 3; 92 93 // encode parameter 94 int32 bit_depth = 4; 95 int32 effective_frame_size = 5; 96} 97 98// union of different codec parameters 99message ConfigParam { 100 // This determines the codec type and whether it is an encoder or a decoder. 101 oneof codec_param { 102 // HFP LC3 encoder and decoder have same parameter type. 103 Lc3Param hfp_lc3_encoder_param = 1; 104 Lc3Param hfp_lc3_decoder_param = 2; 105 // HFP MSBC use SBC parameters 106 SbcEncoderParam hfp_msbc_encoder_param = 3; 107 SbcDecoderParam hfp_msbc_decoder_param = 4; 108 AacEncoderParam a2dp_aac_encoder_param = 5; 109 } 110} 111