• 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 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 Start() = 0;
37 
38     virtual int32_t Pause(bool isFlush) = 0;
39 
40     virtual int32_t Resume() = 0;
41 
42     virtual int32_t Stop() = 0;
43 
44     virtual int32_t RequestHandleInfo() = 0;
45 
46     virtual int32_t Release() = 0;
47 
48     virtual ~AudioProcess() = default;
49 };
50 
51 class IProcessCb : public IRemoteBroker {
52 public:
53     virtual ~IProcessCb() = default;
54 
55     virtual int32_t OnEndpointChange(int32_t status) = 0;
56 
57     // IPC code.
58     enum IProcessCbMsg : uint32_t {
59         ON_ENDPOINT_CHANGE = 0,
60         PROCESS_CB_MAX_MSG
61     };
62     DECLARE_INTERFACE_DESCRIPTOR(u"IProcessCb");
63 };
64 
65 class IAudioProcess : public AudioProcess, public IRemoteBroker {
66 public:
67     virtual ~IAudioProcess() = default;
68 
69     virtual int32_t RegisterProcessCb(sptr<IRemoteObject> object) = 0;
70 
71     // IPC code.
72     enum IAudioProcessMsg : uint32_t {
73         ON_RESOLVE_BUFFER = 0,
74         ON_START,
75         ON_PAUSE,
76         ON_RESUME,
77         ON_STOP,
78         ON_REQUEST_HANDLE_INFO,
79         ON_RELEASE,
80         ON_REGISTER_PROCESS_CB,
81         PROCESS_MAX_MSG
82     };
83 
84     DECLARE_INTERFACE_DESCRIPTOR(u"IAudioProcess");
85 };
86 } // namespace AudioStandard
87 } // namespace OHOS
88 #endif // I_AUDIO_PROCESS_H
89