• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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_DESCRIPTION_H
17 #define MEDIA_DESCRIPTION_H
18 
19 #include "format.h"
20 
21 namespace OHOS {
22 namespace Media {
23 /**
24  * @brief Provides the uniform container for storing the media description.
25  */
26 using MediaDescription = Format;
27 
28 /**
29  * @brief Provides the key's definition for MediaDescription.
30  */
31 class MediaDescriptionKey {
32 public:
33     /**
34      * Key for track index, value type is uint32_t
35      */
36     static constexpr std::string_view MD_KEY_TRACK_INDEX = "track_index";
37 
38     /**
39      * Key for track type, value type is uint8_t, see {link @MediaTrackType}
40      */
41     static constexpr std::string_view MD_KEY_TRACK_TYPE = "track_type";
42 
43     /**
44      * Key for codec mime type, value type is string
45      */
46     static constexpr std::string_view MD_KEY_CODEC_MIME = "codec_mime";
47 
48     /**
49      * Key for duration, value type is int64_t
50      */
51     static constexpr std::string_view MD_KEY_DURATION = "duration";
52 
53     /**
54      * Key for bitrate, value type is uint32_t
55      */
56     static constexpr std::string_view MD_KEY_BITRATE = "bitrate";
57 
58     /**
59      * Key for max input size, value type is uint32_t
60      */
61     static constexpr std::string_view MD_KEY_MAX_INPUT_SIZE = "max_input_size";
62 
63     /**
64      * Key for video width, value type is uint32_t
65      */
66     static constexpr std::string_view MD_KEY_WIDTH = "width";
67 
68     /**
69      * Key for video height, value type is uint32_t
70      */
71     static constexpr std::string_view MD_KEY_HEIGHT = "height";
72 
73     /**
74      * Key for video pixelformat, value type is int32_t, see {link @MediaPixelFormat}
75      */
76     static constexpr std::string_view MD_KEY_PIXEL_FORMAT = "pixel_format";
77 
78     /**
79      * Key for video frame rate, value type is double.
80      */
81     static constexpr std::string_view MD_KEY_FRAME_RATE = "frame_rate";
82 
83     /**
84      * Key for video capture rate, value type is double
85      */
86     static constexpr std::string_view MD_KEY_CAPTURE_RATE = "capture_rate";
87 
88     /**
89      * Key for the interval of key frame. value type is int32_t, the unit is milliseconds.
90      * A negative value means no key frames are requested after the first frame. A zero
91      * value means a stream containing all key frames is requested.
92      */
93     static constexpr std::string_view MD_KEY_I_FRAME_INTERVAL = "i_frame_interval";
94 
95     /**
96      * Key for the request a I-Frame immediately. value type is boolean
97      */
98     static constexpr std::string_view MD_KEY_REQUEST_I_FRAME = "req_i_frame";
99 
100     /**
101      * Key for audio channel count, value type is uint32_t
102      */
103     static constexpr std::string_view MD_KEY_CHANNEL_COUNT = "channel_count";
104 
105     /**
106      * Key for audio sample rate, value type is uint32_t
107      */
108     static constexpr std::string_view MD_KEY_SAMPLE_RATE = "sample_rate";
109 
110     /**
111      * Key for track count in the container, value type is uint32_t
112      */
113     static constexpr std::string_view MD_KEY_TRACK_COUNT = "track_count";
114 
115     /**
116      * Key for container format type, value type is string
117      */
118     static constexpr std::string_view MD_KEY_CONTAINER_FORMAT = "container_format";
119 
120     /**
121      * custom key prefix, media service will pass through to HAL.
122      */
123     static constexpr std::string_view MD_KEY_CUSTOM_PREFIX = "vendor.custom";
124 
125 private:
126     MediaDescriptionKey() = delete;
127     ~MediaDescriptionKey() = delete;
128 };
129 } // namespace Media
130 } // namespace OHOS
131 #endif // MEDIA_DESCRIPTION_H
132