• 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 "ipc_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(const sptr<IpcOfflineStream> &ipcProxy);
33     ~OfflineStreamInClient() = default;
34 
35     /**
36      * @brief Create the offline audio effect chain
37      *
38      * @param chainName Audio effect chain name
39      * @return The result of construction, 0 for success, other for error code
40      * @since 15
41      */
42     int32_t CreateOfflineEffectChain(const std::string &chainName);
43 
44     /**
45      * @brief Configure the offline audio effect chain
46      *
47      * @param inInfo Input audio stream information
48      * @param outInfo Output audio stream information
49      * @return The result of configuration, 0 for success, other for error code
50      * @since 15
51      */
52     int32_t ConfigureOfflineEffectChain(const AudioStreamInfo &inInfo, const AudioStreamInfo &outInfo);
53 
54     /**
55      * @brief Prepare the offline audio effect chain
56      *
57      * @param bufIn Input audio sharedmemory buffer
58      * @param bufOut Output audio sharedmemory buffer
59      * @return The result of preparation, 0 for success, other for error code
60      * @since 15
61      */
62     int32_t PrepareOfflineEffectChain(std::shared_ptr<AudioSharedMemory> &bufIn,
63         std::shared_ptr<AudioSharedMemory> &bufOut);
64 
65     /**
66      * @brief Process the offline audio effect chain
67      *
68      * @param inSize Size of input audio data in sharedmemory
69      * @param outSize Size of output audio data in sharedmemory
70      * @return The result of processing, 0 for success, other for error code
71      * @since 15
72      */
73     int32_t ProcessOfflineEffectChain(uint32_t inSize, uint32_t outSize);
74 
75     /**
76      * @brief Release the offline audio effect chain
77      *
78      * @since 15
79      */
80     void ReleaseOfflineEffectChain();
81 private:
82     sptr<IpcOfflineStream> streamProxy_ = nullptr;
83 };
84 } // namespace AudioStandard
85 } // namespace OHOS
86 #endif // OFFLINE_STREAM_IN_CLIENT_H
87