xref: /aosp_15_r20/frameworks/av/media/audioaidlconversion/include/media/AidlConversionNdk.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 /**
20  * Can only handle conversion between AIDL (NDK backend) and legacy types.
21  */
22 
23 #include <string>
24 #include <vector>
25 
26 #include <hardware/audio_effect.h>
27 #include <system/audio_effect.h>
28 
29 #include <aidl/android/hardware/audio/common/PlaybackTrackMetadata.h>
30 #include <aidl/android/hardware/audio/common/RecordTrackMetadata.h>
31 #include <aidl/android/hardware/audio/common/SourceMetadata.h>
32 #include <aidl/android/media/audio/common/AudioConfig.h>
33 #include <media/AidlConversionUtil.h>
34 
35 namespace aidl {
36 namespace android {
37 
38 ConversionResult<buffer_config_t> aidl2legacy_AudioConfig_buffer_config_t(
39         const media::audio::common::AudioConfig& aidl, bool isInput);
40 ConversionResult<media::audio::common::AudioConfig> legacy2aidl_buffer_config_t_AudioConfig(
41         const buffer_config_t& legacy, bool isInput);
42 
43 ::android::status_t aidl2legacy_AudioAttributesTags(
44         const std::vector<std::string>& aidl, char* legacy);
45 ConversionResult<std::vector<std::string>> legacy2aidl_AudioAttributesTags(const char* legacy);
46 
47 ConversionResult<playback_track_metadata_v7>
48 aidl2legacy_PlaybackTrackMetadata_playback_track_metadata_v7(
49         const hardware::audio::common::PlaybackTrackMetadata& aidl);
50 ConversionResult<hardware::audio::common::PlaybackTrackMetadata>
51 legacy2aidl_playback_track_metadata_v7_PlaybackTrackMetadata(
52         const playback_track_metadata_v7& legacy);
53 
54 ConversionResult<record_track_metadata_v7>
55 aidl2legacy_RecordTrackMetadata_record_track_metadata_v7(
56         const hardware::audio::common::RecordTrackMetadata& aidl);
57 ConversionResult<hardware::audio::common::RecordTrackMetadata>
58 legacy2aidl_record_track_metadata_v7_RecordTrackMetadata(const record_track_metadata_v7& legacy);
59 
60 ConversionResult<hardware::audio::common::SourceMetadata>
61 legacy2aidl_playback_track_metadata_v7_SourceMetadata(
62         const std::vector<playback_track_metadata_v7_t>& legacy);
63 
64 }  // namespace android
65 }  // namespace aidl
66