• 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 
16 #ifndef OFFLINE_STREAM_IN_SERVER_H
17 #define OFFLINE_STREAM_IN_SERVER_H
18 
19 #include <memory>
20 
21 #include "ipc_offline_stream_stub.h"
22 #ifdef FEATURE_OFFLINE_EFFECT
23 #include "offline_audio_effect_server_chain.h"
24 #endif
25 
26 namespace OHOS {
27 namespace AudioStandard {
28 class OfflineStreamInServer : public IpcOfflineStreamStub {
29 public:
30     static sptr<OfflineStreamInServer> GetOfflineStream(int32_t &errCode);
31 #ifdef FEATURE_OFFLINE_EFFECT
32     static int32_t GetOfflineAudioEffectChains(std::vector<std::string> &effectChains);
33 
34     int32_t CreateOfflineEffectChain(const std::string &chainName) override;
35 
36     int32_t ConfigureOfflineEffectChain(const AudioStreamInfo &inInfo, const AudioStreamInfo &outInfo) override;
37 
38     int32_t PrepareOfflineEffectChain(std::shared_ptr<AudioSharedMemory> &inBuffer,
39         std::shared_ptr<AudioSharedMemory> &outBuffer) override;
40 
41     int32_t ProcessOfflineEffectChain(uint32_t inSize, uint32_t outSize) override;
42 
43     void ReleaseOfflineEffectChain() override;
44 #endif
45 
46     OfflineStreamInServer() = default;
47     ~OfflineStreamInServer() = default;
48 private:
49     int32_t AllocSharedMemory(uint32_t inSize, uint32_t outSize);
50     std::shared_ptr<AudioSharedMemory> serverBufferIn_;
51     std::shared_ptr<AudioSharedMemory> serverBufferOut_;
52 #ifdef FEATURE_OFFLINE_EFFECT
53     std::shared_ptr<OfflineAudioEffectServerChain> effectChain_;
54 #endif
55 };
56 } // namespace AudioStandard
57 } // namespace OHOS
58 #endif // OFFLINE_STREAM_IN_SERVER_H
59