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_OUTPUT_SINK_H
17 #define HISTREAMER_PLUGIN_CORE_OUTPUT_SINK_H
18 
19 #include "plugin/common/plugin_buffer.h"
20 #include "plugin/common/media_sink.h"
21 #include "plugin/core/base.h"
22 
23 namespace OHOS {
24 namespace Media {
25 namespace Plugin {
26 struct OutputSinkPlugin;
27 class OutputSink : public Base {
28 public:
29     OutputSink(const OutputSink &) = delete;
30     OutputSink operator = (const OutputSink &) = delete;
31     ~OutputSink() override = default;
32 
33     Status SetSink(const MediaSink& sink);
34     Seekable GetSeekable();
35     Status SeekTo(uint64_t offset);
36     Status Write(const std::shared_ptr<Buffer>& buffer);
37     Status Flush();
38 private:
39     friend class PluginManager;
40 
41     OutputSink(uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<OutputSinkPlugin> plugin);
42 
43 private:
44     std::shared_ptr<OutputSinkPlugin> outputSink_;
45 };
46 } // namespace Plugin
47 } // namespace Media
48 } // namespace OHOS
49 #endif // HISTREAMER_PLUGIN_CORE_OUTPUT_SINK_H
50