* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef A2DP_PARCEL_CODEC_H
#define A2DP_PARCEL_CODEC_H
#include <string>
#include <vector>
namespace OHOS {
namespace bluetooth {
* @brief A2dp codec type enum.
*
* @since 6.0
*/
enum A2dpIpcCodecType : uint8_t {
A2DP_CODEC_TYPE_SBC_IPC = 0,
A2DP_CODEC_TYPE_MPEG1_IPC = 0x01,
A2DP_CODEC_TYPE_AAC_IPC = 0x01 << 1,
A2DP_CODEC_TYPE_ATRAC_IPC = 0x01 << 2,
A2DP_CODEC_TYPE_NONA2DP_IPC = 0xFF
};
* @brief A2dp codec priority enum.
*
* @since 6.0
*/
enum A2dpIpcCodecPriority : uint8_t {
A2DP_CODEC_PRIORITY_DISABLED_IPC = 0,
A2DP_CODEC_PRIORITY_DEFAULT_IPC,
A2DP_CODEC_PRIORITY_HIGHEST_IPC = 255,
};
* @brief A2dp codec sample rate enum.
*
* @since 6.0
*/
enum A2dpIpcCodecSampleRate : uint32_t {
A2DP_SAMPLE_RATE_NONE_IPC = 0x0,
A2DP_SBC_SAMPLE_RATE_48000_IPC = 0x1 << 4,
A2DP_SBC_SAMPLE_RATE_44100_IPC = 0x1 << 5,
A2DP_SBC_SAMPLE_RATE_32000_IPC = 0x1 << 6,
A2DP_SBC_SAMPLE_RATE_16000_IPC = 0x1 << 7,
A2DP_SBC_SAMPLE_RATE_MSK_IPC = 0xF0,
A2DP_AAC_SAMPLE_RATE_OCTET1_44100_IPC = 0x01,
A2DP_AAC_SAMPLE_RATE_OCTET1_32000_IPC = 0x01 << 1,
A2DP_AAC_SAMPLE_RATE_OCTET1_24000_IPC = 0x01 << 2,
A2DP_AAC_SAMPLE_RATE_OCTET1_22050_IPC = 0x01 << 3,
A2DP_AAC_SAMPLE_RATE_OCTET1_16000_IPC = 0x01 << 4,
A2DP_AAC_SAMPLE_RATE_OCTET1_12000_IPC = 0x01 << 5,
A2DP_AAC_SAMPLE_RATE_OCTET1_11025_IPC = 0x01 << 6,
A2DP_AAC_SAMPLE_RATE_OCTET1_8000_IPC = 0x01 << 7,
A2DP_AAC_SAMPLE_RATE_OCTET1_MSK_IPC = 0xFF,
A2DP_AAC_SAMPLE_RATE_OCTET2_96000_IPC = 0x01 << 4,
A2DP_AAC_SAMPLE_RATE_OCTET2_88200_IPC = 0x01 << 5,
A2DP_AAC_SAMPLE_RATE_OCTET2_64000_IPC = 0x01 << 6,
A2DP_AAC_SAMPLE_RATE_OCTET2_48000_IPC = 0x01 << 7,
A2DP_AAC_SAMPLE_RATE_OCTET2_MSK_IPC = 0xF0,
};
* @brief A2dp codec channel mode enum.
*
* @since 6.0
*/
enum A2dpIpcCodecChannelMode : uint8_t {
A2DP_CHANNEL_MODE_NONE_IPC = 0x0,
A2DP_SBC_CHANNEL_MODE_JOINT_STEREO_IPC = 0x1,
A2DP_SBC_CHANNEL_MODE_STEREO_IPC = 0x1 << 1,
A2DP_SBC_CHANNEL_MODE_DUAL_IPC = 0x1 << 2,
A2DP_SBC_CHANNEL_MODE_MONO_IPC = 0x1 << 3,
A2DP_SBC_CHANNEL_MODE_MSK_IPC = 0x0F,
A2DP_AAC_CHANNEL_MODE_OCTET2_DOUBLE_IPC = 0x01 << 2,
A2DP_AAC_CHANNEL_MODE_OCTET2_SINGLE_IPC = 0x01 << 3,
A2DP_AAC_CHANNEL_MODE_OCTET2_MSK_IPC = 0x0C,
};
* @brief A2dp codec bits per sample enum.
*
* @since 6.0
*/
enum A2dpIpcCodecBitsPerSample : uint8_t {
A2DP_SAMPLE_BITS_NONE_IPC = 0x0,
A2DP_SAMPLE_BITS_16_IPC = 0x1 << 0,
A2DP_SAMPLE_BITS_24_IPC = 0x1 << 1,
A2DP_SAMPLE_BITS_32_IPC = 0x1 << 2,
A2DP_SAMPLE_BITS_MSK_IPC = 0x06,
};
* @brief A2dp codec configuration information of a2dp source
*
* @since 6.0
*/
struct CodecInfo {
uint8_t codecPriority;
uint8_t codecType;
uint32_t sampleRate;
uint8_t bitsPerSample;
uint8_t channelMode;
uint64_t codecSpecific1;
uint64_t codecSpecific2;
uint64_t codecSpecific3;
uint64_t codecSpecific4;
};
* @brief The codec configuration and capability information of a2dp source
*
* @since 6.0
*/
struct CodecStatus {
CodecInfo codecInfo;
std::vector<CodecInfo> codecInfoLocalCap;
std::vector<CodecInfo> codecInfoConfirmCap;
};
struct OffloadCodecInfo {
uint16_t mediaPacketHeader;
uint8_t mPt;
uint32_t ssrc;
uint8_t boundaryFlag;
uint8_t broadcastFlag;
uint32_t codecType;
uint16_t maxLatency;
uint16_t scmsTEnable;
uint32_t sampleRate;
uint32_t encodedAudioBitrate;
uint8_t bitsPerSample;
uint8_t chMode;
uint16_t aclHdl;
uint16_t l2cRcid;
uint16_t mtu;
uint8_t codecSpecific0;
uint8_t codecSpecific1;
uint8_t codecSpecific2;
uint8_t codecSpecific3;
uint8_t codecSpecific4;
uint8_t codecSpecific5;
uint8_t codecSpecific6;
uint8_t codecSpecific7;
};
struct OffloadCodecStatus {
OffloadCodecInfo offloadInfo;
};
* @brief The details of a2dp audio stream info.
*
* @since 6.0
*/
struct BluetoothA2dpStreamInfo {
int32_t sessionId;
int32_t streamType;
int32_t sampleRate;
int32_t isSpatialAudio;
};
}
}
#endif