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 | 12 |
12 namespace media { | 13 namespace media { |
13 | 14 |
14 enum VideoCodec { | 15 enum VideoCodec { |
15 // These values are histogrammed over time; do not change their ordinal | 16 // These values are histogrammed over time; do not change their ordinal |
16 // values. When deleting a codec replace it with a dummy value; when adding a | 17 // values. When deleting a codec replace it with a dummy value; when adding a |
17 // codec, do so at the bottom (and update kVideoCodecMax). | 18 // codec, do so at the bottom (and update kVideoCodecMax). |
18 kUnknownVideoCodec = 0, | 19 kUnknownVideoCodec = 0, |
19 kCodecH264, | 20 kCodecH264, |
20 kCodecVC1, | 21 kCodecVC1, |
21 kCodecMPEG2, | 22 kCodecMPEG2, |
22 kCodecMPEG4, | 23 kCodecMPEG4, |
23 kCodecTheora, | 24 kCodecTheora, |
24 kCodecVP8, | 25 kCodecVP8, |
25 kCodecVP9, | 26 kCodecVP9, |
26 kCodecHEVC, | 27 kCodecHEVC, |
27 // DO NOT ADD RANDOM VIDEO CODECS! | 28 // DO NOT ADD RANDOM VIDEO CODECS! |
28 // | 29 // |
29 // The only acceptable time to add a new codec is if there is production code | 30 // The only acceptable time to add a new codec is if there is production code |
30 // that uses said codec in the same CL. | 31 // that uses said codec in the same CL. |
31 | 32 |
32 kVideoCodecMax = kCodecHEVC // Must equal the last "real" codec above. | 33 kVideoCodecMax = kCodecHEVC // Must equal the last "real" codec above. |
33 }; | 34 }; |
34 | 35 |
35 // Video stream profile. This *must* match PP_VideoDecoder_Profile. | 36 // Video codec profiles. Keep in sync with mojo::VideoCodecProfile (see |
36 // (enforced in webkit/plugins/ppapi/ppb_video_decoder_impl.cc) and | 37 // media/mojo/interfaces/media_types.mojom) and gpu::VideoCodecProfile (see |
37 // gpu::VideoCodecProfile. | 38 // gpu/config/gpu_info.h), as well as PP_VideoDecoder_Profile (translation is |
39 // performed in content/renderer/pepper/ppb_video_decoder_impl.cc). | |
40 // NOTE: These values are histogrammed over time in UMA so the values must | |
ddorwin
2016/02/26 18:54:17
Since this note is so important, I would put it fi
| |
41 // never ever change (add new values to tools/metrics/histograms/histograms.xml) | |
38 enum VideoCodecProfile { | 42 enum VideoCodecProfile { |
39 // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, | 43 // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, |
40 // for example), and keep the values for a particular format grouped | 44 // for example), and keep the values for a particular format grouped |
41 // together for clarity. | 45 // together for clarity. |
42 VIDEO_CODEC_PROFILE_UNKNOWN = -1, | 46 VIDEO_CODEC_PROFILE_UNKNOWN = -1, |
43 VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN, | 47 VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN, |
44 H264PROFILE_MIN = 0, | 48 H264PROFILE_MIN = 0, |
45 H264PROFILE_BASELINE = H264PROFILE_MIN, | 49 H264PROFILE_BASELINE = H264PROFILE_MIN, |
46 H264PROFILE_MAIN = 1, | 50 H264PROFILE_MAIN = 1, |
47 H264PROFILE_EXTENDED = 2, | 51 H264PROFILE_EXTENDED = 2, |
48 H264PROFILE_HIGH = 3, | 52 H264PROFILE_HIGH = 3, |
49 H264PROFILE_HIGH10PROFILE = 4, | 53 H264PROFILE_HIGH10PROFILE = 4, |
50 H264PROFILE_HIGH422PROFILE = 5, | 54 H264PROFILE_HIGH422PROFILE = 5, |
51 H264PROFILE_HIGH444PREDICTIVEPROFILE = 6, | 55 H264PROFILE_HIGH444PREDICTIVEPROFILE = 6, |
52 H264PROFILE_SCALABLEBASELINE = 7, | 56 H264PROFILE_SCALABLEBASELINE = 7, |
53 H264PROFILE_SCALABLEHIGH = 8, | 57 H264PROFILE_SCALABLEHIGH = 8, |
54 H264PROFILE_STEREOHIGH = 9, | 58 H264PROFILE_STEREOHIGH = 9, |
55 H264PROFILE_MULTIVIEWHIGH = 10, | 59 H264PROFILE_MULTIVIEWHIGH = 10, |
56 H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH, | 60 H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH, |
57 VP8PROFILE_MIN = 11, | 61 VP8PROFILE_MIN = 11, |
58 VP8PROFILE_ANY = VP8PROFILE_MIN, | 62 VP8PROFILE_ANY = VP8PROFILE_MIN, |
59 VP8PROFILE_MAX = VP8PROFILE_ANY, | 63 VP8PROFILE_MAX = VP8PROFILE_ANY, |
60 VP9PROFILE_MIN = 12, | 64 VP9PROFILE_MIN = 12, |
61 VP9PROFILE_ANY = VP9PROFILE_MIN, | 65 VP9PROFILE_ANY = VP9PROFILE_MIN, |
ddorwin
2016/02/26 18:54:17
Should we reserve 3 or 4 values for VP9 profiles?
servolk
2016/02/26 19:50:19
Yeah, I think we probably should. According to wik
servolk
2016/02/26 22:24:26
Done.
| |
62 VP9PROFILE_MAX = VP9PROFILE_ANY, | 66 VP9PROFILE_MAX = VP9PROFILE_ANY, |
63 VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_MAX, | 67 HEVCPROFILE_MIN = 13, |
68 HEVCPROFILE_MAIN = HEVCPROFILE_MIN, | |
69 HEVCPROFILE_MAIN10 = 14, | |
70 HEVCPROFILE_MAIN_STILL_PICTURE = 15, | |
ddorwin
2016/02/26 18:54:17
If you plan to add other HEVC profiles, should we
servolk
2016/02/26 19:50:19
Currently (and I don't expect that to change for a
| |
71 HEVCPROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE, | |
72 VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAX, | |
64 }; | 73 }; |
65 | 74 |
66 std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); | 75 std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); |
67 std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile); | 76 std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile); |
68 | 77 |
69 // Handle parsing AVC/H.264 codec ids as outlined in RFC 6381 and ISO-14496-10. | 78 // Handle parsing AVC/H.264 codec ids as outlined in RFC 6381 and ISO-14496-10. |
70 MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id, | 79 MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id, |
71 VideoCodecProfile* profile, | 80 VideoCodecProfile* profile, |
72 uint8_t* level_idc); | 81 uint8_t* level_idc); |
73 | 82 |
83 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | |
84 MEDIA_EXPORT bool ParseHEVCCodecId(const std::string& codec_id, | |
85 VideoCodecProfile* profile, | |
86 uint8_t* level_idc); | |
87 #endif | |
88 | |
74 } // namespace media | 89 } // namespace media |
75 | 90 |
76 #endif // MEDIA_BASE_VIDEO_CODECS_H_ | 91 #endif // MEDIA_BASE_VIDEO_CODECS_H_ |
OLD | NEW |