• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2021 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 MEDIA_FOUNDATION_META_KEY_H
17 #define MEDIA_FOUNDATION_META_KEY_H
18 
19 #include "meta/any.h"
20 
21 namespace OHOS {
22 namespace Media {
23 class Tag {
24 public:
25     /* -------------------- regular tag -------------------- */
26     static constexpr const char REGULAR_TRACK_ID[] = "track_index"; ///< track id
27     static constexpr const char REQUIRED_IN_BUFFER_CNT[] =
28         "max_input_buffer_count"; ///< required buffer count of plugin; read only tag
29     static constexpr const char REQUIRED_IN_BUFFER_SIZE[] =
30         "max_input_size"; ///< required buffer size of plugin; read only tag
31     static constexpr const char REQUIRED_OUT_BUFFER_CNT[] =
32         "max_output_buffer_count"; ///< required buffer count of plugin; read only tag
33     static constexpr const char REQUIRED_OUT_BUFFER_SIZE[] =
34         "regular.required.out.buffer.size"; ///< required buffer size of plugin; read only tag
35     static constexpr const char BUFFER_ALLOCATOR[] =
36         "regular.buffer.allocator";                                          ///< Allocator, allocator to alloc buffers
37     static constexpr const char BUFFERING_SIZE[] = "regular.buffering.size"; ///< download buffer size
38     static constexpr const char WATERLINE_HIGH[] = "regular.waterline.high"; ///< high waterline
39     static constexpr const char WATERLINE_LOW[] = "regular.waterline.low";   ///< low waterline
40     static constexpr const char SRC_INPUT_TYPE[] = "regular.src.input.type"; ///< SrcInputType
41     static constexpr const char APP_TOKEN_ID[] = "regular.app.token.id";     ///< app token id
42     static constexpr const char APP_FULL_TOKEN_ID[] = "regular.app.full.token.id"; ///< app full token id
43     static constexpr const char APP_UID[] = "regular.app.uid";                     ///< app uid
44     static constexpr const char APP_PID[] = "regular.app.pid";                     ///< app pid
45     static constexpr const char AUDIO_RENDER_INFO[] =
46         "regular.audio.render.info"; ///< AudioRenderInfo, audio render info
47     static constexpr const char AUDIO_INTERRUPT_MODE[] =
48         "regular.audio.interrupt.mode";                            ///< AudioInterruptMode, audio interrupt mode
49     static constexpr const char VIDEO_SCALE_TYPE[] = "scale_type"; ///< VideoScaleType, video scale type
50     static constexpr const char INPUT_MEMORY_TYPE[] = "regular.input.memory.type";   ///< MemoryType
51     static constexpr const char OUTPUT_MEMORY_TYPE[] = "regular.output.memory.type"; ///< MemoryType
52     static constexpr const char PROCESS_NAME[] = "process_name"; ///< string, process name
53 
54     /* -------------------- media tag -------------------- */
55     static constexpr const char MIME_TYPE[] = "codec_mime";            ///< @see MimeType
56     static constexpr const char MEDIA_CODEC_NAME[] = "codec_name";     ///< codec name
57     static constexpr const char MEDIA_TITLE[] = "title";               ///< title
58     static constexpr const char MEDIA_ARTIST[] = "artist";             ///< artist
59     static constexpr const char MEDIA_LYRICIST[] = "media.lyricist";   ///< lyricist
60     static constexpr const char MEDIA_ALBUM[] = "album";               ///< album
61     static constexpr const char MEDIA_ALBUM_ARTIST[] = "album_artist"; ///< album artist
62     static constexpr const char MEDIA_DATE[] = "date";                 ///< media date, format:YYYY-MM-DD
63     static constexpr const char MEDIA_COMMENT[] = "comment";           ///< comment
64     static constexpr const char MEDIA_GENRE[] = "genre";               ///< genre
65     static constexpr const char MEDIA_COPYRIGHT[] = "copyright";       ///< copyright
66     static constexpr const char MEDIA_LANGUAGE[] = "language";         ///< language
67     static constexpr const char MEDIA_DESCRIPTION[] = "description";   ///< description
68     static constexpr const char MEDIA_LYRICS[] = "lyrics";             ///< lyrics
69     static constexpr const char MEDIA_AUTHOR[] = "author";             ///< authoe
70     static constexpr const char MEDIA_COMPOSER[] = "composer";         ///< composer
71     static constexpr const char MEDIA_CREATION_TIME[] =
72         "creation_time"; ///< creation time, string as YYYY-MM-DD HH:MM:SS.XXX or now
73     static constexpr const char MEDIA_LATITUDE[] = "latitude";         ///< latitude, float
74     static constexpr const char MEDIA_LONGITUDE[] = "longitude";       ///< longitude, float
75     static constexpr const char MEDIA_DURATION[] = "duration";         ///< duration based on {@link HST_TIME_BASE}
76     static constexpr const char MEDIA_FILE_SIZE[] = "media.file.size"; ///< file size
77     static constexpr const char MEDIA_BITRATE[] = "bitrate";           ///< bite rate
78     static constexpr const char MEDIA_FILE_URI[] = "media.file.uri";   ///< file uri
79     static constexpr const char MEDIA_CODEC_CONFIG[] =
80         "codec_config"; ///< codec config. e.g. AudioSpecificConfig for mp4
81     static constexpr const char MEDIA_CODEC_MODE[] = "media.codec.mode"; ///< codec mode.
82     static constexpr const char MEDIA_POSITION[] = "media.position";     ///< The byte position within media stream/file
83     static constexpr const char MEDIA_START_TIME[] = "media.start.time"; ///< The start time of one track
84     static constexpr const char MEDIA_SEEKABLE[] = "media.seekable"; ///< enum Seekable: Seekable status of the media
85     static constexpr const char MEDIA_PLAYBACK_SPEED[] = "media.playback.speed"; ///< double, playback speed
86     static constexpr const char MEDIA_TYPE[] =
87         "track_type"; ///< enum MediaType: Audio Video Subtitle... int32_t, see {link @MediaTrackType}
88     static constexpr const char MEDIA_TRACK_COUNT[] = "track_count";           ///< track count in file
89     static constexpr const char MEDIA_FILE_TYPE[] = "file_type";               ///< @see FileType, track type
90     static constexpr const char MEDIA_STREAM_TYPE[] = "media.stream.type";     ///< stream type of track data
91     static constexpr const char MEDIA_HAS_VIDEO[] = "has_video";               ///< has video track in file
92     static constexpr const char MEDIA_HAS_AUDIO[] = "has_audio";               ///< has audio track in file
93     static constexpr const char MEDIA_COVER[] = "cover";                       ///< cover in file
94     static constexpr const char MEDIA_PROTOCOL_TYPE[] = "media.protocol.type"; ///< Source protocol type
95     static constexpr const char MEDIA_PROFILE[] = "codec_profile";             ///< codec profile, Compatible 4.0
96     static constexpr const char MEDIA_LEVEL[] = "codec_level";                 ///< codec level, Compatible 4.0
97     static constexpr const char MEDIA_TIME_STAMP[] = "timeStamp";              ///< time stamp
98     static constexpr const char MEDIA_END_OF_STREAM[] = "endOfStream";         ///< end of stream
99 
100     /* -------------------- audio universal tag -------------------- */
101     static constexpr const char AUDIO_CHANNEL_COUNT[] = "channel_count"; ///< audio channel count
102     static constexpr const char AUDIO_CHANNEL_LAYOUT[] =
103         "channel_layout";                                            ///< @see AudioChannelLayout, stream channel layout
104     static constexpr const char AUDIO_SAMPLE_RATE[] = "sample_rate"; ///< sample rate
105     static constexpr const char AUDIO_SAMPLE_FORMAT[] = "audio_sample_format";        ///< @see AudioSampleFormat
106     static constexpr const char AUDIO_SAMPLE_PER_FRAME[] = "audio_samples_per_frame"; ///< sample per frame
107     static constexpr const char AUDIO_OUTPUT_CHANNELS[] = "audio.output.channels";    ///< sink output channel num
108     static constexpr const char AUDIO_OUTPUT_CHANNEL_LAYOUT[] =
109         "audio.output.channel.layout"; ///< @see AudioChannelLayout, sink output channel layout
110     static constexpr const char AUDIO_COMPRESSION_LEVEL[] = "compression_level";         ///< compression level
111     static constexpr const char AUDIO_MAX_INPUT_SIZE[] = "audio.max.input.size";         ///< max input size
112     static constexpr const char AUDIO_MAX_OUTPUT_SIZE[] = "audio.max.output.size";       ///< max output size
113     static constexpr const char AUDIO_BITS_PER_CODED_SAMPLE[] = "bits_per_coded_sample"; ///< bits per coded sample
114 
115     /* -------------------- audio specific tag -------------------- */
116     static constexpr const char AUDIO_MPEG_VERSION[] = "audio.mpeg.version"; ///< mpeg version
117     static constexpr const char AUDIO_MPEG_LAYER[] = "audio.mpeg.layer";     ///< mpeg layer
118 
119     static constexpr const char AUDIO_AAC_PROFILE[] = "audio.aac.profile";             ///< @see AudioAacProfile
120     static constexpr const char AUDIO_AAC_LEVEL[] = "audio.aac.level";                 ///< acc level
121     static constexpr const char AUDIO_AAC_STREAM_FORMAT[] = "audio.aac.stream.format"; ///< @see AudioAacStreamFormat
122     static constexpr const char AUDIO_AAC_IS_ADTS[] = "aac_is_adts";                   ///< acc format is adts
123     static constexpr const char AUDIO_VIVID_METADATA[] = "audio.vivid.metadata";       ///< audio vivid metadata
124     static constexpr const char AUDIO_OBJECT_NUMBER[] = "audio.object.number";         ///< audio object number
125     static constexpr const char AUDIO_AAC_SBR[] = "sbr";                               ///< Key for aac sbr
126     static constexpr const char AUDIO_FLAC_COMPLIANCE_LEVEL[] = "compliance_level";    ///< Key for compliance level
127     static constexpr const char AUDIO_VORBIS_IDENTIFICATION_HEADER[] =
128         "identification_header";                                              ///< Key for vorbis identification header
129     static constexpr const char AUDIO_VORBIS_SETUP_HEADER[] = "setup_header"; ///< Key for vorbis setup header
130     static constexpr const char OH_MD_KEY_AUDIO_OBJECT_NUMBER[] =
131         "audio_object_number_key";                                            ///< Key for audio object number
132     static constexpr const char OH_MD_KEY_AUDIO_VIVID_METADATA[] =
133         "audio_vivid_metadata_key";                                           ///< Key for audio vivid metadata
134 
135     /* -------------------- video universal tag -------------------- */
136     static constexpr const char VIDEO_WIDTH[] = "width";                               ///< video width
137     static constexpr const char VIDEO_HEIGHT[] = "height";                             ///< video height
138     static constexpr const char VIDEO_PIXEL_FORMAT[] = "pixel_format";                 ///< @see VideoPixelFormat
139     static constexpr const char VIDEO_FRAME_RATE[] = "frame_rate";                     ///< video frame rate
140     static constexpr const char VIDEO_SURFACE[] = "video.surface";                     ///< @see class Surface
141     static constexpr const char VIDEO_MAX_SURFACE_NUM[] = "video.max.surface_num";     ///< max video surface num
142     static constexpr const char VIDEO_CAPTURE_RATE[] = "capture_rate";                 ///< double, video capture rate
143     static constexpr const char VIDEO_BIT_STREAM_FORMAT[] = "video.bit.stream.format"; ///< @see VideoBitStreamFormat
144     static constexpr const char VIDEO_ROTATION[] = "rotation_angle";                   ///< @see VideoRotation
145     static constexpr const char VIDEO_COLOR_PRIMARIES[] = "color_primaries";           ///< @see ColorPrimary
146     static constexpr const char VIDEO_COLOR_TRC[] = "transfer_characteristics";        ///< @see TransferCharacteristic
147     static constexpr const char VIDEO_COLOR_MATRIX_COEFF[] = "matrix_coefficients";    ///< @see MatrixCoefficient
148     static constexpr const char VIDEO_COLOR_RANGE[] = "range_flag";                    ///< bool, video color range
149     static constexpr const char VIDEO_IS_HDR_VIVID[] = "video_is_hdr_vivid";           ///< bool, video is hdr vivid
150     static constexpr const char VIDEO_STRIDE[] = "stride";                             ///< int32_t, video stride
151     static constexpr const char VIDEO_DISPLAY_WIDTH[] = "display_width";               ///< int32_t, video display width
152     static constexpr const char VIDEO_DISPLAY_HEIGHT[] = "display_height"; ///< int32_t, video display height
153     static constexpr const char VIDEO_FRAME_RATE_ADAPTIVE_MODE[] =
154         "frame_rate_adaptive_mode"; ///< bool, video is framerate adaptive mode
155     static constexpr const char VIDEO_DELAY[] = "video_delay";                         ///< video delay
156     static constexpr const char VIDEO_I_FRAME_INTERVAL[] = "i_frame_interval"; ///< Key for the interval of key frame.
157     static constexpr const char VIDEO_REQUEST_I_FRAME[] =
158         "req_i_frame"; ///<  Key for the request a I-Frame immediately.
159     static constexpr const char VIDEO_ENCODE_BITRATE_MODE[] =
160         "video_encode_bitrate_mode"; ///<  Key for video encode bitrate mode, see {link @VideoEncodeBitrateMode}
161     static constexpr const char VIDEO_ENCODE_QUALITY[] =
162         "quality"; ///<  key for the desired encoding quality,  this key is only supported for encoders that are
163                    ///<  configured in constant quality mode
164 
165     /* -------------------- video specific tag -------------------- */
166     static constexpr const char VIDEO_H264_PROFILE[] = "video.h264.profile"; ///< @see VideoH264Profile
167     static constexpr const char VIDEO_H264_LEVEL[] = "video.h264.level";     ///< h264 level
168     static constexpr const char VIDEO_H265_PROFILE[] = "video.h265.profile"; ///< @see HEVCProfile
169     static constexpr const char VIDEO_H265_LEVEL[] = "video.h265.level";     ///< @see HEVCLevel
170     static constexpr const char VIDEO_CHROMA_LOCATION[] = "chroma_location"; ///< @see ChromaLocation
171 
172     /* -------------------- user specific tag -------------------- */
173     static constexpr const char USER_FRAME_PTS[] = "user.frame.pts"; ///< The user frame pts
174     static constexpr const char USER_TIME_SYNC_RESULT[] =
175         "user.time.sync.result"; ///< std::string : The time sync result
176     static constexpr const char USER_AV_SYNC_GROUP_INFO[] =
177         "user.av.sync.group.info"; ///< std::string : The av sync group info
178     static constexpr const char USER_SHARED_MEMORY_FD[] =
179         "user.shared.memory.fd";                                               ///< std::string : The shared memory fd
180     static constexpr const char USER_PUSH_DATA_TIME[] = "user.push.data.time"; ///< The user push data time
181 
182     /* -------------------- drm tag -------------------- */
183     static constexpr const char DRM_CENC_INFO[] = "drm_cenc_info"; ///< drm cenc info
184 };
185 
186 using TagTypeCharSeq = const char *;
187 using TagType = std::string;
188 } // namespace Media
189 } // namespace OHOS
190 #endif // MEDIA_FOUNDATION_META_KEY_H
191