1fa7767c5Sopenharmony_ci/*
2fa7767c5Sopenharmony_ci * Copyright (c) 2023-2023 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 MEDIA_FOUNDATION_META_H
17fa7767c5Sopenharmony_ci#define MEDIA_FOUNDATION_META_H
18fa7767c5Sopenharmony_ci
19fa7767c5Sopenharmony_ci#ifndef MEDIA_NO_OHOS
20fa7767c5Sopenharmony_ci#ifndef MEDIA_OHOS
21fa7767c5Sopenharmony_ci#define MEDIA_OHOS
22fa7767c5Sopenharmony_ci#endif
23fa7767c5Sopenharmony_ci#else
24fa7767c5Sopenharmony_ci#ifdef MEDIA_OHOS
25fa7767c5Sopenharmony_ci#undef MEDIA_OHOS
26fa7767c5Sopenharmony_ci#endif
27fa7767c5Sopenharmony_ci#endif
28fa7767c5Sopenharmony_ci
29fa7767c5Sopenharmony_ci#include <map>
30fa7767c5Sopenharmony_ci#include <optional>
31fa7767c5Sopenharmony_ci#include "meta/meta_key.h"
32fa7767c5Sopenharmony_ci#include "meta/audio_types.h"
33fa7767c5Sopenharmony_ci#include "meta/media_types.h"
34fa7767c5Sopenharmony_ci#include "meta/video_types.h"
35fa7767c5Sopenharmony_ci#include "meta/source_types.h"
36fa7767c5Sopenharmony_ci#include "meta/mime_type.h"
37fa7767c5Sopenharmony_ci#include "meta/any.h" // NOLINT
38fa7767c5Sopenharmony_ci
39fa7767c5Sopenharmony_cinamespace OHOS {
40fa7767c5Sopenharmony_cinamespace Media {
41fa7767c5Sopenharmony_ci#define DECLARE_INFO_CLASS                                   \
42fa7767c5Sopenharmony_ci    template<TagTypeCharSeq tagCharSeq, class Enable = void> \
43fa7767c5Sopenharmony_ci    class ValueInfo {                                        \
44fa7767c5Sopenharmony_ci        public:                                              \
45fa7767c5Sopenharmony_ci            typedef int32_t type;                            \
46fa7767c5Sopenharmony_ci    }
47fa7767c5Sopenharmony_ci
48fa7767c5Sopenharmony_ci#define DEFINE_INSERT_GET_FUNC(condition, Any, eValueType)   \
49fa7767c5Sopenharmony_ci    template<TagTypeCharSeq tagCharSeq>                      \
50fa7767c5Sopenharmony_ci    inline typename std::enable_if<(condition), bool>::type  \
51fa7767c5Sopenharmony_ci    Set(Any value)                                           \
52fa7767c5Sopenharmony_ci    {                                                        \
53fa7767c5Sopenharmony_ci        TagType tag = tagCharSeq;                            \
54fa7767c5Sopenharmony_ci        auto iter = map_.find(tag);                          \
55fa7767c5Sopenharmony_ci        if (iter != map_.end()) {                            \
56fa7767c5Sopenharmony_ci            map_.erase(iter++);                              \
57fa7767c5Sopenharmony_ci        }                                                    \
58fa7767c5Sopenharmony_ci        map_.insert(std::make_pair(tag, value));             \
59fa7767c5Sopenharmony_ci        return true;                                         \
60fa7767c5Sopenharmony_ci    }                                                        \
61fa7767c5Sopenharmony_ci                                                             \
62fa7767c5Sopenharmony_ci    template<TagTypeCharSeq tagCharSeq>                      \
63fa7767c5Sopenharmony_ci    inline typename std::enable_if<(condition), bool>::type  \
64fa7767c5Sopenharmony_ci    Set(std::nullptr_t)                                      \
65fa7767c5Sopenharmony_ci    {                                                        \
66fa7767c5Sopenharmony_ci        return false;                                        \
67fa7767c5Sopenharmony_ci    }                                                        \
68fa7767c5Sopenharmony_ci                                                             \
69fa7767c5Sopenharmony_ci    template<TagTypeCharSeq tagCharSeq>                      \
70fa7767c5Sopenharmony_ci    inline typename std::enable_if<(condition), bool>::type  \
71fa7767c5Sopenharmony_ci    Get(Any& value) const                                    \
72fa7767c5Sopenharmony_ci    {                                                        \
73fa7767c5Sopenharmony_ci        TagType tag = tagCharSeq;                            \
74fa7767c5Sopenharmony_ci        if (map_.count(tag) == 0) {                          \
75fa7767c5Sopenharmony_ci            return false;                                    \
76fa7767c5Sopenharmony_ci        }                                                    \
77fa7767c5Sopenharmony_ci        return AnyCast<Any>(&map_.at(tag), value);           \
78fa7767c5Sopenharmony_ci    }                                                        \
79fa7767c5Sopenharmony_ci                                                             \
80fa7767c5Sopenharmony_ci    template<TagTypeCharSeq tagCharSeq>                      \
81fa7767c5Sopenharmony_ci    class ValueInfo<tagCharSeq, typename std::enable_if<condition>::type> \
82fa7767c5Sopenharmony_ci    {                                                        \
83fa7767c5Sopenharmony_ci        public:                                              \
84fa7767c5Sopenharmony_ci            typedef Any type;                                \
85fa7767c5Sopenharmony_ci    };                                                       \
86fa7767c5Sopenharmony_ci    template<TagTypeCharSeq tagCharSeq>                      \
87fa7767c5Sopenharmony_ci    inline typename std::enable_if<condition, AnyValueType>::type \
88fa7767c5Sopenharmony_ci    GetValueType()                                           \
89fa7767c5Sopenharmony_ci    {                                                        \
90fa7767c5Sopenharmony_ci        return eValueType;                                   \
91fa7767c5Sopenharmony_ci    }
92fa7767c5Sopenharmony_ci
93fa7767c5Sopenharmony_ciusing MapIt = std::map<TagType, Any>::const_iterator;
94fa7767c5Sopenharmony_ci
95fa7767c5Sopenharmony_ci/**
96fa7767c5Sopenharmony_ci * @brief GetDefaultAnyValue used for Application to get Any type default value from Meta Object.
97fa7767c5Sopenharmony_ci * @implNote In order to get Predefined default Any value from Meta Object.
98fa7767c5Sopenharmony_ci * We use metadataDefaultValueMap to get the right getDefaultVal function.
99fa7767c5Sopenharmony_ci * @return Returns Any type default value, returns <b>Any(string())</b> if no match.
100fa7767c5Sopenharmony_ci * @example GetDefaultAnyValue("media.file.type");
101fa7767c5Sopenharmony_ci */
102fa7767c5Sopenharmony_ciextern Any GetDefaultAnyValue(const TagType& tag);
103fa7767c5Sopenharmony_ci/**
104fa7767c5Sopenharmony_ci * @brief GetDefaultAnyValueOpt used for Application to get Any type default value from Meta Object.
105fa7767c5Sopenharmony_ci * @implNote In order to get Predefined default Any value from Meta Object.
106fa7767c5Sopenharmony_ci * We use metadataDefaultValueMap to get the right getDefaultVal function.
107fa7767c5Sopenharmony_ci * @return Returns Any type default value of optional, returns <b>std::nullopt</b> if no match.
108fa7767c5Sopenharmony_ci * @example GetDefaultAnyValueOpt("media.file.type");
109fa7767c5Sopenharmony_ci */
110fa7767c5Sopenharmony_ciextern std::optional<Any> GetDefaultAnyValueOpt(const TagType& tag);
111fa7767c5Sopenharmony_ci/**
112fa7767c5Sopenharmony_ci * @brief GetDefaultAnyValue used for Application to get Any type default value.
113fa7767c5Sopenharmony_ci * @implNote Return Predefined default Any value by tag, if notexist then find default Any value by type,
114fa7767c5Sopenharmony_ci * if type not defined return Any(string).
115fa7767c5Sopenharmony_ci * We use metadataDefaultValueMap and g_ValueTypeDefaultValueMapto get the right getDefaultVal function.
116fa7767c5Sopenharmony_ci * @return Returns Any type default value, returns <b>Any(AnyValueType())</b> if no match.
117fa7767c5Sopenharmony_ci * @example GetDefaultAnyValue("media.file.type", AnyValueType::INT32_T);
118fa7767c5Sopenharmony_ci */
119fa7767c5Sopenharmony_ciextern Any GetDefaultAnyValue(const TagType& tag, AnyValueType type);
120fa7767c5Sopenharmony_ciclass Meta {
121fa7767c5Sopenharmony_cipublic:
122fa7767c5Sopenharmony_ci    enum struct ValueType : int32_t {
123fa7767c5Sopenharmony_ci        INVALID_TYPE = 1,
124fa7767c5Sopenharmony_ci        BOOL,
125fa7767c5Sopenharmony_ci        INT8_T,
126fa7767c5Sopenharmony_ci        UINT8_T,
127fa7767c5Sopenharmony_ci        INT32_T,
128fa7767c5Sopenharmony_ci        UINT32_T,
129fa7767c5Sopenharmony_ci        INT64_T,
130fa7767c5Sopenharmony_ci        UINT64_T,
131fa7767c5Sopenharmony_ci        FLOAT,
132fa7767c5Sopenharmony_ci        DOUBLE,
133fa7767c5Sopenharmony_ci        VECTOR_UINT8,
134fa7767c5Sopenharmony_ci        VECTOR_UINT32,
135fa7767c5Sopenharmony_ci        STRING,
136fa7767c5Sopenharmony_ci    };
137fa7767c5Sopenharmony_ci
138fa7767c5Sopenharmony_ci    DECLARE_INFO_CLASS;
139fa7767c5Sopenharmony_ci
140fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::SRC_INPUT_TYPE, Plugins::SrcInputType, AnyValueType::INT32_T);
141fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::MEDIA_CODEC_CONFIG or
142fa7767c5Sopenharmony_ci                           tagCharSeq == Tag::MEDIA_COVER or
143fa7767c5Sopenharmony_ci                           tagCharSeq == Tag::AUDIO_VIVID_METADATA or
144fa7767c5Sopenharmony_ci                           tagCharSeq == Tag::AUDIO_VORBIS_IDENTIFICATION_HEADER or
145fa7767c5Sopenharmony_ci                           tagCharSeq == Tag::AUDIO_VORBIS_SETUP_HEADER or
146fa7767c5Sopenharmony_ci                           tagCharSeq == Tag::OH_MD_KEY_AUDIO_VIVID_METADATA or
147fa7767c5Sopenharmony_ci                           tagCharSeq == Tag::DRM_CENC_INFO,
148fa7767c5Sopenharmony_ci                           std::vector<uint8_t>, AnyValueType::VECTOR_UINT8);
149fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::AUDIO_CHANNEL_LAYOUT or
150fa7767c5Sopenharmony_ci                           tagCharSeq == Tag::AUDIO_OUTPUT_CHANNEL_LAYOUT,
151fa7767c5Sopenharmony_ci                           Plugins::AudioChannelLayout, AnyValueType::INT64_T);
152fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::AUDIO_SAMPLE_FORMAT, Plugins::AudioSampleFormat,
153fa7767c5Sopenharmony_ci                           AnyValueType::INT32_T);
154fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::AUDIO_AAC_PROFILE, Plugins::AudioAacProfile, AnyValueType::UINT8_T);
155fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::AUDIO_AAC_STREAM_FORMAT, Plugins::AudioAacStreamFormat,
156fa7767c5Sopenharmony_ci                           AnyValueType::UINT8_T);
157fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_PIXEL_FORMAT, Plugins::VideoPixelFormat,
158fa7767c5Sopenharmony_ci                           AnyValueType::INT32_T);
159fa7767c5Sopenharmony_ci//    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::MEDIA_SEEKABLE), Plugins::Seekable);
160fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::MEDIA_TYPE, Plugins::MediaType, AnyValueType::INT32_T);
161fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_BIT_STREAM_FORMAT, std::vector<Plugins::VideoBitStreamFormat>,
162fa7767c5Sopenharmony_ci                           AnyValueType::VECTOR_UINT32);
163fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_H264_PROFILE, Plugins::VideoH264Profile,
164fa7767c5Sopenharmony_ci                           AnyValueType::INT32_T);
165fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_ROTATION, Plugins::VideoRotation, AnyValueType::INT32_T);
166fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_ORIENTATION_TYPE, Plugins::VideoOrientationType,
167fa7767c5Sopenharmony_ci                           AnyValueType::INT32_T);
168fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_COLOR_PRIMARIES, Plugins::ColorPrimary,
169fa7767c5Sopenharmony_ci                           AnyValueType::INT32_T);
170fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_COLOR_TRC, Plugins::TransferCharacteristic,
171fa7767c5Sopenharmony_ci                           AnyValueType::INT32_T);
172fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_COLOR_MATRIX_COEFF, Plugins::MatrixCoefficient,
173fa7767c5Sopenharmony_ci                           AnyValueType::INT32_T);
174fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_ENCODE_BITRATE_MODE,
175fa7767c5Sopenharmony_ci        Plugins::VideoEncodeBitrateMode, AnyValueType::INT32_T);
176fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_COLOR_RANGE or
177fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_REQUEST_I_FRAME or
178fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_IS_HDR_VIVID or
179fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_HAS_VIDEO or
180fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_HAS_AUDIO or
181fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_HAS_SUBTITLE or
182fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_HAS_TIMEDMETA or
183fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_END_OF_STREAM or
184fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_PER_FRAME_MARK_LTR or
185fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_FRAME_RATE_ADAPTIVE_MODE or
186fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITY or
187fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_ENABLE_PARAMS_FEEDBACK or
188fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_PER_FRAME_IS_LTR or
189fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_PER_FRAME_IS_SKIP or
190fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENABLE_LOW_LATENCY or
191fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_ENABLE_SURFACE_INPUT_CALLBACK or
192fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_USER_AGREE or
193fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_REQURE_MIC or
194fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_ENABLE_MIC or
195fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_IS_DRM_PROTECTED or
196fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_DOWNLOAD_TIME_OUT or
197fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_PER_FRAME_DISCARD or
198fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_ENABLE_WATERMARK, bool, AnyValueType::BOOL);
199fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_BUFFER_CAN_DROP, bool, AnyValueType::BOOL);
200fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::AUDIO_RENDER_SET_FLAG, bool, AnyValueType::BOOL);
201fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_H265_PROFILE, Plugins::HEVCProfile, AnyValueType::INT32_T);
202fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_H265_LEVEL, Plugins::HEVCLevel, AnyValueType::INT32_T);
203fa7767c5Sopenharmony_ci
204fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_CHROMA_LOCATION,
205fa7767c5Sopenharmony_ci        Plugins::ChromaLocation, AnyValueType::INT32_T);
206fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODE,
207fa7767c5Sopenharmony_ci                           Plugins::TemporalGopReferenceMode, AnyValueType::INT32_T);
208fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::APP_UID or
209fa7767c5Sopenharmony_ci        tagCharSeq == Tag::APP_PID or
210fa7767c5Sopenharmony_ci        tagCharSeq == Tag::APP_TOKEN_ID or
211fa7767c5Sopenharmony_ci        tagCharSeq == Tag::REQUIRED_IN_BUFFER_CNT or
212fa7767c5Sopenharmony_ci        tagCharSeq == Tag::REQUIRED_IN_BUFFER_SIZE or
213fa7767c5Sopenharmony_ci        tagCharSeq == Tag::REQUIRED_OUT_BUFFER_CNT or
214fa7767c5Sopenharmony_ci        tagCharSeq == Tag::REQUIRED_OUT_BUFFER_SIZE or
215fa7767c5Sopenharmony_ci        tagCharSeq == Tag::BUFFERING_SIZE or
216fa7767c5Sopenharmony_ci        tagCharSeq == Tag::WATERLINE_HIGH or
217fa7767c5Sopenharmony_ci        tagCharSeq == Tag::WATERLINE_LOW or
218fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_CHANNEL_COUNT or
219fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_SAMPLE_RATE or
220fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_SAMPLE_PER_FRAME or
221fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_OUTPUT_CHANNELS or
222fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_MPEG_VERSION or
223fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_MPEG_LAYER or
224fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_AAC_LEVEL or
225fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_MAX_INPUT_SIZE or
226fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_MAX_OUTPUT_SIZE or
227fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_WIDTH or
228fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_HEIGHT or
229fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_DELAY or
230fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_MAX_SURFACE_NUM or
231fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_H264_LEVEL or
232fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_TRACK_COUNT or
233fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_AAC_IS_ADTS or
234fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_COMPRESSION_LEVEL or
235fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_BITS_PER_CODED_SAMPLE or
236fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_BITS_PER_RAW_SAMPLE or
237fa7767c5Sopenharmony_ci        tagCharSeq == Tag::REGULAR_TRACK_ID or
238fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_SCALE_TYPE or
239fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_I_FRAME_INTERVAL or
240fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_PROFILE or
241fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODE_QUALITY or
242fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_AAC_SBR or
243fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_FLAC_COMPLIANCE_LEVEL or
244fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AUDIO_OBJECT_NUMBER or
245fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_LEVEL or
246fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_STRIDE or
247fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_DISPLAY_WIDTH or
248fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_DISPLAY_HEIGHT or
249fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_PIC_WIDTH or
250fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_PIC_HEIGHT or
251fa7767c5Sopenharmony_ci        tagCharSeq == Tag::OH_MD_KEY_AUDIO_OBJECT_NUMBER or
252fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_ERROR_CODE, int32_t, AnyValueType::INT32_T);
253fa7767c5Sopenharmony_ci
254fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
255fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_TEMPORAL_GOP_SIZE or
256fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_LTR_FRAME_COUNT or
257fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_PER_FRAME_POC or
258fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_PER_FRAME_USE_LTR or
259fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_CROP_TOP or
260fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_CROP_BOTTOM or
261fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_CROP_LEFT or
262fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_CROP_RIGHT or
263fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_SLICE_HEIGHT or
264fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_QP_MAX or
265fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_QP_MIN or
266fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_QP_START or
267fa7767c5Sopenharmony_ci        tagCharSeq == Tag::FEATURE_PROPERTY_VIDEO_ENCODER_MAX_LTR_FRAME_COUNT or
268fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_ERR_CODE or
269fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_DURATION or
270fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_START_LATENCY or
271fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_ERR_CODE or
272fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_DURATION or
273fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_VIDEO_BITRATE or
274fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_AUDIO_SAMPLE_RATE or
275fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_AUDIO_CHANNEL_COUNT or
276fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_AUDIO_BITRATE or
277fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_START_LATENCY, int32_t, AnyValueType::INT32_T);
278fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
279fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_DECODER_RATE_UPPER_LIMIT or
280fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_FRAME_I_RATIO or
281fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_FRAME_MADI or
282fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_FRAME_MADP or
283fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_SUM_MADI or
284fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_REAL_BITRATE or
285fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_FRAME_QP or
286fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_QP_AVERAGE or
287fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_FRAME_TEMPORAL_ID or
288fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_ERR_CODE or
289fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_PLAY_DURATION or
290fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_SOURCE_TYPE or
291fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_AVG_DOWNLOAD_RATE or
292fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_VIDEO_BITRATE or
293fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_AUDIO_BITRATE or
294fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_START_LATENCY or
295fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_AVG_DOWNLOAD_SPEED or
296fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_MAX_SEEK_LATENCY or
297fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_MAX_ACCURATE_SEEK_LATENCY or
298fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_LAG_TIMES or
299fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_MAX_LAG_DURATION or
300fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_AVG_LAG_DURATION or
301fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_MAX_SURFACESWAP_LATENCY, int32_t, AnyValueType::INT32_T);
302fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
303fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_COORDINATE_X or
304fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_COORDINATE_Y or
305fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_COORDINATE_W or
306fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_COORDINATE_H or
307fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER or
308fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT, int32_t, AnyValueType::INT32_T);
309fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
310fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_ERR_CODE or
311fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SOURCE_DURATION or
312fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_TRANSCODER_DURATION or
313fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_VIDEO_BITRATE or
314fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_HDR_TYPE or
315fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_AUDIO_SAMPLE_RATE or
316fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_AUDIO_CHANNEL_COUNT or
317fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_AUDIO_BITRATE or
318fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_VIDEO_BITRATE or
319fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_HDR_TYPE or
320fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_AUDIO_SAMPLE_RATE or
321fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_AUDIO_CHANNEL_COUNT or
322fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_AUDIO_BITRATE or
323fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_VIDEO_DECODER_DURATION or
324fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_VIDEO_ENCODER_DURATION or
325fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_VIDEO_VPE_DURATION, int32_t, AnyValueType::INT32_T);
326fa7767c5Sopenharmony_ci
327fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
328fa7767c5Sopenharmony_ci        tagCharSeq == Tag::APP_FULL_TOKEN_ID or
329fa7767c5Sopenharmony_ci        tagCharSeq == Tag::BUFFER_DECODING_TIMESTAMP or
330fa7767c5Sopenharmony_ci        tagCharSeq == Tag::BUFFER_DURATION or
331fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_DURATION or
332fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_BITRATE or
333fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_START_TIME or
334fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_CONTAINER_START_TIME or
335fa7767c5Sopenharmony_ci        tagCharSeq == Tag::USER_FRAME_PTS or
336fa7767c5Sopenharmony_ci        tagCharSeq == Tag::USER_PUSH_DATA_TIME or
337fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_FILE_SIZE or
338fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_POSITION or
339fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_TIME_STAMP or
340fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_DECODER_DESIRED_PRESENT_TIMESTAMP, int64_t, AnyValueType::INT64_T);
341fa7767c5Sopenharmony_ci
342fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
343fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_DOWNLOAD_TOTAL_BITS, uint64_t, AnyValueType::UINT64_T);
344fa7767c5Sopenharmony_ci
345fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::MEDIA_LATITUDE or
346fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_LONGITUDE or
347fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_VIDEO_FRAMERATE, float, AnyValueType::FLOAT);
348fa7767c5Sopenharmony_ci
349fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::VIDEO_FRAME_RATE or
350fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_CAPTURE_RATE or
351fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_SAR or
352fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_ENCODER_MSE, double, AnyValueType::DOUBLE);
353fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
354fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_VIDEO_FRAME_RATE or
355fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_VIDEO_FRAME_RATE, double, AnyValueType::DOUBLE);
356fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(tagCharSeq == Tag::MEDIA_FILE_TYPE, Plugins::FileType, AnyValueType::INT32_T);
357fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
358fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_DECRYPT_AVG_SIZE or
359fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_DECRYPT_AVG_DURATION or
360fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_DECRYPT_MAX_SIZE or
361fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_DECRYPT_MAX_DURATION or
362fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_DECRYPT_TIMES, uint32_t, AnyValueType::UINT32_T);
363fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
364fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MIME_TYPE or
365fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_FILE_URI or
366fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_TITLE or
367fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_ARTIST or
368fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_LYRICIST or
369fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_ALBUM or
370fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_ALBUM_ARTIST or
371fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_DATE or
372fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_COMMENT or
373fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_GENRE or
374fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_COPYRIGHT or
375fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_LANGUAGE or
376fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_DESCRIPTION or
377fa7767c5Sopenharmony_ci        tagCharSeq == Tag::USER_TIME_SYNC_RESULT or
378fa7767c5Sopenharmony_ci        tagCharSeq == Tag::USER_AV_SYNC_GROUP_INFO or
379fa7767c5Sopenharmony_ci        tagCharSeq == Tag::USER_SHARED_MEMORY_FD or
380fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_AUTHOR or
381fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_COMPOSER or
382fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_LYRICS or
383fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_CREATION_TIME or
384fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_CODEC_NAME or
385fa7767c5Sopenharmony_ci        tagCharSeq == Tag::PROCESS_NAME or
386fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_ERR_MSG or
387fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_VIDEO_RESOLUTION or
388fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_APP_NAME or
389fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_INSTANCE_ID or
390fa7767c5Sopenharmony_ci        tagCharSeq == Tag::DRM_ERROR_MESG or
391fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_ERR_MSG or
392fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_CONTAINER_MIME or
393fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_VIDEO_MIME or
394fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_VIDEO_RESOLUTION or
395fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_AUDIO_MIME or
396fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_ERR_MSG or
397fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_CONTAINER_MIME or
398fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_VIDEO_MIME or
399fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_VIDEO_RESOLUTION or
400fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_AUDIO_MIME, std::string, AnyValueType::STRING);
401fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
402fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_ERR_MSG or
403fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_FORMAT or
404fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_AUDIO_MIME or
405fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_SRC_VIDEO_MIME or
406fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_FORMAT or
407fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_AUDIO_MIME or
408fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_TRANSCODER_DST_VIDEO_MIME, std::string, AnyValueType::STRING);
409fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
410fa7767c5Sopenharmony_ci        tagCharSeq == Tag::RECORDER_HDR_TYPE, int8_t, AnyValueType::INT8_T);
411fa7767c5Sopenharmony_ci
412fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
413fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_AV_TYPE or
414fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_DATA_TYPE or
415fa7767c5Sopenharmony_ci        tagCharSeq == Tag::SCREEN_CAPTURE_STOP_REASON, uint8_t, AnyValueType::UINT8_T);
416fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
417fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_VIDEO_BITDEPTH or
418fa7767c5Sopenharmony_ci        tagCharSeq == Tag::AV_PLAYER_HDR_TYPE, int8_t, AnyValueType::INT8_T);
419fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
420fa7767c5Sopenharmony_ci        tagCharSeq == Tag::MEDIA_AVAILABLE_BITRATES, std::vector<uint8_t>, AnyValueType::VECTOR_UINT8);
421fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
422fa7767c5Sopenharmony_ci        tagCharSeq == Tag::TIMED_METADATA_SRC_TRACK_MIME or
423fa7767c5Sopenharmony_ci        tagCharSeq == Tag::TIMED_METADATA_KEY or
424fa7767c5Sopenharmony_ci        tagCharSeq == Tag::TIMED_METADATA_LOCALE or
425fa7767c5Sopenharmony_ci        tagCharSeq == Tag::TIMED_METADATA_SETUP, std::string, AnyValueType::STRING);
426fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
427fa7767c5Sopenharmony_ci        tagCharSeq == Tag::TIMED_METADATA_SRC_TRACK, int32_t, AnyValueType::INT32_T);
428fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
429fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_DECODER_OUTPUT_COLOR_SPACE, int32_t, AnyValueType::INT32_T);
430fa7767c5Sopenharmony_ci    DEFINE_INSERT_GET_FUNC(
431fa7767c5Sopenharmony_ci        tagCharSeq == Tag::VIDEO_DECODER_ENABLE_VRR, int32_t, AnyValueType::INT32_T);
432fa7767c5Sopenharmony_ci
433fa7767c5Sopenharmony_ci    Meta &operator=(const Meta &other)
434fa7767c5Sopenharmony_ci    {
435fa7767c5Sopenharmony_ci        map_ = other.map_;
436fa7767c5Sopenharmony_ci        return *this;
437fa7767c5Sopenharmony_ci    }
438fa7767c5Sopenharmony_ci
439fa7767c5Sopenharmony_ci    Meta &operator=(Meta &&other)
440fa7767c5Sopenharmony_ci    {
441fa7767c5Sopenharmony_ci        swap(map_, other.map_);
442fa7767c5Sopenharmony_ci        return *this;
443fa7767c5Sopenharmony_ci    }
444fa7767c5Sopenharmony_ci
445fa7767c5Sopenharmony_ci    Meta() {
446fa7767c5Sopenharmony_ci    };
447fa7767c5Sopenharmony_ci
448fa7767c5Sopenharmony_ci    Meta(const Meta &other)
449fa7767c5Sopenharmony_ci    {
450fa7767c5Sopenharmony_ci        map_ = other.map_;
451fa7767c5Sopenharmony_ci    }
452fa7767c5Sopenharmony_ci
453fa7767c5Sopenharmony_ci    Meta(Meta &&other)
454fa7767c5Sopenharmony_ci    {
455fa7767c5Sopenharmony_ci        swap(map_, other.map_);
456fa7767c5Sopenharmony_ci    }
457fa7767c5Sopenharmony_ci
458fa7767c5Sopenharmony_ci    Any& operator[](const TagType& tag)
459fa7767c5Sopenharmony_ci    {
460fa7767c5Sopenharmony_ci        return map_[tag];
461fa7767c5Sopenharmony_ci    }
462fa7767c5Sopenharmony_ci
463fa7767c5Sopenharmony_ci    Any& operator[](TagTypeCharSeq tag)
464fa7767c5Sopenharmony_ci    {
465fa7767c5Sopenharmony_ci        return map_[tag];
466fa7767c5Sopenharmony_ci    }
467fa7767c5Sopenharmony_ci
468fa7767c5Sopenharmony_ci    MapIt begin() const // to support for (auto e : Meta), must use begin/end name
469fa7767c5Sopenharmony_ci    {
470fa7767c5Sopenharmony_ci        return map_.cbegin();
471fa7767c5Sopenharmony_ci    }
472fa7767c5Sopenharmony_ci
473fa7767c5Sopenharmony_ci    MapIt end() const
474fa7767c5Sopenharmony_ci    {
475fa7767c5Sopenharmony_ci        return map_.cend();
476fa7767c5Sopenharmony_ci    }
477fa7767c5Sopenharmony_ci
478fa7767c5Sopenharmony_ci    void Clear()
479fa7767c5Sopenharmony_ci    {
480fa7767c5Sopenharmony_ci        map_.clear();
481fa7767c5Sopenharmony_ci    }
482fa7767c5Sopenharmony_ci
483fa7767c5Sopenharmony_ci    MapIt Find(TagType tag) const
484fa7767c5Sopenharmony_ci    {
485fa7767c5Sopenharmony_ci        return map_.find(tag);
486fa7767c5Sopenharmony_ci    }
487fa7767c5Sopenharmony_ci
488fa7767c5Sopenharmony_ci    MapIt Find(TagTypeCharSeq tag) const
489fa7767c5Sopenharmony_ci    {
490fa7767c5Sopenharmony_ci        return map_.find(tag);
491fa7767c5Sopenharmony_ci    }
492fa7767c5Sopenharmony_ci
493fa7767c5Sopenharmony_ci    bool Empty() const
494fa7767c5Sopenharmony_ci    {
495fa7767c5Sopenharmony_ci        return map_.empty();
496fa7767c5Sopenharmony_ci    }
497fa7767c5Sopenharmony_ci
498fa7767c5Sopenharmony_ci    template <typename T>
499fa7767c5Sopenharmony_ci    void SetData(const TagType& tag, const T& value)
500fa7767c5Sopenharmony_ci    {
501fa7767c5Sopenharmony_ci        map_[tag] = value;
502fa7767c5Sopenharmony_ci    }
503fa7767c5Sopenharmony_ci
504fa7767c5Sopenharmony_ci    template <typename T>
505fa7767c5Sopenharmony_ci    void SetData(TagTypeCharSeq tag, const T& value)
506fa7767c5Sopenharmony_ci    {
507fa7767c5Sopenharmony_ci        if (tag == nullptr) {
508fa7767c5Sopenharmony_ci            return;
509fa7767c5Sopenharmony_ci        }
510fa7767c5Sopenharmony_ci        map_[tag] = value;
511fa7767c5Sopenharmony_ci    }
512fa7767c5Sopenharmony_ci
513fa7767c5Sopenharmony_ci    template <int N>
514fa7767c5Sopenharmony_ci    void SetData(const TagType &tag, char const (&value)[N])
515fa7767c5Sopenharmony_ci    {
516fa7767c5Sopenharmony_ci        std::string strValue = value;
517fa7767c5Sopenharmony_ci        map_[tag] = std::move(strValue);
518fa7767c5Sopenharmony_ci    }
519fa7767c5Sopenharmony_ci
520fa7767c5Sopenharmony_ci    template <int N>
521fa7767c5Sopenharmony_ci    void SetData(TagTypeCharSeq tag, char const (&value)[N])
522fa7767c5Sopenharmony_ci    {
523fa7767c5Sopenharmony_ci        if (tag == nullptr) {
524fa7767c5Sopenharmony_ci            return;
525fa7767c5Sopenharmony_ci        }
526fa7767c5Sopenharmony_ci        std::string strValue = value;
527fa7767c5Sopenharmony_ci        map_[tag] = std::move(strValue);
528fa7767c5Sopenharmony_ci    }
529fa7767c5Sopenharmony_ci
530fa7767c5Sopenharmony_ci    template <typename T>
531fa7767c5Sopenharmony_ci    bool GetData(const TagType& tag, T &value) const
532fa7767c5Sopenharmony_ci    {
533fa7767c5Sopenharmony_ci        auto iter = map_.find(tag);
534fa7767c5Sopenharmony_ci        if (iter == map_.end() || !Any::IsSameTypeWith<T>(iter->second)) {
535fa7767c5Sopenharmony_ci            return false;
536fa7767c5Sopenharmony_ci        }
537fa7767c5Sopenharmony_ci        value = AnyCast<T>(iter->second);
538fa7767c5Sopenharmony_ci        return true;
539fa7767c5Sopenharmony_ci    }
540fa7767c5Sopenharmony_ci
541fa7767c5Sopenharmony_ci    template <typename T>
542fa7767c5Sopenharmony_ci    bool GetData(TagTypeCharSeq tag, T &value) const
543fa7767c5Sopenharmony_ci    {
544fa7767c5Sopenharmony_ci        auto iter = map_.find(tag);
545fa7767c5Sopenharmony_ci        if (iter == map_.end() || !Any::IsSameTypeWith<T>(iter->second)) {
546fa7767c5Sopenharmony_ci            return false;
547fa7767c5Sopenharmony_ci        }
548fa7767c5Sopenharmony_ci        value = AnyCast<T>(iter->second);
549fa7767c5Sopenharmony_ci        return true;
550fa7767c5Sopenharmony_ci    }
551fa7767c5Sopenharmony_ci
552fa7767c5Sopenharmony_ci    void Remove(const TagType& tag)
553fa7767c5Sopenharmony_ci    {
554fa7767c5Sopenharmony_ci        auto iter = map_.find(tag);
555fa7767c5Sopenharmony_ci        if (iter != map_.end()) {
556fa7767c5Sopenharmony_ci            map_.erase(iter);
557fa7767c5Sopenharmony_ci        }
558fa7767c5Sopenharmony_ci    }
559fa7767c5Sopenharmony_ci
560fa7767c5Sopenharmony_ci    void Remove(TagTypeCharSeq tag)
561fa7767c5Sopenharmony_ci    {
562fa7767c5Sopenharmony_ci        auto iter = map_.find(tag);
563fa7767c5Sopenharmony_ci        if (iter != map_.end()) {
564fa7767c5Sopenharmony_ci            map_.erase(iter);
565fa7767c5Sopenharmony_ci        }
566fa7767c5Sopenharmony_ci    }
567fa7767c5Sopenharmony_ci
568fa7767c5Sopenharmony_ci    void GetKeys(std::vector<TagType>& keys) const
569fa7767c5Sopenharmony_ci    {
570fa7767c5Sopenharmony_ci        int cnt = 0;
571fa7767c5Sopenharmony_ci        keys.resize(map_.size());
572fa7767c5Sopenharmony_ci        for (const auto& tmp : map_) {
573fa7767c5Sopenharmony_ci            keys[cnt++] = tmp.first;
574fa7767c5Sopenharmony_ci        }
575fa7767c5Sopenharmony_ci    }
576fa7767c5Sopenharmony_ci
577fa7767c5Sopenharmony_ci    AnyValueType GetValueType(const TagType& key) const;
578fa7767c5Sopenharmony_ci    bool ToParcel(MessageParcel &parcel) const;
579fa7767c5Sopenharmony_ci    bool FromParcel(MessageParcel &parcel);
580fa7767c5Sopenharmony_ci
581fa7767c5Sopenharmony_ciprivate:
582fa7767c5Sopenharmony_ci    std::map<TagType, Any> map_;
583fa7767c5Sopenharmony_ci};
584fa7767c5Sopenharmony_ci
585fa7767c5Sopenharmony_ci/**
586fa7767c5Sopenharmony_ci * @brief SetMetaData only used for Application interface OH_AVFormat to set enum/bool/int32_t value into Meta Object.
587fa7767c5Sopenharmony_ci * @implNote In order to set value(int32_t type) to Meta Object, should convert int32_t value to correct EnumType then
588fa7767c5Sopenharmony_ci * save to Any object. We use metadataGetterSetterMap to get the right setter function.
589fa7767c5Sopenharmony_ci * @return Returns operator status, <b>True</b> if Set Success.
590fa7767c5Sopenharmony_ci * returns <b>False</b> otherwise.
591fa7767c5Sopenharmony_ci * @example OHOS::Media::SetMetaData(meta, "audio.aac.profile", value);
592fa7767c5Sopenharmony_ci */
593fa7767c5Sopenharmony_cibool SetMetaData(Meta& meta, const TagType& tag, int32_t value);
594fa7767c5Sopenharmony_ci
595fa7767c5Sopenharmony_ci/**
596fa7767c5Sopenharmony_ci * @brief GetMetaData only used for Application interface OH_AVFormat to get enum/bool/int32_t value from Meta Object.
597fa7767c5Sopenharmony_ci * @implNote In order to get value(Enum type) from Meta Object, should use correct Enum type to get value from Any
598fa7767c5Sopenharmony_ci * object. We use metadataGetterSetterMap to get the right getter function.
599fa7767c5Sopenharmony_ci * @return Returns operator status, <b>True</b> if Get Success.
600fa7767c5Sopenharmony_ci * returns <b>False</b> otherwise.
601fa7767c5Sopenharmony_ci * @example OHOS::Media::GetMetaData(meta, "audio.aac.profile", value);
602fa7767c5Sopenharmony_ci */
603fa7767c5Sopenharmony_cibool GetMetaData(const Meta& meta, const TagType& tag, int32_t& value);
604fa7767c5Sopenharmony_ci/**
605fa7767c5Sopenharmony_ci * @brief SetMetaData only used for Application interface OH_AVFormat to set enum/int64_t value into Meta Object.
606fa7767c5Sopenharmony_ci * @implNote In order to set value(int64_t type) to Meta Object, should convert int64_t value to correct EnumType then
607fa7767c5Sopenharmony_ci * save to Any object. We use metadataGetterSetterMap to get the right setter function.
608fa7767c5Sopenharmony_ci * @return Returns operator status, <b>True</b> if Set Success.
609fa7767c5Sopenharmony_ci * returns <b>False</b> otherwise.
610fa7767c5Sopenharmony_ci * @example OHOS::Media::SetMetaData(meta, "audio.aac.profile", value);
611fa7767c5Sopenharmony_ci */
612fa7767c5Sopenharmony_cibool SetMetaData(Meta& meta, const TagType& tag, int64_t value);
613fa7767c5Sopenharmony_ci
614fa7767c5Sopenharmony_ci/**
615fa7767c5Sopenharmony_ci * @brief GetMetaData only used for Application interface OH_AVFormat to get enum/int64_t value from Meta Object.
616fa7767c5Sopenharmony_ci * @implNote In order to get value(Enum type) from Meta Object, should use correct Enum type to get value from Any
617fa7767c5Sopenharmony_ci * object. We use metadataGetterSetterMap to get the right getter function.
618fa7767c5Sopenharmony_ci * @return Returns operator status, <b>True</b> if Get Success.
619fa7767c5Sopenharmony_ci * returns <b>False</b> otherwise.
620fa7767c5Sopenharmony_ci * @example OHOS::Media::GetMetaData(meta, "audio.aac.profile", value);
621fa7767c5Sopenharmony_ci */
622fa7767c5Sopenharmony_cibool GetMetaData(const Meta& meta, const TagType& tag, int64_t& value);
623fa7767c5Sopenharmony_ci
624fa7767c5Sopenharmony_ci/**
625fa7767c5Sopenharmony_ci * @brief IsIntEnum only used for Application interface OH_AVFormat to judge key's value type is int32_t or not.
626fa7767c5Sopenharmony_ci * @implNote In order to get value(Enum type) from Meta Object, should use correct Enum type to get value from Any
627fa7767c5Sopenharmony_ci * object. We use metadataGetterSetterMap to get the value type.
628fa7767c5Sopenharmony_ci * @return Returns operator status, <b>True</b> if the key's value type is int32_t.
629fa7767c5Sopenharmony_ci * returns <b>False</b> otherwise.
630fa7767c5Sopenharmony_ci * @example OHOS::Media::IsIntEnum("audio.aac.profile");
631fa7767c5Sopenharmony_ci */
632fa7767c5Sopenharmony_cibool IsIntEnum(const TagType& tag);
633fa7767c5Sopenharmony_ci
634fa7767c5Sopenharmony_ci/**
635fa7767c5Sopenharmony_ci * @brief IsIntEnum only used for Application interface OH_AVFormat to judge key's value type is int64_t or not.
636fa7767c5Sopenharmony_ci * @implNote In order to get value(Enum type) from Meta Object, should use correct Enum type to get value from Any
637fa7767c5Sopenharmony_ci * object. We use metadataGetterSetterMap to get the value type.
638fa7767c5Sopenharmony_ci * @return Returns operator status, <b>True</b> if the key's value type is int64_t.
639fa7767c5Sopenharmony_ci * returns <b>False</b> otherwise.
640fa7767c5Sopenharmony_ci * @example OHOS::Media::IsIntEnum("audio.aac.profile");
641fa7767c5Sopenharmony_ci */
642fa7767c5Sopenharmony_cibool IsLongEnum(const TagType& tag);
643fa7767c5Sopenharmony_ci} // namespace Media
644fa7767c5Sopenharmony_ci} // namespace OHOS
645fa7767c5Sopenharmony_ci#endif // MEDIA_FOUNDATION_META_H