OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 public: | 71 public: |
72 // Constructs an uninitialized object. Clients should call Initialize() with | 72 // Constructs an uninitialized object. Clients should call Initialize() with |
73 // appropriate values before using. | 73 // appropriate values before using. |
74 VideoDecoderConfig(); | 74 VideoDecoderConfig(); |
75 | 75 |
76 // Constructs an initialized object. It is acceptable to pass in NULL for | 76 // Constructs an initialized object. It is acceptable to pass in NULL for |
77 // |extra_data|, otherwise the memory is copied. | 77 // |extra_data|, otherwise the memory is copied. |
78 VideoDecoderConfig(VideoCodec codec, | 78 VideoDecoderConfig(VideoCodec codec, |
79 VideoCodecProfile profile, | 79 VideoCodecProfile profile, |
80 VideoPixelFormat format, | 80 VideoPixelFormat format, |
| 81 ColorSpace color_space, |
81 const gfx::Size& coded_size, | 82 const gfx::Size& coded_size, |
82 const gfx::Rect& visible_rect, | 83 const gfx::Rect& visible_rect, |
83 const gfx::Size& natural_size, | 84 const gfx::Size& natural_size, |
84 const uint8* extra_data, | 85 const uint8* extra_data, |
85 size_t extra_data_size, | 86 size_t extra_data_size, |
86 bool is_encrypted); | 87 bool is_encrypted); |
87 | 88 |
88 ~VideoDecoderConfig(); | 89 ~VideoDecoderConfig(); |
89 | 90 |
90 // Resets the internal state of this object. | 91 // Resets the internal state of this object. |
(...skipping 16 matching lines...) Expand all Loading... |
107 // Returns true if all fields in |config| match this config. | 108 // Returns true if all fields in |config| match this config. |
108 // Note: The contents of |extra_data_| are compared not the raw pointers. | 109 // Note: The contents of |extra_data_| are compared not the raw pointers. |
109 bool Matches(const VideoDecoderConfig& config) const; | 110 bool Matches(const VideoDecoderConfig& config) const; |
110 | 111 |
111 // Returns a human-readable string describing |*this|. For debugging & test | 112 // Returns a human-readable string describing |*this|. For debugging & test |
112 // output only. | 113 // output only. |
113 std::string AsHumanReadableString() const; | 114 std::string AsHumanReadableString() const; |
114 | 115 |
115 std::string GetHumanReadableCodecName() const; | 116 std::string GetHumanReadableCodecName() const; |
116 | 117 |
117 VideoCodec codec() const; | 118 VideoCodec codec() const { return codec_; } |
118 VideoCodecProfile profile() const; | 119 VideoCodecProfile profile() const { return profile_; } |
119 | 120 |
120 // Video format used to determine YUV buffer sizes. | 121 // Video format used to determine YUV buffer sizes. |
121 VideoPixelFormat format() const; | 122 VideoPixelFormat format() const { return format_; } |
| 123 |
| 124 // The default color space of the decoded frames. Decoders should output |
| 125 // frames tagged with this color space unless they find a different value in |
| 126 // the bitstream. |
| 127 ColorSpace color_space() const { return color_space_; } |
122 | 128 |
123 // Width and height of video frame immediately post-decode. Not all pixels | 129 // Width and height of video frame immediately post-decode. Not all pixels |
124 // in this region are valid. | 130 // in this region are valid. |
125 gfx::Size coded_size() const; | 131 gfx::Size coded_size() const { return coded_size_; } |
126 | 132 |
127 // Region of |coded_size_| that is visible. | 133 // Region of |coded_size_| that is visible. |
128 gfx::Rect visible_rect() const; | 134 gfx::Rect visible_rect() const { return visible_rect_; } |
129 | 135 |
130 // Final visible width and height of a video frame with aspect ratio taken | 136 // Final visible width and height of a video frame with aspect ratio taken |
131 // into account. | 137 // into account. |
132 gfx::Size natural_size() const; | 138 gfx::Size natural_size() const { return natural_size_; } |
133 | 139 |
134 // Optional byte data required to initialize video decoders, such as H.264 | 140 // Optional byte data required to initialize video decoders, such as H.264 |
135 // AAVC data. | 141 // AAVC data. |
136 const uint8* extra_data() const; | 142 const uint8* extra_data() const; |
137 size_t extra_data_size() const; | 143 size_t extra_data_size() const { return extra_data_.size(); } |
138 | 144 |
139 // Whether the video stream is potentially encrypted. | 145 // Whether the video stream is potentially encrypted. |
140 // Note that in a potentially encrypted video stream, individual buffers | 146 // Note that in a potentially encrypted video stream, individual buffers |
141 // can be encrypted or not encrypted. | 147 // can be encrypted or not encrypted. |
142 bool is_encrypted() const; | 148 bool is_encrypted() const { return is_encrypted_; } |
143 | 149 |
144 private: | 150 private: |
145 VideoCodec codec_; | 151 VideoCodec codec_; |
146 VideoCodecProfile profile_; | 152 VideoCodecProfile profile_; |
147 | 153 |
148 VideoPixelFormat format_; | 154 VideoPixelFormat format_; |
| 155 ColorSpace color_space_; |
149 | 156 |
150 gfx::Size coded_size_; | 157 gfx::Size coded_size_; |
151 gfx::Rect visible_rect_; | 158 gfx::Rect visible_rect_; |
152 gfx::Size natural_size_; | 159 gfx::Size natural_size_; |
153 | 160 |
154 std::vector<uint8> extra_data_; | 161 std::vector<uint8> extra_data_; |
155 | 162 |
156 bool is_encrypted_; | 163 bool is_encrypted_; |
157 | 164 |
158 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler | 165 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler |
159 // generated copy constructor and assignment operator. Since the extra data is | 166 // generated copy constructor and assignment operator. Since the extra data is |
160 // typically small, the performance impact is minimal. | 167 // typically small, the performance impact is minimal. |
161 }; | 168 }; |
162 | 169 |
163 } // namespace media | 170 } // namespace media |
164 | 171 |
165 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 172 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
OLD | NEW |