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 I_AUDIO_PROCESS_H 17 #define I_AUDIO_PROCESS_H 18 19 #include <memory> 20 21 #include "ipc_types.h" 22 #include "iremote_broker.h" 23 #include "iremote_proxy.h" 24 #include "iremote_stub.h" 25 26 #include "audio_info.h" 27 #include "audio_process_config.h" 28 #include "oh_audio_buffer.h" 29 30 namespace OHOS { 31 namespace AudioStandard { 32 class AudioProcess { 33 public: 34 virtual int32_t ResolveBuffer(std::shared_ptr<OHAudioBuffer> &buffer) = 0; 35 36 virtual int32_t GetSessionId(uint32_t &sessionId) = 0; 37 38 virtual int32_t Start() = 0; 39 40 virtual int32_t Pause(bool isFlush) = 0; 41 42 virtual int32_t Resume() = 0; 43 44 virtual int32_t Stop() = 0; 45 46 virtual int32_t RequestHandleInfo(bool isAync = true) = 0; 47 48 virtual int32_t Release(bool isSwitchStream = false) = 0; 49 50 virtual int32_t SetSilentModeAndMixWithOthers(bool on) = 0; 51 52 virtual ~AudioProcess() = default; 53 }; 54 55 class IProcessCb : public IRemoteBroker { 56 public: 57 virtual ~IProcessCb() = default; 58 59 virtual int32_t OnEndpointChange(int32_t status) = 0; 60 61 // IPC code. 62 enum IProcessCbMsg : uint32_t { 63 ON_ENDPOINT_CHANGE = 0, 64 PROCESS_CB_MAX_MSG 65 }; 66 DECLARE_INTERFACE_DESCRIPTOR(u"IProcessCb"); 67 }; 68 69 class IAudioProcess : public AudioProcess, public IRemoteBroker { 70 public: 71 virtual ~IAudioProcess() = default; 72 73 virtual int32_t RegisterProcessCb(sptr<IRemoteObject> object) = 0; 74 virtual int32_t RegisterThreadPriority(uint32_t tid, const std::string &bundleName) = 0; 75 76 // IPC code. 77 enum IAudioProcessMsg : uint32_t { 78 ON_RESOLVE_BUFFER = 0, 79 OH_GET_SESSIONID, 80 ON_START, 81 ON_PAUSE, 82 ON_RESUME, 83 ON_STOP, 84 ON_REQUEST_HANDLE_INFO, 85 ON_RELEASE, 86 ON_REGISTER_PROCESS_CB, 87 ON_REGISTER_THREAD_PRIORITY, 88 ON_SET_SLITNT_MODE_AND_MIX_WITH_OTHERS, 89 PROCESS_MAX_MSG 90 }; 91 92 DECLARE_INTERFACE_DESCRIPTOR(u"IAudioProcess"); 93 }; 94 } // namespace AudioStandard 95 } // namespace OHOS 96 #endif // I_AUDIO_PROCESS_H 97