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

Commit 2ad819f7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "aidl_audio_effect_2" am: 89d993d3

parents db4ff5da 89d993d3
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -31,24 +31,26 @@ interface IEffect {
     *
     * @throws a EX_UNSUPPORTED_OPERATION if device capability/resource is not enough or system
     *         failure happens.
     * @note Open an already-opened effect instance should do nothing and not result in throw error.
     * @note Open an already-opened effect instance should do nothing and should not throw an error.
     */
    void open();

    /**
     * Called by the client to close the effect instance, instance context will be kept after
     * close, but processing thread should be destroyed and consume no CPU. It is recommended to
     * close the effect on the client side as soon as it becomes unused, it's client responsibility
     * to make sure all parameter/buffer is correct if client wants to reopen a closed instance.
     * Called by the client to close the effect instance, processing thread should be destroyed and
     * consume no CPU after close.
     *
     * Effect instance close interface should always success unless:
     * It is recommended to close the effect on the client side as soon as it becomes unused, it's
     * client responsibility to make sure all parameter/buffer is correct if client wants to reopen
     * a closed instance.
     *
     * Effect instance close interface should always succeed unless:
     * 1. The effect instance is not in a proper state to be closed, for example it's still in
     * processing state.
     * 2. There is system/hardware related failure when close.
     *
     * @throws EX_ILLEGAL_STATE if the effect instance is not in a proper state to be closed.
     * @throws EX_UNSUPPORTED_OPERATION if the effect instance failed to close for any other reason.
     * @note Close an already-closed effect should do nothing and not result in throw error.
     * @note Close an already-closed effect should do nothing and should not throw an error.
     */
    void close();

+3 −17
Original line number Diff line number Diff line
@@ -29,23 +29,9 @@ Factory::Factory() {
    // TODO: implement this with xml parser on audio_effect.xml, and filter with optional
    // parameters.
    Descriptor::Identity id;
    id.type = {static_cast<int32_t>(0x0bed4300),
               0xddd6,
               0x11db,
               0x8f34,
               {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
    id.uuid = EqualizerUUID;
    id.type = EqualizerTypeUUID;
    id.uuid = EqualizerSwImplUUID;
    mIdentityList.push_back(id);
    // TODO: Add visualizer with default implementation later
#if 0
    id.type = {static_cast<int32_t>(0xd3467faa),
               0xacc7,
               0x4d34,
               0xacaf,
               {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
    id.uuid = VisualizerUUID;
    mIdentityList.push_back(id);
#endif
}

ndk::ScopedAStatus Factory::queryEffects(const std::optional<AudioUuid>& in_type,
@@ -63,7 +49,7 @@ ndk::ScopedAStatus Factory::createEffect(
        const AudioUuid& in_impl_uuid,
        std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>* _aidl_return) {
    LOG(DEBUG) << __func__ << ": UUID " << in_impl_uuid.toString();
    if (in_impl_uuid == EqualizerUUID) {
    if (in_impl_uuid == EqualizerSwImplUUID) {
        *_aidl_return = ndk::SharedRefBase::make<Equalizer>();
    } else {
        LOG(ERROR) << __func__ << ": UUID "
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
int main() {
    // This is a debug implementation, always enable debug logging.
    android::base::SetMinimumLogSeverity(::android::base::DEBUG);
    ABinderProcess_setThreadPoolMaxThreadCount(1);
    ABinderProcess_setThreadPoolMaxThreadCount(0);

    auto effectFactory =
            ndk::SharedRefBase::make<aidl::android::hardware::audio::effect::Factory>();
+0 −9
Original line number Diff line number Diff line
@@ -21,15 +21,6 @@

namespace aidl::android::hardware::audio::effect {

Equalizer::Equalizer() {
    // Implementation UUID
    mDesc.common.id.uuid = {static_cast<int32_t>(0xce772f20),
                            0x847d,
                            0x11df,
                            0xbb17,
                            {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
}

ndk::ScopedAStatus Equalizer::open() {
    LOG(DEBUG) << __func__;
    return ndk::ScopedAStatus::ok();
+12 −4
Original line number Diff line number Diff line
@@ -21,23 +21,31 @@

namespace aidl::android::hardware::audio::effect {

// Equalizer implementation UUID.
static const ::aidl::android::media::audio::common::AudioUuid EqualizerUUID = {
// Equalizer type UUID.
static const ::aidl::android::media::audio::common::AudioUuid EqualizerTypeUUID = {
        static_cast<int32_t>(0x0bed4300),
        0xddd6,
        0x11db,
        0x8f34,
        {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};

// Equalizer implementation UUID.
static const ::aidl::android::media::audio::common::AudioUuid EqualizerSwImplUUID = {
        static_cast<int32_t>(0x0bed4300),
        0x847d,
        0x11df,
        0xbb17,
        {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};

class Equalizer : public BnEffect {
  public:
    Equalizer();
    Equalizer() = default;
    ndk::ScopedAStatus open() override;
    ndk::ScopedAStatus close() override;
    ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;

  private:
    // Effect descriptor.
    Descriptor mDesc = {.common.id.type = EqualizerUUID};
    Descriptor mDesc = {.common = {.id = {.type = EqualizerTypeUUID, .uuid = EqualizerSwImplUUID}}};
};
}  // namespace aidl::android::hardware::audio::effect
Loading