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 namespace OHOS {
19 namespace AudioStandard {
AudioPlaybackEngine()20 AudioPlaybackEngine::AudioPlaybackEngine()
21     : renderSink_(nullptr), playbackThread_(nullptr), streams_(0) {}
22 
~AudioPlaybackEngine()23 AudioPlaybackEngine::~AudioPlaybackEngine() {}
24 
Init(const DeviceInfo & type,bool isVoip)25 int32_t AudioPlaybackEngine::Init(const DeviceInfo &type, bool isVoip)
26 {
27     return SUCCESS;
28 }
29 
AddRenderer(const std::shared_ptr<IRendererStream> & stream)30 int32_t AudioPlaybackEngine::AddRenderer(const std::shared_ptr<IRendererStream> &stream)
31 {
32     auto it = std::find(streams_.begin(), streams_.end(), stream);
33     if (it == streams_.end()) {
34         streams_.emplace_back(stream);
35     }
36     return SUCCESS;
37 }
38 
RemoveRenderer(const std::shared_ptr<IRendererStream> & stream)39 void AudioPlaybackEngine::RemoveRenderer(const std::shared_ptr<IRendererStream> &stream)
40 {
41     auto it = std::find(streams_.begin(), streams_.end(), stream);
42     if (it != streams_.end()) {
43         streams_.erase(it);
44     }
45 }
46 
Start()47 int32_t AudioPlaybackEngine::Start()
48 {
49     return SUCCESS;
50 }
51 
Stop()52 int32_t AudioPlaybackEngine::Stop()
53 {
54     return SUCCESS;
55 }
56 
Pause()57 int32_t AudioPlaybackEngine::Pause()
58 {
59     return SUCCESS;
60 }
61 
Flush()62 int32_t AudioPlaybackEngine::Flush()
63 {
64     return SUCCESS;
65 }
66 
IsPlaybackEngineRunning() const67 bool AudioPlaybackEngine::IsPlaybackEngineRunning() const noexcept
68 {
69     return false;
70 }
71 } // namespace AudioStandard
72 } // namespace OHOS
73