• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef OFFLINE_STREAM_IN_CLIENT_H
16 #define OFFLINE_STREAM_IN_CLIENT_H
17 
18 #include <cstdint>
19 #include <string>
20 #include <vector>
21 
22 #include "audio_shared_memory.h"
23 #include "iipc_offline_stream.h"
24 
25 namespace OHOS {
26 namespace AudioStandard {
27 class OfflineStreamInClient {
28 public:
29     static int32_t GetOfflineAudioEffectChains(std::vector<std::string> &effectChains);
30     static std::shared_ptr<OfflineStreamInClient> Create();
31 
32     OfflineStreamInClient() = default;
33     OfflineStreamInClient(const sptr<IIpcOfflineStream> &ipcProxy);
34     ~OfflineStreamInClient() = default;
35 
36     /**
37      * @brief Create the offline audio effect chain
38      *
39      * @param chainName Audio effect chain name
40      * @return The result of construction, 0 for success, other for error code
41      * @since 15
42      */
43     int32_t CreateOfflineEffectChain(const std::string &chainName);
44 
45     /**
46      * @brief Configure the offline audio effect chain
47      *
48      * @param inInfo Input audio stream information
49      * @param outInfo Output audio stream information
50      * @return The result of configuration, 0 for success, other for error code
51      * @since 15
52      */
53     int32_t ConfigureOfflineEffectChain(const AudioStreamInfo &inInfo, const AudioStreamInfo &outInfo);
54 
55     /**
56      * @brief Set parameter for the offline audio effect chain
57      *
58      * @param param Input offline audio effect parameter
59      * @return The result of the setparam, 0 for success, other for error code
60      * @since 15
61      */
62     int32_t SetParamOfflineEffectChain(const std::vector<uint8_t> &param);
63 
64     /**
65      * @brief Prepare the offline audio effect chain
66      *
67      * @param bufIn Input audio sharedmemory buffer
68      * @param bufOut Output audio sharedmemory buffer
69      * @return The result of preparation, 0 for success, other for error code
70      * @since 15
71      */
72     int32_t PrepareOfflineEffectChain(std::shared_ptr<AudioSharedMemory> &bufIn,
73         std::shared_ptr<AudioSharedMemory> &bufOut);
74 
75     /**
76      * @brief Process the offline audio effect chain
77      *
78      * @param inSize Size of input audio data in sharedmemory
79      * @param outSize Size of output audio data in sharedmemory
80      * @return The result of processing, 0 for success, other for error code
81      * @since 15
82      */
83     int32_t ProcessOfflineEffectChain(uint32_t inSize, uint32_t outSize);
84 
85     /**
86      * @brief Release the offline audio effect chain
87      *
88      * @since 15
89      */
90     void ReleaseOfflineEffectChain();
91 private:
92     sptr<IIpcOfflineStream> streamProxy_ = nullptr;
93 };
94 } // namespace AudioStandard
95 } // namespace OHOS
96 #endif // OFFLINE_STREAM_IN_CLIENT_H
97