OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DECODER_CONFIG_H_ | 5 #ifndef MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
6 #define MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 6 #define MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 enum VideoCodec { | 17 enum MEDIA_EXPORT VideoCodec { |
18 // These values are histogrammed over time; do not change their ordinal | 18 // These values are histogrammed over time; do not change their ordinal |
19 // values. When deleting a codec replace it with a dummy value; when adding a | 19 // values. When deleting a codec replace it with a dummy value; when adding a |
20 // codec, do so at the bottom (and update kVideoCodecMax). | 20 // codec, do so at the bottom (and update kVideoCodecMax). |
21 kUnknownVideoCodec = 0, | 21 kUnknownVideoCodec = 0, |
22 kCodecH264, | 22 kCodecH264, |
23 kCodecVC1, | 23 kCodecVC1, |
24 kCodecMPEG2, | 24 kCodecMPEG2, |
25 kCodecMPEG4, | 25 kCodecMPEG4, |
26 kCodecTheora, | 26 kCodecTheora, |
27 kCodecVP8, | 27 kCodecVP8, |
28 // DO NOT ADD RANDOM VIDEO CODECS! | 28 // DO NOT ADD RANDOM VIDEO CODECS! |
29 // | 29 // |
30 // 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 |
31 // that uses said codec in the same CL. | 31 // that uses said codec in the same CL. |
32 | 32 |
33 kVideoCodecMax = kCodecVP8 // Must equal the last "real" codec above. | 33 kVideoCodecMax = kCodecVP8 // Must equal the last "real" codec above. |
34 }; | 34 }; |
35 | 35 |
36 // Video stream profile. This *must* match PP_VideoDecoder_Profile. | |
scherkus (not reviewing)
2011/12/06 00:27:44
I can't recall but I thought we didn't want to hav
Ami GONE FROM CHROMIUM
2011/12/07 00:03:04
The dependency we couldn't take was an explicit on
| |
37 enum MEDIA_EXPORT VideoCodecProfile { | |
38 // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, | |
39 // for example), and keep the values for a particular format grouped | |
40 // together for clarity. | |
41 VIDEO_CODEC_PROFILE_UNKNOWN = -1, | |
scherkus (not reviewing)
2011/12/06 00:27:44
we're mixing up kStyle and ENUM_STYLE
Ami GONE FROM CHROMIUM
2011/12/07 00:03:04
Yeah, we are. Style guide prefers kStyle (newer)
| |
42 H264PROFILE_MIN = 0, | |
43 H264PROFILE_BASELINE = H264PROFILE_MIN, | |
44 H264PROFILE_MAIN, | |
45 H264PROFILE_EXTENDED, | |
46 H264PROFILE_HIGH, | |
47 H264PROFILE_HIGH10PROFILE, | |
48 H264PROFILE_HIGH422PROFILE, | |
49 H264PROFILE_HIGH444PREDICTIVEPROFILE, | |
50 H264PROFILE_SCALABLEBASELINE, | |
51 H264PROFILE_SCALABLEHIGH, | |
52 H264PROFILE_STEREOHIGH, | |
53 H264PROFILE_MULTIVIEWHIGH, | |
54 H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH, | |
55 VIDEO_CODEC_PROFILE_MAX = H264PROFILE_MAX, | |
56 }; | |
57 | |
36 class MEDIA_EXPORT VideoDecoderConfig { | 58 class MEDIA_EXPORT VideoDecoderConfig { |
37 public: | 59 public: |
38 // Constructs an uninitialized object. Clients should call Initialize() with | 60 // Constructs an uninitialized object. Clients should call Initialize() with |
39 // appropriate values before using. | 61 // appropriate values before using. |
40 VideoDecoderConfig(); | 62 VideoDecoderConfig(); |
41 | 63 |
42 // Constructs an initialized object. It is acceptable to pass in NULL for | 64 // Constructs an initialized object. It is acceptable to pass in NULL for |
43 // |extra_data|, otherwise the memory is copied. | 65 // |extra_data|, otherwise the memory is copied. |
44 VideoDecoderConfig(VideoCodec codec, | 66 VideoDecoderConfig(VideoCodec codec, |
67 VideoCodecProfile profile, | |
45 VideoFrame::Format format, | 68 VideoFrame::Format format, |
46 const gfx::Size& coded_size, | 69 const gfx::Size& coded_size, |
47 const gfx::Rect& visible_rect, | 70 const gfx::Rect& visible_rect, |
48 int frame_rate_numerator, int frame_rate_denominator, | 71 int frame_rate_numerator, int frame_rate_denominator, |
49 int aspect_ratio_numerator, int aspect_ratio_denominator, | 72 int aspect_ratio_numerator, int aspect_ratio_denominator, |
50 const uint8* extra_data, size_t extra_data_size); | 73 const uint8* extra_data, size_t extra_data_size); |
51 | 74 |
52 ~VideoDecoderConfig(); | 75 ~VideoDecoderConfig(); |
53 | 76 |
54 // Resets the internal state of this object. | 77 // Resets the internal state of this object. |
55 void Initialize(VideoCodec codec, | 78 void Initialize(VideoCodec codec, |
79 VideoCodecProfile profile, | |
56 VideoFrame::Format format, | 80 VideoFrame::Format format, |
57 const gfx::Size& coded_size, | 81 const gfx::Size& coded_size, |
58 const gfx::Rect& visible_rect, | 82 const gfx::Rect& visible_rect, |
59 int frame_rate_numerator, int frame_rate_denominator, | 83 int frame_rate_numerator, int frame_rate_denominator, |
60 int aspect_ratio_numerator, int aspect_ratio_denominator, | 84 int aspect_ratio_numerator, int aspect_ratio_denominator, |
61 const uint8* extra_data, size_t extra_data_size); | 85 const uint8* extra_data, size_t extra_data_size); |
62 | 86 |
63 // Returns true if this object has appropriate configuration values, false | 87 // Returns true if this object has appropriate configuration values, false |
64 // otherwise. | 88 // otherwise. |
65 bool IsValidConfig() const; | 89 bool IsValidConfig() const; |
66 | 90 |
91 // Returns a human-readable string describing |*this|. For debugging & test | |
92 // output only. | |
93 std::string AsHumanReadableString() const; | |
94 | |
67 VideoCodec codec() const; | 95 VideoCodec codec() const; |
96 VideoCodecProfile profile() const; | |
68 | 97 |
69 // Video format used to determine YUV buffer sizes. | 98 // Video format used to determine YUV buffer sizes. |
70 VideoFrame::Format format() const; | 99 VideoFrame::Format format() const; |
71 | 100 |
72 // Width and height of video frame immediately post-decode. Not all pixels | 101 // Width and height of video frame immediately post-decode. Not all pixels |
73 // in this region are valid. | 102 // in this region are valid. |
74 gfx::Size coded_size() const; | 103 gfx::Size coded_size() const; |
75 | 104 |
76 // Region of |coded_size_| that is visible. | 105 // Region of |coded_size_| that is visible. |
77 gfx::Rect visible_rect() const; | 106 gfx::Rect visible_rect() const; |
(...skipping 17 matching lines...) Expand all Loading... | |
95 int aspect_ratio_numerator() const; | 124 int aspect_ratio_numerator() const; |
96 int aspect_ratio_denominator() const; | 125 int aspect_ratio_denominator() const; |
97 | 126 |
98 // Optional byte data required to initialize video decoders, such as H.264 | 127 // Optional byte data required to initialize video decoders, such as H.264 |
99 // AAVC data. | 128 // AAVC data. |
100 uint8* extra_data() const; | 129 uint8* extra_data() const; |
101 size_t extra_data_size() const; | 130 size_t extra_data_size() const; |
102 | 131 |
103 private: | 132 private: |
104 VideoCodec codec_; | 133 VideoCodec codec_; |
134 VideoCodecProfile profile_; | |
105 | 135 |
106 VideoFrame::Format format_; | 136 VideoFrame::Format format_; |
107 | 137 |
108 gfx::Size coded_size_; | 138 gfx::Size coded_size_; |
109 gfx::Rect visible_rect_; | 139 gfx::Rect visible_rect_; |
110 gfx::Size natural_size_; | 140 gfx::Size natural_size_; |
111 | 141 |
112 int frame_rate_numerator_; | 142 int frame_rate_numerator_; |
113 int frame_rate_denominator_; | 143 int frame_rate_denominator_; |
114 | 144 |
115 int aspect_ratio_numerator_; | 145 int aspect_ratio_numerator_; |
116 int aspect_ratio_denominator_; | 146 int aspect_ratio_denominator_; |
117 | 147 |
118 scoped_array<uint8> extra_data_; | 148 scoped_array<uint8> extra_data_; |
119 size_t extra_data_size_; | 149 size_t extra_data_size_; |
120 | 150 |
121 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); | 151 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); |
122 }; | 152 }; |
123 | 153 |
124 } // namespace media | 154 } // namespace media |
125 | 155 |
126 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 156 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
OLD | NEW |