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 ~AudioProcess() = default; 51 }; 52 53 class IProcessCb : public IRemoteBroker { 54 public: 55 virtual ~IProcessCb() = default; 56 57 virtual int32_t OnEndpointChange(int32_t status) = 0; 58 59 // IPC code. 60 enum IProcessCbMsg : uint32_t { 61 ON_ENDPOINT_CHANGE = 0, 62 PROCESS_CB_MAX_MSG 63 }; 64 DECLARE_INTERFACE_DESCRIPTOR(u"IProcessCb"); 65 }; 66 67 class IAudioProcess : public AudioProcess, public IRemoteBroker { 68 public: 69 virtual ~IAudioProcess() = default; 70 71 virtual int32_t RegisterProcessCb(sptr<IRemoteObject> object) = 0; 72 virtual int32_t RegisterThreadPriority(uint32_t tid, const std::string &bundleName) = 0; 73 74 // IPC code. 75 enum IAudioProcessMsg : uint32_t { 76 ON_RESOLVE_BUFFER = 0, 77 OH_GET_SESSIONID, 78 ON_START, 79 ON_PAUSE, 80 ON_RESUME, 81 ON_STOP, 82 ON_REQUEST_HANDLE_INFO, 83 ON_RELEASE, 84 ON_REGISTER_PROCESS_CB, 85 ON_REGISTER_THREAD_PRIORITY, 86 PROCESS_MAX_MSG 87 }; 88 89 DECLARE_INTERFACE_DESCRIPTOR(u"IAudioProcess"); 90 }; 91 } // namespace AudioStandard 92 } // namespace OHOS 93 #endif // I_AUDIO_PROCESS_H 94