1da853ecaSopenharmony_ci/*
2da853ecaSopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd.
3da853ecaSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4da853ecaSopenharmony_ci * you may not use this file except in compliance with the License.
5da853ecaSopenharmony_ci * You may obtain a copy of the License at
6da853ecaSopenharmony_ci *
7da853ecaSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8da853ecaSopenharmony_ci *
9da853ecaSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10da853ecaSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11da853ecaSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12da853ecaSopenharmony_ci * See the License for the specific language governing permissions and
13da853ecaSopenharmony_ci * limitations under the License.
14da853ecaSopenharmony_ci */
15da853ecaSopenharmony_ci
16da853ecaSopenharmony_ci#ifndef AVCODEC_MUXER_PLUGIN_H
17da853ecaSopenharmony_ci#define AVCODEC_MUXER_PLUGIN_H
18da853ecaSopenharmony_ci
19da853ecaSopenharmony_ci#include "plugin/plugin_definition.h"
20da853ecaSopenharmony_ci#include "data_sink.h"
21da853ecaSopenharmony_ci#include "meta/meta.h"
22da853ecaSopenharmony_ci#include "buffer/avbuffer.h"
23da853ecaSopenharmony_ci
24da853ecaSopenharmony_cinamespace OHOS {
25da853ecaSopenharmony_cinamespace Media {
26da853ecaSopenharmony_cinamespace Plugins {
27da853ecaSopenharmony_ciclass MuxerPlugin : public PluginBase {
28da853ecaSopenharmony_cipublic:
29da853ecaSopenharmony_ci    explicit MuxerPlugin(std::string &&name) : PluginBase(std::move(name)) {}
30da853ecaSopenharmony_ci    virtual Status SetDataSink(const std::shared_ptr<DataSink> &dataSink) = 0;
31da853ecaSopenharmony_ci    virtual Status SetParameter(const std::shared_ptr<Meta> &param) = 0;
32da853ecaSopenharmony_ci    virtual Status SetUserMeta(const std::shared_ptr<Meta> &userMeta) { return Status::ERROR_INVALID_PARAMETER; }
33da853ecaSopenharmony_ci    virtual Status AddTrack(int32_t &trackIndex, const std::shared_ptr<Meta> &trackDesc) = 0;
34da853ecaSopenharmony_ci    virtual Status Start() = 0;
35da853ecaSopenharmony_ci    virtual Status WriteSample(uint32_t trackIndex, const std::shared_ptr<AVBuffer> &sample) = 0;
36da853ecaSopenharmony_ci    virtual Status Stop() = 0;
37da853ecaSopenharmony_ci    virtual Status Reset() = 0;
38da853ecaSopenharmony_ci};
39da853ecaSopenharmony_ci
40da853ecaSopenharmony_ci/// Muxer plugin api major number.
41da853ecaSopenharmony_ci#define MUXER_API_VERSION_MAJOR (1)
42da853ecaSopenharmony_ci
43da853ecaSopenharmony_ci/// Muxer plugin api minor number
44da853ecaSopenharmony_ci#define MUXER_API_VERSION_MINOR (0)
45da853ecaSopenharmony_ci
46da853ecaSopenharmony_ci/// Muxer plugin version
47da853ecaSopenharmony_ci#define MUXER_API_VERSION MAKE_VERSION(MUXER_API_VERSION_MAJOR, MUXER_API_VERSION_MINOR)
48da853ecaSopenharmony_ci
49da853ecaSopenharmony_ci
50da853ecaSopenharmony_cistruct MuxerPluginDef : public PluginDefBase {
51da853ecaSopenharmony_ci    MuxerPluginDef() : PluginDefBase()
52da853ecaSopenharmony_ci    {
53da853ecaSopenharmony_ci        apiVersion = MUXER_API_VERSION; ///< Muxer plugin version.
54da853ecaSopenharmony_ci        pluginType = PluginType::MUXER; ///< Plugin type, MUST be MUXER.
55da853ecaSopenharmony_ci    }
56da853ecaSopenharmony_ci};
57da853ecaSopenharmony_ci} // namespace Plugins
58da853ecaSopenharmony_ci} // namespace Media
59da853ecaSopenharmony_ci} // namespace OHOS
60da853ecaSopenharmony_ci#endif // AVCODEC_MUXER_PLUGIN_H