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 enum VideoCodec { | 15 enum VideoCodec { |
16 // These values are histogrammed over time; do not change their ordinal | 16 // These values are histogrammed over time; do not change their ordinal |
17 // 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 |
18 // codec, do so at the bottom (and update kVideoCodecMax). | 18 // codec, do so at the bottom (and update kVideoCodecMax). |
19 kUnknownVideoCodec = 0, | 19 kUnknownVideoCodec = 0, |
20 kCodecH264, | 20 kCodecH264, |
21 kCodecVC1, | 21 kCodecVC1, |
22 kCodecMPEG2, | 22 kCodecMPEG2, |
23 kCodecMPEG4, | 23 kCodecMPEG4, |
24 kCodecTheora, | 24 kCodecTheora, |
25 kCodecVP8, | 25 kCodecVP8, |
26 kCodecVP9, | 26 kCodecVP9, |
27 kCodecHEVC, | 27 kCodecHEVC, |
28 kCodecDolbyVision, | |
28 // DO NOT ADD RANDOM VIDEO CODECS! | 29 // DO NOT ADD RANDOM VIDEO CODECS! |
29 // | 30 // |
30 // The only acceptable time to add a new codec is if there is production code | 31 // The only acceptable time to add a new codec is if there is production code |
31 // that uses said codec in the same CL. | 32 // that uses said codec in the same CL. |
32 | 33 |
33 kVideoCodecMax = kCodecHEVC // Must equal the last "real" codec above. | 34 kVideoCodecMax = kCodecDolbyVision // Must equal the last "real" codec above. |
34 }; | 35 }; |
35 | 36 |
36 // Video codec profiles. Keep in sync with mojo::VideoCodecProfile (see | 37 // Video codec profiles. Keep in sync with mojo::VideoCodecProfile (see |
37 // media/mojo/interfaces/media_types.mojom) and gpu::VideoCodecProfile (see | 38 // media/mojo/interfaces/media_types.mojom) and gpu::VideoCodecProfile (see |
38 // gpu/config/gpu_info.h), as well as PP_VideoDecoder_Profile (translation is | 39 // 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 // performed in content/renderer/pepper/ppb_video_decoder_impl.cc). |
40 // NOTE: These values are histogrammed over time in UMA so the values must | 41 // NOTE: These values are histogrammed over time in UMA so the values must |
41 // never ever change (add new values to tools/metrics/histograms/histograms.xml) | 42 // never ever change (add new values to tools/metrics/histograms/histograms.xml) |
42 enum VideoCodecProfile { | 43 enum VideoCodecProfile { |
43 // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, | 44 // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, |
(...skipping 20 matching lines...) Expand all Loading... | |
64 VP9PROFILE_MIN = 12, | 65 VP9PROFILE_MIN = 12, |
65 VP9PROFILE_PROFILE0 = VP9PROFILE_MIN, | 66 VP9PROFILE_PROFILE0 = VP9PROFILE_MIN, |
66 VP9PROFILE_PROFILE1 = 13, | 67 VP9PROFILE_PROFILE1 = 13, |
67 VP9PROFILE_PROFILE2 = 14, | 68 VP9PROFILE_PROFILE2 = 14, |
68 VP9PROFILE_PROFILE3 = 15, | 69 VP9PROFILE_PROFILE3 = 15, |
69 VP9PROFILE_MAX = VP9PROFILE_PROFILE3, | 70 VP9PROFILE_MAX = VP9PROFILE_PROFILE3, |
70 HEVCPROFILE_MIN = 16, | 71 HEVCPROFILE_MIN = 16, |
71 HEVCPROFILE_MAIN = HEVCPROFILE_MIN, | 72 HEVCPROFILE_MAIN = HEVCPROFILE_MIN, |
72 HEVCPROFILE_MAIN10 = 17, | 73 HEVCPROFILE_MAIN10 = 17, |
73 HEVCPROFILE_MAIN_STILL_PICTURE = 18, | 74 HEVCPROFILE_MAIN_STILL_PICTURE = 18, |
74 HEVCPROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE, | 75 DOLBYVISION_MIN = 19, |
75 VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAX, | 76 DOLBYVISION_PROFILE0 = DOLBYVISION_MIN, |
77 DOLBYVISION_PROFILE4 = 20, | |
78 DOLBYVISION_PROFILE5 = 21, | |
wolenetz
2017/01/25 23:42:41
To be clear, this enumeration's lack of inclusion
erickung1
2017/02/03 18:18:31
this is intentional since profile 1 2 3 and 6 are
| |
79 DOLBYVISION_PROFILE7 = 22, | |
80 DOLBYVISION_MAX = DOLBYVISION_PROFILE7, | |
81 VIDEO_CODEC_PROFILE_MAX = DOLBYVISION_MAX, | |
76 }; | 82 }; |
77 | 83 |
78 std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); | 84 std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); |
79 std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile); | 85 std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile); |
80 | 86 |
81 // ParseNewStyleVp9CodecID handles parsing of new style vp9 codec IDs per | 87 // ParseNewStyleVp9CodecID handles parsing of new style vp9 codec IDs per |
82 // proposed VP Codec ISO Media File Format Binding specification: | 88 // proposed VP Codec ISO Media File Format Binding specification: |
83 // https://storage.googleapis.com/downloads.webmproject.org/docs/vp9/vp-codec-is o-media-file-format-binding-20160516-draft.pdf | 89 // https://storage.googleapis.com/downloads.webmproject.org/docs/vp9/vp-codec-is o-media-file-format-binding-20160516-draft.pdf |
84 // ParseLegacyVp9CodecID handles parsing of legacy VP9 codec strings defined | 90 // ParseLegacyVp9CodecID handles parsing of legacy VP9 codec strings defined |
85 // for WebM. | 91 // for WebM. |
86 // TODO(kqyang): Consolidate the two functions once we address crbug.com/667834 | 92 // TODO(kqyang): Consolidate the two functions once we address crbug.com/667834 |
87 MEDIA_EXPORT bool ParseNewStyleVp9CodecID(const std::string& codec_id, | 93 MEDIA_EXPORT bool ParseNewStyleVp9CodecID(const std::string& codec_id, |
88 VideoCodecProfile* profile, | 94 VideoCodecProfile* profile, |
89 uint8_t* level_idc); | 95 uint8_t* level_idc); |
90 MEDIA_EXPORT bool ParseLegacyVp9CodecID(const std::string& codec_id, | 96 MEDIA_EXPORT bool ParseLegacyVp9CodecID(const std::string& codec_id, |
91 VideoCodecProfile* profile, | 97 VideoCodecProfile* profile, |
92 uint8_t* level_idc); | 98 uint8_t* level_idc); |
93 | 99 |
94 // Handle parsing AVC/H.264 codec ids as outlined in RFC 6381 and ISO-14496-10. | 100 // Handle parsing AVC/H.264 codec ids as outlined in RFC 6381 and ISO-14496-10. |
95 MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id, | 101 MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id, |
96 VideoCodecProfile* profile, | 102 VideoCodecProfile* profile, |
97 uint8_t* level_idc); | 103 uint8_t* level_idc); |
98 | 104 |
99 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) | 105 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
100 MEDIA_EXPORT bool ParseHEVCCodecId(const std::string& codec_id, | 106 MEDIA_EXPORT bool ParseHEVCCodecId(const std::string& codec_id, |
101 VideoCodecProfile* profile, | 107 VideoCodecProfile* profile, |
102 uint8_t* level_idc); | 108 uint8_t* level_idc); |
103 #endif | 109 #endif |
104 | 110 |
111 #if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) | |
112 MEDIA_EXPORT bool ParseDolbyVisionCodecId(const std::string& codec_id, | |
113 VideoCodecProfile* profile, | |
114 uint8_t* level_id); | |
115 #endif | |
116 | |
105 MEDIA_EXPORT VideoCodec StringToVideoCodec(const std::string& codec_id); | 117 MEDIA_EXPORT VideoCodec StringToVideoCodec(const std::string& codec_id); |
106 | 118 |
107 } // namespace media | 119 } // namespace media |
108 | 120 |
109 #endif // MEDIA_BASE_VIDEO_CODECS_H_ | 121 #endif // MEDIA_BASE_VIDEO_CODECS_H_ |
OLD | NEW |