| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // appropriate values before using. | 35 // appropriate values before using. |
| 36 VideoDecoderConfig(); | 36 VideoDecoderConfig(); |
| 37 | 37 |
| 38 // Constructs an initialized object. It is acceptable to pass in NULL for | 38 // Constructs an initialized object. It is acceptable to pass in NULL for |
| 39 // |extra_data|, otherwise the memory is copied. | 39 // |extra_data|, otherwise the memory is copied. |
| 40 VideoDecoderConfig(VideoCodec codec, | 40 VideoDecoderConfig(VideoCodec codec, |
| 41 VideoFrame::Format format, | 41 VideoFrame::Format format, |
| 42 const gfx::Size& coded_size, | 42 const gfx::Size& coded_size, |
| 43 const gfx::Rect& visible_rect, | 43 const gfx::Rect& visible_rect, |
| 44 int frame_rate_numerator, int frame_rate_denominator, | 44 int frame_rate_numerator, int frame_rate_denominator, |
| 45 int aspect_ratio_numerator, int aspect_ratio_denominator, |
| 45 const uint8* extra_data, size_t extra_data_size); | 46 const uint8* extra_data, size_t extra_data_size); |
| 46 | 47 |
| 47 ~VideoDecoderConfig(); | 48 ~VideoDecoderConfig(); |
| 48 | 49 |
| 49 // Resets the internal state of this object. | 50 // Resets the internal state of this object. |
| 50 void Initialize(VideoCodec codec, | 51 void Initialize(VideoCodec codec, |
| 51 VideoFrame::Format format, | 52 VideoFrame::Format format, |
| 52 const gfx::Size& coded_size, | 53 const gfx::Size& coded_size, |
| 53 const gfx::Rect& visible_rect, | 54 const gfx::Rect& visible_rect, |
| 54 int frame_rate_numerator, int frame_rate_denominator, | 55 int frame_rate_numerator, int frame_rate_denominator, |
| 56 int aspect_ratio_numerator, int aspect_ratio_denominator, |
| 55 const uint8* extra_data, size_t extra_data_size); | 57 const uint8* extra_data, size_t extra_data_size); |
| 56 | 58 |
| 57 // Returns true if this object has appropriate configuration values, false | 59 // Returns true if this object has appropriate configuration values, false |
| 58 // otherwise. | 60 // otherwise. |
| 59 bool IsValidConfig() const; | 61 bool IsValidConfig() const; |
| 60 | 62 |
| 61 VideoCodec codec() const; | 63 VideoCodec codec() const; |
| 62 | 64 |
| 63 // Video format used to determine YUV buffer sizes. | 65 // Video format used to determine YUV buffer sizes. |
| 64 VideoFrame::Format format() const; | 66 VideoFrame::Format format() const; |
| 65 | 67 |
| 66 // Width and height of video frame immediately post-decode. Not all pixels | 68 // Width and height of video frame immediately post-decode. Not all pixels |
| 67 // in this region are valid. | 69 // in this region are valid. |
| 68 gfx::Size coded_size() const; | 70 gfx::Size coded_size() const; |
| 69 | 71 |
| 70 // Region of |coded_size_| that is visible. | 72 // Region of |coded_size_| that is visible. |
| 71 gfx::Rect visible_rect() const; | 73 gfx::Rect visible_rect() const; |
| 72 | 74 |
| 75 // Final visible width and height of a video frame with aspect ratio taken |
| 76 // into account. |
| 77 gfx::Size natural_size() const; |
| 78 |
| 73 // Frame rate in seconds expressed as a fraction. | 79 // Frame rate in seconds expressed as a fraction. |
| 74 // TODO(scherkus): fairly certain decoders don't require frame rates. | 80 // |
| 81 // This information is required to properly timestamp video frames for |
| 82 // codecs that contain repeated frames, such as found in H.264's |
| 83 // supplemental enhancement information. |
| 75 int frame_rate_numerator() const; | 84 int frame_rate_numerator() const; |
| 76 int frame_rate_denominator() const; | 85 int frame_rate_denominator() const; |
| 77 | 86 |
| 87 // Aspect ratio of the decoded video frame expressed as a fraction. |
| 88 // |
| 89 // TODO(scherkus): think of a better way to avoid having video decoders |
| 90 // handle tricky aspect ratio dimension calculations. |
| 91 int aspect_ratio_numerator() const; |
| 92 int aspect_ratio_denominator() const; |
| 93 |
| 78 // Optional byte data required to initialize video decoders, such as H.264 | 94 // Optional byte data required to initialize video decoders, such as H.264 |
| 79 // AAVC data. | 95 // AAVC data. |
| 80 uint8* extra_data() const; | 96 uint8* extra_data() const; |
| 81 size_t extra_data_size() const; | 97 size_t extra_data_size() const; |
| 82 | 98 |
| 83 private: | 99 private: |
| 84 VideoCodec codec_; | 100 VideoCodec codec_; |
| 85 | 101 |
| 86 VideoFrame::Format format_; | 102 VideoFrame::Format format_; |
| 87 | 103 |
| 88 gfx::Size coded_size_; | 104 gfx::Size coded_size_; |
| 89 gfx::Rect visible_rect_; | 105 gfx::Rect visible_rect_; |
| 106 gfx::Size natural_size_; |
| 90 | 107 |
| 91 int frame_rate_numerator_; | 108 int frame_rate_numerator_; |
| 92 int frame_rate_denominator_; | 109 int frame_rate_denominator_; |
| 93 | 110 |
| 111 int aspect_ratio_numerator_; |
| 112 int aspect_ratio_denominator_; |
| 113 |
| 94 scoped_array<uint8> extra_data_; | 114 scoped_array<uint8> extra_data_; |
| 95 size_t extra_data_size_; | 115 size_t extra_data_size_; |
| 96 | 116 |
| 97 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); | 117 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); |
| 98 }; | 118 }; |
| 99 | 119 |
| 100 } // namespace media | 120 } // namespace media |
| 101 | 121 |
| 102 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 122 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| OLD | NEW |