Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5e5c339 authored by Jeremy Wu's avatar Jeremy Wu Committed by Gerrit Code Review
Browse files

Merge "Floss: stub non-standard codecs" into main

parents 6e02d0d8 33314888
Loading
Loading
Loading
Loading
+7 −9
Original line number Original line Diff line number Diff line
@@ -30,16 +30,14 @@ source_set("nonstandard_codecs") {
  if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) {
  if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) {
    sources = [
    sources = [
      "a2dp/a2dp_aac.cc",
      "a2dp/a2dp_aac.cc",
      "a2dp/a2dp_aac_decoder.cc",
      "a2dp/a2dp_aac_decoder_linux.cc",
      "a2dp/a2dp_aac_encoder.cc",
      "a2dp/a2dp_aac_encoder_linux.cc",
      "a2dp/a2dp_vendor.cc",
      "a2dp/a2dp_vendor.cc",
      "a2dp/a2dp_vendor_aptx.cc",
      # Following are unimplemented
      "a2dp/a2dp_vendor_aptx_encoder.cc",
      "a2dp/a2dp_vendor_aptx_linux.cc",
      "a2dp/a2dp_vendor_aptx_hd.cc",
      "a2dp/a2dp_vendor_aptx_hd_linux.cc",
      "a2dp/a2dp_vendor_aptx_hd_encoder.cc",
      "a2dp/a2dp_vendor_ldac_linux.cc",
      "a2dp/a2dp_vendor_ldac.cc",
      "a2dp/a2dp_vendor_opus_linux.cc",
      "a2dp/a2dp_vendor_ldac_decoder.cc",
      "a2dp/a2dp_vendor_ldac_encoder.cc",
    ]
    ]


    include_dirs = [
    include_dirs = [
+137 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * 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.
 */

// Stubbed non-standard codec

#include "a2dp_vendor.h"
#include "a2dp_vendor_aptx_hd.h"

bool A2DP_IsVendorSourceCodecValidAptxHd(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorPeerSinkCodecValidAptxHd(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_VendorUsesRtpHeaderAptxHd(bool content_protection_enabled,
                                    const uint8_t* p_codec_info) {
  return false;
}

const char* A2DP_VendorCodecNameAptxHd(const uint8_t* p_codec_info) {
  return "AptxHd";
}

bool A2DP_VendorCodecTypeEqualsAptxHd(const uint8_t* p_codec_info_a,
                                      const uint8_t* p_codec_info_b) {
  return false;
}

bool A2DP_VendorCodecEqualsAptxHd(const uint8_t* p_codec_info_a,
                                  const uint8_t* p_codec_info_b) {
  return false;
}

int A2DP_VendorGetBitRateAptxHd(const uint8_t* p_codec_info) { return -1; }

int A2DP_VendorGetTrackSampleRateAptxHd(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackBitsPerSampleAptxHd(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackChannelCountAptxHd(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetSinkTrackChannelTypeAptxHd(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetChannelModeCodeAptxHd(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetFrameSizeAptxHd(const uint8_t* p_codec_info) { return -1; }

bool A2DP_VendorGetPacketTimestampAptxHd(const uint8_t* p_codec_info,
                                         const uint8_t* p_data,
                                         uint32_t* p_timestamp) {
  return false;
}

bool A2DP_VendorBuildCodecHeaderAptxHd(const uint8_t* p_codec_info,
                                       BT_HDR* p_buf,
                                       uint16_t frames_per_packet) {
  return false;
}

std::string A2DP_VendorCodecInfoStringAptxHd(const uint8_t* p_codec_info) {
  return "Unsupported codec: AptxHd";
}

const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceAptxHd(
    const uint8_t* p_codec_info) {
  return nullptr;
}

const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceAptxHd(
    const uint8_t* p_codec_info) {
  return nullptr;
}

bool A2DP_VendorAdjustCodecAptxHd(uint8_t* p_codec_info) { return false; }

btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexAptxHd(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexAptxHd(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

const char* A2DP_VendorCodecIndexStrAptxHd(void) { return "AptxHd"; }

bool A2DP_VendorInitCodecConfigAptxHd(AvdtpSepConfig* p_cfg) { return false; }

A2dpCodecConfigAptxHd::A2dpCodecConfigAptxHd(
    btav_a2dp_codec_priority_t codec_priority)
    : A2dpCodecConfig(BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD,
                      A2DP_VendorCodecIndexStrAptxHd(), codec_priority) {}

A2dpCodecConfigAptxHd::~A2dpCodecConfigAptxHd() {}

bool A2dpCodecConfigAptxHd::init() { return false; }

bool A2dpCodecConfigAptxHd::useRtpHeaderMarkerBit() const { return false; }

void A2dpCodecConfigAptxHd::debug_codec_dump(int fd) {}

bool A2dpCodecConfigAptxHd::setCodecConfig(const uint8_t* p_peer_codec_info,
                                           bool is_capability,
                                           uint8_t* p_result_codec_config) {
  return false;
}

bool A2dpCodecConfigAptxHd::setPeerCodecCapabilities(
    const uint8_t* p_peer_codec_capabilities) {
  return false;
}
+136 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * 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.
 */

// Stubbed non-standard codec

#include "a2dp_vendor.h"
#include "a2dp_vendor_aptx.h"

bool A2DP_IsVendorSourceCodecValidAptx(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorPeerSinkCodecValidAptx(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_VendorUsesRtpHeaderAptx(bool content_protection_enabled,
                                  const uint8_t* p_codec_info) {
  return false;
}

const char* A2DP_VendorCodecNameAptx(const uint8_t* p_codec_info) {
  return "Aptx";
}

bool A2DP_VendorCodecTypeEqualsAptx(const uint8_t* p_codec_info_a,
                                    const uint8_t* p_codec_info_b) {
  return false;
}

bool A2DP_VendorCodecEqualsAptx(const uint8_t* p_codec_info_a,
                                const uint8_t* p_codec_info_b) {
  return false;
}

int A2DP_VendorGetBitRateAptx(const uint8_t* p_codec_info) { return -1; }

int A2DP_VendorGetTrackSampleRateAptx(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackBitsPerSampleAptx(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackChannelCountAptx(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetSinkTrackChannelTypeAptx(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetChannelModeCodeAptx(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetFrameSizeAptx(const uint8_t* p_codec_info) { return -1; }

bool A2DP_VendorGetPacketTimestampAptx(const uint8_t* p_codec_info,
                                       const uint8_t* p_data,
                                       uint32_t* p_timestamp) {
  return false;
}

bool A2DP_VendorBuildCodecHeaderAptx(const uint8_t* p_codec_info, BT_HDR* p_buf,
                                     uint16_t frames_per_packet) {
  return false;
}

std::string A2DP_VendorCodecInfoStringAptx(const uint8_t* p_codec_info) {
  return "Unsupported codec: Aptx";
}

const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceAptx(
    const uint8_t* p_codec_info) {
  return nullptr;
}

const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceAptx(
    const uint8_t* p_codec_info) {
  return nullptr;
}

bool A2DP_VendorAdjustCodecAptx(uint8_t* p_codec_info) { return false; }

btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexAptx(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexAptx(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

const char* A2DP_VendorCodecIndexStrAptx(void) { return "Aptx"; }

bool A2DP_VendorInitCodecConfigAptx(AvdtpSepConfig* p_cfg) { return false; }

A2dpCodecConfigAptx::A2dpCodecConfigAptx(
    btav_a2dp_codec_priority_t codec_priority)
    : A2dpCodecConfig(BTAV_A2DP_CODEC_INDEX_SOURCE_APTX,
                      A2DP_VendorCodecIndexStrAptx(), codec_priority) {}

A2dpCodecConfigAptx::~A2dpCodecConfigAptx() {}

bool A2dpCodecConfigAptx::init() { return false; }

bool A2dpCodecConfigAptx::useRtpHeaderMarkerBit() const { return false; }

void A2dpCodecConfigAptx::debug_codec_dump(int fd) {}

bool A2dpCodecConfigAptx::setCodecConfig(const uint8_t* p_peer_codec_info,
                                         bool is_capability,
                                         uint8_t* p_result_codec_config) {
  return false;
}

bool A2dpCodecConfigAptx::setPeerCodecCapabilities(
    const uint8_t* p_peer_codec_capabilities) {
  return false;
}
+168 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * 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.
 */

// Stubbed non-standard codec.

#include "a2dp_vendor.h"
#include "a2dp_vendor_ldac.h"

bool A2DP_IsVendorSourceCodecValidLdac(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorSinkCodecValidLdac(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorPeerSourceCodecValidLdac(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorPeerSinkCodecValidLdac(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorSinkCodecSupportedLdac(const uint8_t* p_codec_info) {
  return false;
}
bool A2DP_IsPeerSourceCodecSupportedLdac(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_VendorUsesRtpHeaderLdac(bool content_protection_enabled,
                                  const uint8_t* p_codec_info) {
  return false;
}

const char* A2DP_VendorCodecNameLdac(const uint8_t* p_codec_info) {
  return "Ldac";
}

bool A2DP_VendorCodecTypeEqualsLdac(const uint8_t* p_codec_info_a,
                                    const uint8_t* p_codec_info_b) {
  return false;
}

bool A2DP_VendorCodecEqualsLdac(const uint8_t* p_codec_info_a,
                                const uint8_t* p_codec_info_b) {
  return false;
}

int A2DP_VendorGetBitRateLdac(const uint8_t* p_codec_info) { return -1; }

int A2DP_VendorGetTrackSampleRateLdac(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackBitsPerSampleLdac(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackChannelCountLdac(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetSinkTrackChannelTypeLdac(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetChannelModeCodeLdac(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetFrameSizeLdac(const uint8_t* p_codec_info) { return -1; }

bool A2DP_VendorGetPacketTimestampLdac(const uint8_t* p_codec_info,
                                       const uint8_t* p_data,
                                       uint32_t* p_timestamp) {
  return false;
}

bool A2DP_VendorBuildCodecHeaderLdac(const uint8_t* p_codec_info, BT_HDR* p_buf,
                                     uint16_t frames_per_packet) {
  return false;
}

std::string A2DP_VendorCodecInfoStringLdac(const uint8_t* p_codec_info) {
  return "Unsupported codec: Ldac";
}

const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceLdac(
    const uint8_t* p_codec_info) {
  return nullptr;
}

const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceLdac(
    const uint8_t* p_codec_info) {
  return nullptr;
}

bool A2DP_VendorAdjustCodecLdac(uint8_t* p_codec_info) { return false; }

btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexLdac(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexLdac(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

const char* A2DP_VendorCodecIndexStrLdac(void) { return "Ldac"; }

const char* A2DP_VendorCodecIndexStrLdacSink(void) { return "Ldac SINK"; }

bool A2DP_VendorInitCodecConfigLdac(AvdtpSepConfig* p_cfg) { return false; }

bool A2DP_VendorInitCodecConfigLdacSink(AvdtpSepConfig* p_cfg) { return false; }

A2dpCodecConfigLdacSource::A2dpCodecConfigLdacSource(
    btav_a2dp_codec_priority_t codec_priority)
    : A2dpCodecConfigLdacBase(BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC,
                              A2DP_VendorCodecIndexStrLdac(), codec_priority,
                              true) {}

A2dpCodecConfigLdacSource::~A2dpCodecConfigLdacSource() {}

bool A2dpCodecConfigLdacSource::init() { return false; }

bool A2dpCodecConfigLdacSource::useRtpHeaderMarkerBit() const { return false; }

void A2dpCodecConfigLdacSource::debug_codec_dump(int fd) {}

bool A2dpCodecConfigLdacBase::setCodecConfig(const uint8_t* p_peer_codec_info,
                                             bool is_capability,
                                             uint8_t* p_result_codec_config) {
  return false;
}

bool A2dpCodecConfigLdacBase::setPeerCodecCapabilities(
    const uint8_t* p_peer_codec_capabilities) {
  return false;
}

A2dpCodecConfigLdacSink::A2dpCodecConfigLdacSink(
    btav_a2dp_codec_priority_t codec_priority)
    : A2dpCodecConfigLdacBase(BTAV_A2DP_CODEC_INDEX_SINK_LDAC,
                              A2DP_VendorCodecIndexStrLdacSink(),
                              codec_priority, false) {}

A2dpCodecConfigLdacSink::~A2dpCodecConfigLdacSink() {}

bool A2dpCodecConfigLdacSink::init() { return false; }

bool A2dpCodecConfigLdacSink::useRtpHeaderMarkerBit() const { return false; }
+174 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * 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.
 */

// Stubbed non-standard codec.

#include "a2dp_vendor.h"
#include "a2dp_vendor_opus.h"

bool A2DP_IsVendorSourceCodecValidOpus(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorSinkCodecValidOpus(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorPeerSourceCodecValidOpus(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorPeerSinkCodecValidOpus(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_IsVendorSinkCodecSupportedOpus(const uint8_t* p_codec_info) {
  return false;
}
bool A2DP_IsPeerSourceCodecSupportedOpus(const uint8_t* p_codec_info) {
  return false;
}

bool A2DP_VendorUsesRtpHeaderOpus(bool content_protection_enabled,
                                  const uint8_t* p_codec_info) {
  return false;
}

const char* A2DP_VendorCodecNameOpus(const uint8_t* p_codec_info) {
  return "Opus";
}

bool A2DP_VendorCodecTypeEqualsOpus(const uint8_t* p_codec_info_a,
                                    const uint8_t* p_codec_info_b) {
  return false;
}

bool A2DP_VendorCodecEqualsOpus(const uint8_t* p_codec_info_a,
                                const uint8_t* p_codec_info_b) {
  return false;
}

int A2DP_VendorGetBitRateOpus(const uint8_t* p_codec_info) { return -1; }

int A2DP_VendorGetTrackSampleRateOpus(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackBitsPerSampleOpus(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetTrackChannelCountOpus(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetSinkTrackChannelTypeOpus(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetChannelModeCodeOpus(const uint8_t* p_codec_info) {
  return -1;
}

int A2DP_VendorGetFrameSizeOpus(const uint8_t* p_codec_info) { return -1; }

bool A2DP_VendorGetPacketTimestampOpus(const uint8_t* p_codec_info,
                                       const uint8_t* p_data,
                                       uint32_t* p_timestamp) {
  return false;
}

bool A2DP_VendorBuildCodecHeaderOpus(const uint8_t* p_codec_info, BT_HDR* p_buf,
                                     uint16_t frames_per_packet) {
  return false;
}

std::string A2DP_VendorCodecInfoStringOpus(const uint8_t* p_codec_info) {
  return "Unsupported codec: Opus";
}

const tA2DP_ENCODER_INTERFACE* A2DP_VendorGetEncoderInterfaceOpus(
    const uint8_t* p_codec_info) {
  return nullptr;
}

const tA2DP_DECODER_INTERFACE* A2DP_VendorGetDecoderInterfaceOpus(
    const uint8_t* p_codec_info) {
  return nullptr;
}

bool A2DP_VendorAdjustCodecOpus(uint8_t* p_codec_info) { return false; }

btav_a2dp_codec_index_t A2DP_VendorSourceCodecIndexOpus(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

btav_a2dp_codec_index_t A2DP_VendorSinkCodecIndexOpus(
    const uint8_t* p_codec_info) {
  return BTAV_A2DP_CODEC_INDEX_MAX;
}

const char* A2DP_VendorCodecIndexStrOpus(void) { return "Opus"; }

const char* A2DP_VendorCodecIndexStrOpusSink(void) { return "Opus SINK"; }

bool A2DP_VendorInitCodecConfigOpus(AvdtpSepConfig* p_cfg) { return false; }

bool A2DP_VendorInitCodecConfigOpusSink(AvdtpSepConfig* p_cfg) { return false; }

A2dpCodecConfigOpusSource::A2dpCodecConfigOpusSource(
    btav_a2dp_codec_priority_t codec_priority)
    : A2dpCodecConfigOpusBase(BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS,
                              A2DP_VendorCodecIndexStrOpus(), codec_priority,
                              true) {}

A2dpCodecConfigOpusSource::~A2dpCodecConfigOpusSource() {}

bool A2dpCodecConfigOpusSource::init() { return false; }

bool A2dpCodecConfigOpusSource::useRtpHeaderMarkerBit() const { return false; }

void A2dpCodecConfigOpusSource::debug_codec_dump(int fd) {}

bool A2dpCodecConfigOpusBase::setCodecConfig(const uint8_t* p_peer_codec_info,
                                             bool is_capability,
                                             uint8_t* p_result_codec_config) {
  return false;
}

bool A2dpCodecConfigOpusBase::setPeerCodecCapabilities(
    const uint8_t* p_peer_codec_capabilities) {
  return false;
}

A2dpCodecConfigOpusSink::A2dpCodecConfigOpusSink(
    btav_a2dp_codec_priority_t codec_priority)
    : A2dpCodecConfigOpusBase(BTAV_A2DP_CODEC_INDEX_SINK_OPUS,
                              A2DP_VendorCodecIndexStrOpusSink(),
                              codec_priority, false) {}

A2dpCodecConfigOpusSink::~A2dpCodecConfigOpusSink() {}

bool A2dpCodecConfigOpusSink::init() { return false; }

bool A2dpCodecConfigOpusSink::useRtpHeaderMarkerBit() const { return false; }

bool A2dpCodecConfigOpusSink::updateEncoderUserConfig(
    const tA2DP_ENCODER_INIT_PEER_PARAMS* p_peer_params, bool* p_restart_input,
    bool* p_restart_output, bool* p_config_updated) {
  return false;
}
Loading