• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #include <algorithm>
16 #include "audio_playback_engine.h"
17 #include "audio_errors.h"
18 #include "common/hdi_adapter_info.h"
19 namespace OHOS {
20 namespace AudioStandard {
AudioPlaybackEngine()21 AudioPlaybackEngine::AudioPlaybackEngine()
22     : renderId_(HDI_INVALID_ID), playbackThread_(nullptr), streams_(0) {}
23 
~AudioPlaybackEngine()24 AudioPlaybackEngine::~AudioPlaybackEngine() {}
25 
Init(const AudioDeviceDescriptor & type,bool isVoip)26 int32_t AudioPlaybackEngine::Init(const AudioDeviceDescriptor &type, bool isVoip)
27 {
28     return SUCCESS;
29 }
30 
AddRenderer(const std::shared_ptr<IRendererStream> & stream)31 int32_t AudioPlaybackEngine::AddRenderer(const std::shared_ptr<IRendererStream> &stream)
32 {
33     auto it = std::find(streams_.begin(), streams_.end(), stream);
34     if (it == streams_.end()) {
35         streams_.emplace_back(stream);
36     }
37     return SUCCESS;
38 }
39 
RemoveRenderer(const std::shared_ptr<IRendererStream> & stream)40 void AudioPlaybackEngine::RemoveRenderer(const std::shared_ptr<IRendererStream> &stream)
41 {
42     auto it = std::find(streams_.begin(), streams_.end(), stream);
43     if (it != streams_.end()) {
44         streams_.erase(it);
45     }
46 }
47 
Start()48 int32_t AudioPlaybackEngine::Start()
49 {
50     return SUCCESS;
51 }
52 
Stop()53 int32_t AudioPlaybackEngine::Stop()
54 {
55     return SUCCESS;
56 }
57 
Pause()58 int32_t AudioPlaybackEngine::Pause()
59 {
60     return SUCCESS;
61 }
62 
Flush()63 int32_t AudioPlaybackEngine::Flush()
64 {
65     return SUCCESS;
66 }
67 
IsPlaybackEngineRunning() const68 bool AudioPlaybackEngine::IsPlaybackEngineRunning() const noexcept
69 {
70     return false;
71 }
72 
GetLatency()73 uint64_t AudioPlaybackEngine::GetLatency() noexcept
74 {
75     return 0;
76 }
77 } // namespace AudioStandard
78 } // namespace OHOS
79