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/media/audio/common/AudioConfig.h>
32 #include <media/AidlConversionUtil.h>
33 
34 namespace aidl {
35 namespace android {
36 
37 ConversionResult<buffer_config_t> aidl2legacy_AudioConfig_buffer_config_t(
38         const media::audio::common::AudioConfig& aidl, bool isInput);
39 ConversionResult<media::audio::common::AudioConfig> legacy2aidl_buffer_config_t_AudioConfig(
40         const buffer_config_t& legacy, bool isInput);
41 
42 ::android::status_t aidl2legacy_AudioAttributesTags(
43         const std::vector<std::string>& aidl, char* legacy);
44 ConversionResult<std::vector<std::string>> legacy2aidl_AudioAttributesTags(const char* legacy);
45 
46 ConversionResult<playback_track_metadata_v7>
47 aidl2legacy_PlaybackTrackMetadata_playback_track_metadata_v7(
48         const hardware::audio::common::PlaybackTrackMetadata& aidl);
49 ConversionResult<hardware::audio::common::PlaybackTrackMetadata>
50 legacy2aidl_playback_track_metadata_v7_PlaybackTrackMetadata(
51         const playback_track_metadata_v7& legacy);
52 
53 ConversionResult<record_track_metadata_v7>
54 aidl2legacy_RecordTrackMetadata_record_track_metadata_v7(
55         const hardware::audio::common::RecordTrackMetadata& aidl);
56 ConversionResult<hardware::audio::common::RecordTrackMetadata>
57 legacy2aidl_record_track_metadata_v7_RecordTrackMetadata(const record_track_metadata_v7& legacy);
58 
59 }  // namespace android
60 }  // namespace aidl
61