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