• 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 SetParamOfflineEffectChain(const std::vector<uint8_t> &param) override;
39 
40     int32_t PrepareOfflineEffectChain(std::shared_ptr<AudioSharedMemory> &inBuffer,
41         std::shared_ptr<AudioSharedMemory> &outBuffer) override;
42 
43     int32_t ProcessOfflineEffectChain(uint32_t inSize, uint32_t outSize) override;
44 
45     int32_t ReleaseOfflineEffectChain() override;
46 #endif
47 
48     OfflineStreamInServer() = default;
49     ~OfflineStreamInServer() = default;
50 private:
51     int32_t AllocSharedMemory(uint32_t inSize, uint32_t outSize);
52     std::shared_ptr<AudioSharedMemory> serverBufferIn_;
53     std::shared_ptr<AudioSharedMemory> serverBufferOut_;
54 #ifdef FEATURE_OFFLINE_EFFECT
55     std::shared_ptr<OfflineAudioEffectServerChain> effectChain_;
56 #endif
57 };
58 } // namespace AudioStandard
59 } // namespace OHOS
60 #endif // OFFLINE_STREAM_IN_SERVER_H
61