1fa7767c5Sopenharmony_ci/* 2fa7767c5Sopenharmony_ci * Copyright (c) 2021-2021 Huawei Device Co., Ltd. 3fa7767c5Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4fa7767c5Sopenharmony_ci * you may not use this file except in compliance with the License. 5fa7767c5Sopenharmony_ci * You may obtain a copy of the License at 6fa7767c5Sopenharmony_ci * 7fa7767c5Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8fa7767c5Sopenharmony_ci * 9fa7767c5Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10fa7767c5Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11fa7767c5Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12fa7767c5Sopenharmony_ci * See the License for the specific language governing permissions and 13fa7767c5Sopenharmony_ci * limitations under the License. 14fa7767c5Sopenharmony_ci */ 15fa7767c5Sopenharmony_ci 16fa7767c5Sopenharmony_ci#ifndef HISTREAMER_PLUGIN_INTF_MUXER_PLUGIN_H 17fa7767c5Sopenharmony_ci#define HISTREAMER_PLUGIN_INTF_MUXER_PLUGIN_H 18fa7767c5Sopenharmony_ci 19fa7767c5Sopenharmony_ci#include "plugin/common/plugin_caps.h" 20fa7767c5Sopenharmony_ci#include "plugin/interface/plugin_base.h" 21fa7767c5Sopenharmony_ci#include "plugin/interface/plugin_definition.h" 22fa7767c5Sopenharmony_ci 23fa7767c5Sopenharmony_cinamespace OHOS { 24fa7767c5Sopenharmony_cinamespace Media { 25fa7767c5Sopenharmony_cinamespace Plugin { 26fa7767c5Sopenharmony_cistruct DataSink { 27fa7767c5Sopenharmony_ci virtual ~DataSink() = default; 28fa7767c5Sopenharmony_ci virtual Status WriteAt(int64_t offset, const std::shared_ptr<Buffer>& buffer) = 0; 29fa7767c5Sopenharmony_ci}; 30fa7767c5Sopenharmony_ci 31fa7767c5Sopenharmony_cistruct MuxerPlugin : public PluginBase { 32fa7767c5Sopenharmony_ci explicit MuxerPlugin(std::string&& name) : PluginBase(std::move(name)) {} 33fa7767c5Sopenharmony_ci virtual Status SetTrackParameter(uint32_t trackId, Plugin::Tag tag, const Plugin::ValueType& value) = 0; 34fa7767c5Sopenharmony_ci virtual Status GetTrackParameter(uint32_t trackId, Plugin::Tag tag, Plugin::ValueType& value) = 0; 35fa7767c5Sopenharmony_ci virtual Status AddTrack(uint32_t& trackId) = 0; 36fa7767c5Sopenharmony_ci virtual Status SetDataSink(const std::shared_ptr<DataSink>& dataSink) = 0; 37fa7767c5Sopenharmony_ci virtual Status WriteHeader() = 0; 38fa7767c5Sopenharmony_ci virtual Status WriteFrame(const std::shared_ptr<Buffer>& buffer) = 0; 39fa7767c5Sopenharmony_ci virtual Status WriteTrailer() = 0; 40fa7767c5Sopenharmony_ci}; 41fa7767c5Sopenharmony_ci 42fa7767c5Sopenharmony_ci/// Muxer plugin api major number. 43fa7767c5Sopenharmony_ci#define MUXER_API_VERSION_MAJOR (1) 44fa7767c5Sopenharmony_ci 45fa7767c5Sopenharmony_ci/// Muxer plugin api minor number 46fa7767c5Sopenharmony_ci#define MUXER_API_VERSION_MINOR (0) 47fa7767c5Sopenharmony_ci 48fa7767c5Sopenharmony_ci/// Muxer plugin version 49fa7767c5Sopenharmony_ci#define MUXER_API_VERSION MAKE_VERSION(MUXER_API_VERSION_MAJOR, MUXER_API_VERSION_MINOR) 50fa7767c5Sopenharmony_ci 51fa7767c5Sopenharmony_ci 52fa7767c5Sopenharmony_cistruct MuxerPluginDef : public PluginDefBase { 53fa7767c5Sopenharmony_ci CapabilitySet inCaps; ///< Plug-in input capability, For details, @see Capability. 54fa7767c5Sopenharmony_ci CapabilitySet outCaps; ///< Plug-in output capability, For details, @see Capability. 55fa7767c5Sopenharmony_ci PluginCreatorFunc<MuxerPlugin> creator {nullptr}; ///< Muxer plugin create function. 56fa7767c5Sopenharmony_ci MuxerPluginDef() 57fa7767c5Sopenharmony_ci { 58fa7767c5Sopenharmony_ci apiVersion = MUXER_API_VERSION; ///< Muxer plugin version. 59fa7767c5Sopenharmony_ci pluginType = PluginType::MUXER; ///< Plugin type, MUST be MUXER. 60fa7767c5Sopenharmony_ci } 61fa7767c5Sopenharmony_ci}; 62fa7767c5Sopenharmony_ci} // Plugin 63fa7767c5Sopenharmony_ci} // Media 64fa7767c5Sopenharmony_ci} // OHOS 65fa7767c5Sopenharmony_ci#endif // HISTREAMER_PLUGIN_INTF_MUXER_PLUGIN_H 66