mirror of
https://github.com/Evolution-X-Devices/device_xiaomi_rosemary
synced 2026-01-27 13:35:09 +00:00
* Since commit eb57617 [1], the legacy callback interfaces in the Android
AudioTrack system have been deprecated and replaced by a newer callback
interface. Consequently, the user parameter, which was previously part
of the constructor, has been incorporated into this new interface.
* To address the resulting build issues, update the function signatures
to match the new methods. Although AOSP provides a wrapper [2] for this
purpose, it's declared within an anonymous namespace, effectively making
it private to its own translation unit. To work around this limitation,
provide a local copy of the wrapper instead.
* Also format the shim with `clang-format`.
- [1]: eb57617e55
- [2]: https://cs.android.com/android/platform/superproject/main/+/main:frameworks/av/media/libaudioclient/AudioTrack.cpp;l=289;bpv=1
Change-Id: Ieae7df3f5f003538a0319cc77051322a989b93a8
50 lines
2.7 KiB
C++
50 lines
2.7 KiB
C++
/*
|
|
* Copyright (C) 2023 The LineageOS Project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <android/media/IAudioTrack.h>
|
|
#include <android/media/IAudioTrackCallback.h>
|
|
#include <gui/SurfaceComposerClient.h>
|
|
#include <media/AudioTrack.h>
|
|
#include <media/stagefright/MediaMuxer.h>
|
|
|
|
#include "LegacyCallbackWrapper.h"
|
|
|
|
using namespace android;
|
|
|
|
extern "C" {
|
|
|
|
void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_t20audio_channel_mask_tRKNS_2spINS_7IMemoryEEE20audio_output_flags_tRKNS_2wpINS0_19IAudioTrackCallbackEEEi15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tRKNS_7content22AttributionSourceStateEPK18audio_attributes_tbf(
|
|
void *thisptr, audio_stream_type_t streamType, uint32_t sampleRate,
|
|
audio_format_t format, audio_channel_mask_t channelMask, size_t frameCount,
|
|
audio_output_flags_t flags,
|
|
const android::wp<android::AudioTrack::IAudioTrackCallback> &cbf,
|
|
int32_t notificationFrames, audio_session_t sessionId,
|
|
android::AudioTrack::transfer_type transferType,
|
|
const audio_offload_info_t *offloadInfo,
|
|
const AttributionSourceState &attributionSource,
|
|
const audio_attributes_t *pAttributes, bool doNotReconnect,
|
|
float maxRequiredSpeed, audio_port_handle_t selectedDeviceId);
|
|
|
|
void _ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_t20audio_channel_mask_tm20audio_output_flags_tPFviPvS5_ES5_i15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tRKNS_7content22AttributionSourceStateEPK18audio_attributes_tbfi(
|
|
void *thisptr, audio_stream_type_t streamType, uint32_t sampleRate,
|
|
audio_format_t format, audio_channel_mask_t channelMask, size_t frameCount,
|
|
audio_output_flags_t flags, android::AudioTrack::legacy_callback_t cbf,
|
|
void *user, int32_t notificationFrames, audio_session_t sessionId,
|
|
android::AudioTrack::transfer_type transferType,
|
|
const audio_offload_info_t *offloadInfo,
|
|
const AttributionSourceState &attributionSource,
|
|
const audio_attributes_t *pAttributes, bool doNotReconnect,
|
|
float maxRequiredSpeed, audio_port_handle_t selectedDeviceId) {
|
|
android::wp<LegacyCallbackWrapper> cbfWrapper =
|
|
new LegacyCallbackWrapper(cbf, user);
|
|
_ZN7android10AudioTrackC1E19audio_stream_type_tj14audio_format_t20audio_channel_mask_tRKNS_2spINS_7IMemoryEEE20audio_output_flags_tRKNS_2wpINS0_19IAudioTrackCallbackEEEi15audio_session_tNS0_13transfer_typeEPK20audio_offload_info_tRKNS_7content22AttributionSourceStateEPK18audio_attributes_tbf(
|
|
thisptr, streamType, sampleRate, format, channelMask, frameCount, flags,
|
|
cbfWrapper, notificationFrames, sessionId, transferType, offloadInfo,
|
|
attributionSource, pAttributes, doNotReconnect, maxRequiredSpeed,
|
|
selectedDeviceId);
|
|
}
|
|
}
|