OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_VIDEO_CODECS_H_ | 5 #ifndef MEDIA_BASE_VIDEO_CODECS_H_ |
6 #define MEDIA_BASE_VIDEO_CODECS_H_ | 6 #define MEDIA_BASE_VIDEO_CODECS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 #include "media/media_features.h" | 11 #include "media/media_features.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media | 15 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media |
16 enum VideoCodec { | 16 enum VideoCodec { |
17 // These values are histogrammed over time; do not change their ordinal | 17 // These values are histogrammed over time; do not change their ordinal |
18 // values. When deleting a codec replace it with a dummy value; when adding a | 18 // values. When deleting a codec replace it with a dummy value; when adding a |
19 // codec, do so at the bottom (and update kVideoCodecMax). | 19 // codec, do so at the bottom (and update kVideoCodecMax). |
20 kUnknownVideoCodec = 0, | 20 kUnknownVideoCodec = 0, |
21 kCodecH264, | 21 kCodecH264, |
22 kCodecVC1, | 22 kCodecVC1, |
23 kCodecMPEG2, | 23 kCodecMPEG2, |
24 kCodecMPEG4, | 24 kCodecMPEG4, |
25 kCodecTheora, | 25 kCodecTheora, |
26 kCodecVP8, | 26 kCodecVP8, |
27 kCodecVP9, | 27 kCodecVP9, |
28 kCodecHEVC, | 28 kCodecHEVC, |
| 29 kCodecDolbyVision, |
29 // DO NOT ADD RANDOM VIDEO CODECS! | 30 // DO NOT ADD RANDOM VIDEO CODECS! |
30 // | 31 // |
31 // The only acceptable time to add a new codec is if there is production code | 32 // The only acceptable time to add a new codec is if there is production code |
32 // that uses said codec in the same CL. | 33 // that uses said codec in the same CL. |
33 | 34 |
34 kVideoCodecMax = kCodecHEVC, // Must equal the last "real" codec above. | 35 kVideoCodecMax = |
| 36 kCodecDolbyVision, // Must equal the last "real" codec above. |
35 }; | 37 }; |
36 | 38 |
37 // Video codec profiles. Keep in sync with mojo::VideoCodecProfile (see | 39 // Video codec profiles. Keep in sync with mojo::VideoCodecProfile (see |
38 // media/mojo/interfaces/media_types.mojom), gpu::VideoCodecProfile (see | 40 // media/mojo/interfaces/media_types.mojom), gpu::VideoCodecProfile (see |
39 // gpu/config/gpu_info.h), and PP_VideoDecoder_Profile (translation is performed | 41 // gpu/config/gpu_info.h), and PP_VideoDecoder_Profile (translation is performed |
40 // in content/renderer/pepper/ppb_video_decoder_impl.cc). | 42 // in content/renderer/pepper/ppb_video_decoder_impl.cc). |
41 // NOTE: These values are histogrammed over time in UMA so the values must never | 43 // NOTE: These values are histogrammed over time in UMA so the values must never |
42 // ever change (add new values to tools/metrics/histograms/histograms.xml) | 44 // ever change (add new values to tools/metrics/histograms/histograms.xml) |
43 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media | 45 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media |
44 enum VideoCodecProfile { | 46 enum VideoCodecProfile { |
(...skipping 22 matching lines...) Expand all Loading... |
67 VP9PROFILE_PROFILE0 = VP9PROFILE_MIN, | 69 VP9PROFILE_PROFILE0 = VP9PROFILE_MIN, |
68 VP9PROFILE_PROFILE1 = 13, | 70 VP9PROFILE_PROFILE1 = 13, |
69 VP9PROFILE_PROFILE2 = 14, | 71 VP9PROFILE_PROFILE2 = 14, |
70 VP9PROFILE_PROFILE3 = 15, | 72 VP9PROFILE_PROFILE3 = 15, |
71 VP9PROFILE_MAX = VP9PROFILE_PROFILE3, | 73 VP9PROFILE_MAX = VP9PROFILE_PROFILE3, |
72 HEVCPROFILE_MIN = 16, | 74 HEVCPROFILE_MIN = 16, |
73 HEVCPROFILE_MAIN = HEVCPROFILE_MIN, | 75 HEVCPROFILE_MAIN = HEVCPROFILE_MIN, |
74 HEVCPROFILE_MAIN10 = 17, | 76 HEVCPROFILE_MAIN10 = 17, |
75 HEVCPROFILE_MAIN_STILL_PICTURE = 18, | 77 HEVCPROFILE_MAIN_STILL_PICTURE = 18, |
76 HEVCPROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE, | 78 HEVCPROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE, |
77 VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAX, | 79 DOLBYVISION_MIN = 19, |
| 80 DOLBYVISION_PROFILE0 = DOLBYVISION_MIN, |
| 81 DOLBYVISION_PROFILE4 = 20, |
| 82 DOLBYVISION_PROFILE5 = 21, |
| 83 DOLBYVISION_PROFILE7 = 22, |
| 84 DOLBYVISION_MAX = DOLBYVISION_PROFILE7, |
| 85 VIDEO_CODEC_PROFILE_MAX = DOLBYVISION_MAX, |
78 }; | 86 }; |
79 | 87 |
80 struct CodecProfileLevel { | 88 struct CodecProfileLevel { |
81 VideoCodec codec; | 89 VideoCodec codec; |
82 VideoCodecProfile profile; | 90 VideoCodecProfile profile; |
83 int level; | 91 int level; |
84 }; | 92 }; |
85 | 93 |
86 std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); | 94 std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); |
87 std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile); | 95 std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile); |
(...skipping 15 matching lines...) Expand all Loading... |
103 MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id, | 111 MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id, |
104 VideoCodecProfile* profile, | 112 VideoCodecProfile* profile, |
105 uint8_t* level_idc); | 113 uint8_t* level_idc); |
106 | 114 |
107 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 115 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
108 MEDIA_EXPORT bool ParseHEVCCodecId(const std::string& codec_id, | 116 MEDIA_EXPORT bool ParseHEVCCodecId(const std::string& codec_id, |
109 VideoCodecProfile* profile, | 117 VideoCodecProfile* profile, |
110 uint8_t* level_idc); | 118 uint8_t* level_idc); |
111 #endif | 119 #endif |
112 | 120 |
| 121 #if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
| 122 MEDIA_EXPORT bool ParseDolbyVisionCodecId(const std::string& codec_id, |
| 123 VideoCodecProfile* profile, |
| 124 uint8_t* level_id); |
| 125 #endif |
| 126 |
113 MEDIA_EXPORT VideoCodec StringToVideoCodec(const std::string& codec_id); | 127 MEDIA_EXPORT VideoCodec StringToVideoCodec(const std::string& codec_id); |
114 | 128 |
115 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 129 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
116 // Translate legacy avc1 codec ids (like avc1.66.30 or avc1.77.31) into a new | 130 // Translate legacy avc1 codec ids (like avc1.66.30 or avc1.77.31) into a new |
117 // style standard avc1 codec ids like avc1.4D002F. If the input codec is not | 131 // style standard avc1 codec ids like avc1.4D002F. If the input codec is not |
118 // recognized as a legacy codec id, then returns the input string unchanged. | 132 // recognized as a legacy codec id, then returns the input string unchanged. |
119 std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id); | 133 std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id); |
120 #endif | 134 #endif |
121 | 135 |
122 } // namespace media | 136 } // namespace media |
123 | 137 |
124 #endif // MEDIA_BASE_VIDEO_CODECS_H_ | 138 #endif // MEDIA_BASE_VIDEO_CODECS_H_ |
OLD | NEW |