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

Commit 9c5dcef7 authored by Eric Laurent's avatar Eric Laurent Committed by android-build-merger
Browse files

Merge "AudioFlinger: implement device specific audio effects"

am: 83e2dd64

Change-Id: I1cd7ca8be42df5f467a9ea3b8def71fb8aad1adf
parents caf50187 83e2dd64
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,16 @@ bool AudioDeviceTypeAddr::equals(const AudioDeviceTypeAddr& other) const {
    return mType == other.mType && mAddress == other.mAddress;
    return mType == other.mType && mAddress == other.mAddress;
}
}


bool AudioDeviceTypeAddr::operator<(const AudioDeviceTypeAddr& other) const {
    if (mType < other.mType)  return true;
    if (mType > other.mType)  return false;

    if (mAddress < other.mAddress)  return true;
    // if (mAddress > other.mAddress)  return false;

    return false;
}

void AudioDeviceTypeAddr::reset() {
void AudioDeviceTypeAddr::reset() {
    mType = AUDIO_DEVICE_NONE;
    mType = AUDIO_DEVICE_NONE;
    mAddress = "";
    mAddress = "";
+2 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,8 @@ struct AudioDeviceTypeAddr : public Parcelable {


    AudioDeviceTypeAddr& operator= (const AudioDeviceTypeAddr&) = default;
    AudioDeviceTypeAddr& operator= (const AudioDeviceTypeAddr&) = default;


    bool operator<(const AudioDeviceTypeAddr& other) const;

    void reset();
    void reset();


    status_t readFromParcel(const Parcel *parcel) override;
    status_t readFromParcel(const Parcel *parcel) override;
+33 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include <common/all-versions/VersionUtils.h>
#include <common/all-versions/VersionUtils.h>


#include "DeviceHalHidl.h"
#include "DeviceHalHidl.h"
#include "EffectHalHidl.h"
#include "HidlUtils.h"
#include "HidlUtils.h"
#include "StreamHalHidl.h"
#include "StreamHalHidl.h"
#include "VersionUtils.h"
#include "VersionUtils.h"
@@ -43,6 +44,8 @@ namespace CPP_VERSION {
using namespace ::android::hardware::audio::common::CPP_VERSION;
using namespace ::android::hardware::audio::common::CPP_VERSION;
using namespace ::android::hardware::audio::CPP_VERSION;
using namespace ::android::hardware::audio::CPP_VERSION;


using EffectHalHidl = ::android::effect::CPP_VERSION::EffectHalHidl;

namespace {
namespace {


status_t deviceAddressFromHal(
status_t deviceAddressFromHal(
@@ -385,6 +388,36 @@ status_t DeviceHalHidl::getMicrophones(std::vector<media::MicrophoneInfo> *micro
}
}
#endif
#endif


#if MAJOR_VERSION >= 6
status_t DeviceHalHidl::addDeviceEffect(
        audio_port_handle_t device, sp<EffectHalInterface> effect) {
    if (mDevice == 0) return NO_INIT;
    return processReturn("addDeviceEffect", mDevice->addDeviceEffect(
            static_cast<AudioPortHandle>(device),
            static_cast<EffectHalHidl*>(effect.get())->effectId()));
}
#else
status_t DeviceHalHidl::addDeviceEffect(
        audio_port_handle_t device __unused, sp<EffectHalInterface> effect __unused) {
    return INVALID_OPERATION;
}
#endif

#if MAJOR_VERSION >= 6
status_t DeviceHalHidl::removeDeviceEffect(
        audio_port_handle_t device, sp<EffectHalInterface> effect) {
    if (mDevice == 0) return NO_INIT;
    return processReturn("removeDeviceEffect", mDevice->removeDeviceEffect(
            static_cast<AudioPortHandle>(device),
            static_cast<EffectHalHidl*>(effect.get())->effectId()));
}
#else
status_t DeviceHalHidl::removeDeviceEffect(
        audio_port_handle_t device __unused, sp<EffectHalInterface> effect __unused) {
    return INVALID_OPERATION;
}
#endif

status_t DeviceHalHidl::dump(int fd) {
status_t DeviceHalHidl::dump(int fd) {
    if (mDevice == 0) return NO_INIT;
    if (mDevice == 0) return NO_INIT;
    native_handle_t* hidlHandle = native_handle_create(1, 0);
    native_handle_t* hidlHandle = native_handle_create(1, 0);
+3 −0
Original line number Original line Diff line number Diff line
@@ -113,6 +113,9 @@ class DeviceHalHidl : public DeviceHalInterface, public ConversionHelperHidl
    // List microphones
    // List microphones
    virtual status_t getMicrophones(std::vector<media::MicrophoneInfo> *microphones);
    virtual status_t getMicrophones(std::vector<media::MicrophoneInfo> *microphones);


    status_t addDeviceEffect(audio_port_handle_t device, sp<EffectHalInterface> effect) override;
    status_t removeDeviceEffect(audio_port_handle_t device, sp<EffectHalInterface> effect) override;

    virtual status_t dump(int fd);
    virtual status_t dump(int fd);


  private:
  private:
+11 −0
Original line number Original line Diff line number Diff line
@@ -206,6 +206,17 @@ status_t DeviceHalLocal::getMicrophones(std::vector<media::MicrophoneInfo> *micr
}
}
#endif
#endif


// Local HAL implementation does not support effects
status_t DeviceHalLocal::addDeviceEffect(
        audio_port_handle_t device __unused, sp<EffectHalInterface> effect __unused) {
    return INVALID_OPERATION;
}

status_t DeviceHalLocal::removeDeviceEffect(
        audio_port_handle_t device __unused, sp<EffectHalInterface> effect __unused) {
    return INVALID_OPERATION;
}

status_t DeviceHalLocal::dump(int fd) {
status_t DeviceHalLocal::dump(int fd) {
    return mDev->dump(mDev, fd);
    return mDev->dump(mDev, fd);
}
}
Loading