• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 DAUDIO_ADAPTER_INTERNAL_H
17 #define DAUDIO_ADAPTER_INTERNAL_H
18 
19 #include <map>
20 #include <mutex>
21 #include <vector>
22 
23 #include "audio_adapter.h"
24 #include "audio_types.h"
25 #include <v1_0/iaudio_adapter.h>
26 
27 #include "daudio_capture_internal.h"
28 #include "daudio_render_internal.h"
29 #include "daudio_param_callback_internal.h"
30 
31 namespace OHOS {
32 namespace DistributedHardware {
33 using OHOS::HDI::DistributedAudio::Audio::V1_0::IAudioAdapter;
34 
35 constexpr int DESCRIPTOR_LENGTH = 32;
36 struct AudioAdapterContext {
37     AudioAdapterContext();
38     ~AudioAdapterContext();
39 
40     struct AudioAdapter instance_;
41     sptr<IAudioAdapter> proxy_ = nullptr;
42     std::string adapterName_;
43     std::mutex mtx_;
44 
45     std::unique_ptr<AudioParamCallbackContext> callbackInternal_ = nullptr;
46     ParamCallback callback_ = nullptr;
47 
48     std::vector<std::unique_ptr<AudioCaptureContext>> captures_;
49     std::vector<std::unique_ptr<AudioRenderContext>> renders_;
50     std::map<uint32_t, std::unique_ptr<::AudioPortCapability>> caps_;
51 };
52 } // namespace DistributedHardware
53 } // namespace OHOS
54 #endif // DAUDIO_ADAPTER_INTERNAL_H
55