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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 VP8PROFILE_ANY = VP8PROFILE_MIN, | 62 VP8PROFILE_ANY = VP8PROFILE_MIN, |
63 VP8PROFILE_MAX = VP8PROFILE_ANY, | 63 VP8PROFILE_MAX = VP8PROFILE_ANY, |
64 VP9PROFILE_MIN = 12, | 64 VP9PROFILE_MIN = 12, |
65 VP9PROFILE_ANY = VP9PROFILE_MIN, | 65 VP9PROFILE_ANY = VP9PROFILE_MIN, |
66 VP9PROFILE_MAX = VP9PROFILE_ANY, | 66 VP9PROFILE_MAX = VP9PROFILE_ANY, |
67 VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_MAX, | 67 VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_MAX, |
68 }; | 68 }; |
69 | 69 |
70 class MEDIA_EXPORT VideoDecoderConfig { | 70 class MEDIA_EXPORT VideoDecoderConfig { |
71 public: | 71 public: |
72 // Get the color space defaults. The default for src playbacks depends on | |
73 // whether the video is SD or HD. | |
74 static VideoFrame::ColorSpace DefaultMseColorSpace(); | |
DaleCurtis
2015/07/06 22:36:14
How about just DefaultColorSpace() and MSE can har
watk
2015/07/06 23:15:58
Done.
| |
75 static VideoFrame::ColorSpace DefaultSrcColorSpace( | |
76 const gfx::Size& natural_size); | |
77 | |
72 // Constructs an uninitialized object. Clients should call Initialize() with | 78 // Constructs an uninitialized object. Clients should call Initialize() with |
73 // appropriate values before using. | 79 // appropriate values before using. |
74 VideoDecoderConfig(); | 80 VideoDecoderConfig(); |
75 | 81 |
76 // Constructs an initialized object. It is acceptable to pass in NULL for | 82 // Constructs an initialized object. It is acceptable to pass in NULL for |
77 // |extra_data|, otherwise the memory is copied. | 83 // |extra_data|, otherwise the memory is copied. |
78 VideoDecoderConfig(VideoCodec codec, | 84 VideoDecoderConfig(VideoCodec codec, |
79 VideoCodecProfile profile, | 85 VideoCodecProfile profile, |
80 VideoFrame::Format format, | 86 VideoFrame::Format format, |
87 VideoFrame::ColorSpace color_space, | |
81 const gfx::Size& coded_size, | 88 const gfx::Size& coded_size, |
82 const gfx::Rect& visible_rect, | 89 const gfx::Rect& visible_rect, |
83 const gfx::Size& natural_size, | 90 const gfx::Size& natural_size, |
84 const uint8* extra_data, size_t extra_data_size, | 91 const uint8* extra_data, size_t extra_data_size, |
85 bool is_encrypted); | 92 bool is_encrypted); |
86 | 93 |
87 ~VideoDecoderConfig(); | 94 ~VideoDecoderConfig(); |
88 | 95 |
89 // Resets the internal state of this object. | 96 // Resets the internal state of this object. |
90 void Initialize(VideoCodec codec, | 97 void Initialize(VideoCodec codec, |
(...skipping 20 matching lines...) Expand all Loading... | |
111 std::string AsHumanReadableString() const; | 118 std::string AsHumanReadableString() const; |
112 | 119 |
113 std::string GetHumanReadableCodecName() const; | 120 std::string GetHumanReadableCodecName() const; |
114 | 121 |
115 VideoCodec codec() const; | 122 VideoCodec codec() const; |
116 VideoCodecProfile profile() const; | 123 VideoCodecProfile profile() const; |
117 | 124 |
118 // Video format used to determine YUV buffer sizes. | 125 // Video format used to determine YUV buffer sizes. |
119 VideoFrame::Format format() const; | 126 VideoFrame::Format format() const; |
120 | 127 |
128 // Default color space of the decoded frames. Decoders should output frames | |
129 // tagged with this color space unless they find a different value in the | |
130 // bitstream. | |
131 VideoFrame::ColorSpace color_space() const; | |
132 | |
121 // Width and height of video frame immediately post-decode. Not all pixels | 133 // Width and height of video frame immediately post-decode. Not all pixels |
122 // in this region are valid. | 134 // in this region are valid. |
123 gfx::Size coded_size() const; | 135 gfx::Size coded_size() const; |
124 | 136 |
125 // Region of |coded_size_| that is visible. | 137 // Region of |coded_size_| that is visible. |
126 gfx::Rect visible_rect() const; | 138 gfx::Rect visible_rect() const; |
127 | 139 |
128 // Final visible width and height of a video frame with aspect ratio taken | 140 // Final visible width and height of a video frame with aspect ratio taken |
129 // into account. | 141 // into account. |
130 gfx::Size natural_size() const; | 142 gfx::Size natural_size() const; |
131 | 143 |
132 // Optional byte data required to initialize video decoders, such as H.264 | 144 // Optional byte data required to initialize video decoders, such as H.264 |
133 // AAVC data. | 145 // AAVC data. |
134 const uint8* extra_data() const; | 146 const uint8* extra_data() const; |
135 size_t extra_data_size() const; | 147 size_t extra_data_size() const; |
136 | 148 |
137 // Whether the video stream is potentially encrypted. | 149 // Whether the video stream is potentially encrypted. |
138 // Note that in a potentially encrypted video stream, individual buffers | 150 // Note that in a potentially encrypted video stream, individual buffers |
139 // can be encrypted or not encrypted. | 151 // can be encrypted or not encrypted. |
140 bool is_encrypted() const; | 152 bool is_encrypted() const; |
141 | 153 |
142 private: | 154 private: |
143 VideoCodec codec_; | 155 VideoCodec codec_; |
144 VideoCodecProfile profile_; | 156 VideoCodecProfile profile_; |
145 | 157 |
146 VideoFrame::Format format_; | 158 VideoFrame::Format format_; |
159 VideoFrame::ColorSpace color_space_; | |
147 | 160 |
148 gfx::Size coded_size_; | 161 gfx::Size coded_size_; |
149 gfx::Rect visible_rect_; | 162 gfx::Rect visible_rect_; |
150 gfx::Size natural_size_; | 163 gfx::Size natural_size_; |
151 | 164 |
152 std::vector<uint8> extra_data_; | 165 std::vector<uint8> extra_data_; |
153 | 166 |
154 bool is_encrypted_; | 167 bool is_encrypted_; |
155 | 168 |
156 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler | 169 // Not using DISALLOW_COPY_AND_ASSIGN here intentionally to allow the compiler |
157 // generated copy constructor and assignment operator. Since the extra data is | 170 // generated copy constructor and assignment operator. Since the extra data is |
158 // typically small, the performance impact is minimal. | 171 // typically small, the performance impact is minimal. |
159 }; | 172 }; |
160 | 173 |
161 } // namespace media | 174 } // namespace media |
162 | 175 |
163 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 176 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
OLD | NEW |