• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 IPC_STREAM_PROXY_H
17 #define IPC_STREAM_PROXY_H
18 
19 #include "message_parcel.h"
20 
21 #include "ipc_stream.h"
22 
23 namespace OHOS {
24 namespace AudioStandard {
25 class IpcStreamProxy : public IRemoteProxy<IpcStream> {
26 public:
27     explicit IpcStreamProxy(const sptr<IRemoteObject> &impl);
28     virtual ~IpcStreamProxy();
29 
30     int32_t RegisterStreamListener(sptr<IRemoteObject> object) override;
31 
32     int32_t ResolveBuffer(std::shared_ptr<OHAudioBuffer> &buffer) override;
33 
34     int32_t UpdatePosition() override;
35 
36     int32_t GetAudioSessionID(uint32_t &sessionId) override;
37 
38     int32_t Start() override;
39 
40     int32_t Pause() override;
41 
42     int32_t Stop() override;
43 
44     int32_t Release() override;
45 
46     int32_t Flush() override;
47 
48     int32_t Drain(bool stopFlag = false) override;
49 
50     int32_t UpdatePlaybackCaptureConfig(const AudioPlaybackCaptureConfig &config) override;
51 
52     int32_t GetAudioTime(uint64_t &framePos, uint64_t &timestamp) override;
53 
54     int32_t GetAudioPosition(uint64_t &framePos, uint64_t &timestamp, uint64_t &latency) override;
55 
56     int32_t GetLatency(uint64_t &latency) override;
57 
58     int32_t SetRate(int32_t rate) override; // SetRenderRate
59 
60     int32_t GetRate(int32_t &rate) override; // SetRenderRate
61 
62     int32_t SetLowPowerVolume(float volume) override; // renderer only
63 
64     int32_t GetLowPowerVolume(float &volume) override; // renderer only
65 
66     int32_t SetAudioEffectMode(int32_t effectMode) override; // renderer only
67 
68     int32_t GetAudioEffectMode(int32_t &effectMode) override; // renderer only
69 
70     int32_t SetPrivacyType(int32_t privacyType) override; // renderer only
71 
72     int32_t GetPrivacyType(int32_t &privacyType) override; // renderer only
73 
74     int32_t SetOffloadMode(int32_t state, bool isAppBack) override; // renderer only
75 
76     int32_t UnsetOffloadMode() override; // renderer only
77 
78     int32_t GetOffloadApproximatelyCacheTime(uint64_t &timestamp, uint64_t &paWriteIndex,
79         uint64_t &cacheTimeDsp, uint64_t &cacheTimePa) override; // renderer only
80 
81     int32_t UpdateSpatializationState(bool spatializationEnabled, bool headTrackingEnabled) override; // renderer only
82 
83     int32_t GetStreamManagerType() override;
84 
85     int32_t SetSilentModeAndMixWithOthers(bool on) override;
86 
87     int32_t SetClientVolume() override;
88 
89     int32_t SetMute(bool isMute) override;
90 
91     int32_t SetDuckFactor(float duckFactor) override;
92 
93     int32_t RegisterThreadPriority(uint32_t tid, const std::string &bundleName) override;
94 
95     int32_t SetDefaultOutputDevice(const DeviceType defaultOutputDevice) override;
96 
97     int32_t SetSourceDuration(int64_t duration) override;
98 private:
99     static inline BrokerDelegator<IpcStreamProxy> delegator_;
100 };
101 } // namespace AudioStandard
102 } // namespace OHOS
103 #endif // IPC_STREAM_PROXY_H
104