1 /*
2  * Copyright (c) 2023-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 HISTREAMER_PLUGINS_INFO_H
17 #define HISTREAMER_PLUGINS_INFO_H
18 
19 #include "meta/meta.h"
20 #include "plugin_caps.h"
21 #include "plugin_definition.h"
22 
23 namespace OHOS {
24 namespace Media {
25 namespace Plugins {
26 /**
27  * PluginInfo, which describes static information for a plugin, including basic plugin information,
28  * such as the type, name, rank, and input and output capabilities.
29  *
30  * Different types of plugins have their own extra information,
31  * which is described in the "extra" field in the form of key-value.
32  *
33  * Note that the type, name, rating, and extra information describes the plugin as a whole;
34  *
35  * Typically, plugin have inputs and outputs, those capabilities are described by inCaps and outCaps.
36  * (The Source plugin has only output capability, and the Sink plugin has only input capability.)
37  * The input/output capability describes the data processing capability by mime-type.
38  * To describe mime-type more closely, a detailed tag may be attached to the mime-type.
39  *
40  */
41 struct PluginInfo {
42     uint32_t apiVersion;
43     PluginType pluginType;
44     std::string name;
45     std::string description;
46     uint32_t rank;
47     CapabilitySet inCaps;
48     CapabilitySet outCaps;
49     std::map<std::string, Any> extra;
50 };
51 
52 struct MediaInfoHelper {
53     Meta globalMeta;
54     std::vector<Meta> trackMeta;
55 };
56 
57 /**
58  * @brief MediaInfo is a facilitate unified display of the relevant technical and
59  * tag data for video and audio files.
60  *
61  * MediaInfo reveals information such as:
62  *   - General: artist, album, author, copyright, date, duration, etc.
63  *   - Tracks: such as codec, channel, bitrate, etc.
64  * @see Tag
65  *
66  * @since 1.0
67  * @version 1.0
68  */
69 struct MediaInfo {
70     Meta general;             ///< General information
71     std::vector<Meta> tracks; ///< Media tracks, include audio, video and text
72 };
73 
74 /**
75  * Extra information about the plugin.
76  * Describes the protocol types supported by the Source plugin for playback.
77  */
78 #define PLUGIN_INFO_EXTRA_PROTOCOL          "protocol"  // NOLINT: macro constant
79 
80 /**
81  * Extra information about the plugin.
82  * Describes the input source types supported by the Source plugin for record.
83  */
84 #define PLUGIN_INFO_EXTRA_INPUT_TYPE        "inputType"  // NOLINT: macro constant
85 
86 /**
87  * Extra information about the plugin.
88  * Describes the output types supported by the OutputSink plugin.
89  */
90 #define PLUGIN_INFO_EXTRA_OUTPUT_TYPE        "outputType"  // NOLINT: macro constant
91 
92 /**
93  * Extra information about the plugin.
94  * Describes the extensions supported by the Demuxer plugin.
95  */
96 #define PLUGIN_INFO_EXTRA_EXTENSIONS        "extensions" // NOLINT: macro constant
97 
98 /**
99  * Extra information about the plugin.
100  * Describes the CodecMode supported by the Codec plugin.
101  *
102  * ValueType: enum Plugins::CodecMode
103  */
104 #define PLUGIN_INFO_EXTRA_CODEC_MODE        "codec_mode" // NOLINT: macro constant
105 } // namespace Plugins
106 } // namespace Media
107 } // namespace OHOS
108 #endif // HISTREAMER_PLUGINS_INFO_H
109