• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 AVCODEC_MUXER_PLUGIN_H
17 #define AVCODEC_MUXER_PLUGIN_H
18 
19 #include "plugin/plugin_definition.h"
20 #include "data_sink.h"
21 #include "meta/meta.h"
22 #include "buffer/avbuffer.h"
23 
24 namespace OHOS {
25 namespace Media {
26 namespace Plugins {
27 class MuxerPlugin : public PluginBase {
28 public:
MuxerPlugin(std::string && name)29     explicit MuxerPlugin(std::string &&name) : PluginBase(std::move(name)) {}
30     virtual Status SetDataSink(const std::shared_ptr<DataSink> &dataSink) = 0;
31     virtual Status SetParameter(const std::shared_ptr<Meta> &param) = 0;
32     virtual Status AddTrack(int32_t &trackIndex, const std::shared_ptr<Meta> &trackDesc) = 0;
33     virtual Status Start() = 0;
34     virtual Status WriteSample(uint32_t trackIndex, const std::shared_ptr<AVBuffer> &sample) = 0;
35     virtual Status Stop() = 0;
36     virtual Status Reset() = 0;
37 };
38 
39 /// Muxer plugin api major number.
40 #define MUXER_API_VERSION_MAJOR (1)
41 
42 /// Muxer plugin api minor number
43 #define MUXER_API_VERSION_MINOR (0)
44 
45 /// Muxer plugin version
46 #define MUXER_API_VERSION MAKE_VERSION(MUXER_API_VERSION_MAJOR, MUXER_API_VERSION_MINOR)
47 
48 
49 struct MuxerPluginDef : public PluginDefBase {
MuxerPluginDefMuxerPluginDef50     MuxerPluginDef() : PluginDefBase()
51     {
52         apiVersion = MUXER_API_VERSION; ///< Muxer plugin version.
53         pluginType = PluginType::MUXER; ///< Plugin type, MUST be MUXER.
54     }
55 };
56 } // namespace Plugins
57 } // namespace Media
58 } // namespace OHOS
59 #endif // AVCODEC_MUXER_PLUGIN_H