1 /* 2 * Copyright (c) 2021-2021 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 HISTREAMER_PLUGIN_CORE_AUDIO_SINK_H 17 #define HISTREAMER_PLUGIN_CORE_AUDIO_SINK_H 18 19 #include <cstddef> 20 #include <memory> 21 22 #include "plugin/common/plugin_types.h" 23 #include "plugin/common/plugin_tags.h" 24 #include "plugin/common/plugin_buffer.h" 25 #include "plugin/core/base.h" 26 27 namespace OHOS { 28 namespace Media { 29 namespace Plugin { 30 struct AudioSinkPlugin; 31 32 class AudioSink : public Base { 33 public: 34 AudioSink(const AudioSink &) = delete; 35 AudioSink operator=(const AudioSink &) = delete; 36 ~AudioSink() override = default; 37 38 Status Pause(); 39 40 Status Resume(); 41 42 Status Flush(); 43 44 Status Drain(); 45 46 Status Write(const std::shared_ptr<Buffer> &input); 47 48 Status SetVolume(float volume); 49 50 Status GetLatency(uint64_t& hstTime); 51 private: 52 friend class PluginManager; 53 54 AudioSink(uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<AudioSinkPlugin> plugin); 55 56 private: 57 std::shared_ptr<AudioSinkPlugin> audioSink; 58 }; 59 } // namespace Plugin 60 } // namespace Media 61 } // namespace OHOS 62 #endif // HISTREAMER_PLUGIN_CORE_AUDIO_SINK_H 63