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