| 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 "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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // appropriate values before using. | 65 // appropriate values before using. |
| 66 VideoDecoderConfig(); | 66 VideoDecoderConfig(); |
| 67 | 67 |
| 68 // Constructs an initialized object. It is acceptable to pass in NULL for | 68 // Constructs an initialized object. It is acceptable to pass in NULL for |
| 69 // |extra_data|, otherwise the memory is copied. | 69 // |extra_data|, otherwise the memory is copied. |
| 70 VideoDecoderConfig(VideoCodec codec, | 70 VideoDecoderConfig(VideoCodec codec, |
| 71 VideoCodecProfile profile, | 71 VideoCodecProfile profile, |
| 72 VideoFrame::Format format, | 72 VideoFrame::Format format, |
| 73 const gfx::Size& coded_size, | 73 const gfx::Size& coded_size, |
| 74 const gfx::Rect& visible_rect, | 74 const gfx::Rect& visible_rect, |
| 75 int frame_rate_numerator, int frame_rate_denominator, | |
| 76 int aspect_ratio_numerator, int aspect_ratio_denominator, | 75 int aspect_ratio_numerator, int aspect_ratio_denominator, |
| 77 const uint8* extra_data, size_t extra_data_size); | 76 const uint8* extra_data, size_t extra_data_size); |
| 78 | 77 |
| 79 ~VideoDecoderConfig(); | 78 ~VideoDecoderConfig(); |
| 80 | 79 |
| 81 // Resets the internal state of this object. | 80 // Resets the internal state of this object. |
| 82 void Initialize(VideoCodec codec, | 81 void Initialize(VideoCodec codec, |
| 83 VideoCodecProfile profile, | 82 VideoCodecProfile profile, |
| 84 VideoFrame::Format format, | 83 VideoFrame::Format format, |
| 85 const gfx::Size& coded_size, | 84 const gfx::Size& coded_size, |
| 86 const gfx::Rect& visible_rect, | 85 const gfx::Rect& visible_rect, |
| 87 int frame_rate_numerator, int frame_rate_denominator, | |
| 88 int aspect_ratio_numerator, int aspect_ratio_denominator, | 86 int aspect_ratio_numerator, int aspect_ratio_denominator, |
| 89 const uint8* extra_data, size_t extra_data_size, | 87 const uint8* extra_data, size_t extra_data_size, |
| 90 bool record_stats); | 88 bool record_stats); |
| 91 | 89 |
| 92 // Deep copies |video_config|. | 90 // Deep copies |video_config|. |
| 93 void CopyFrom(const VideoDecoderConfig& video_config); | 91 void CopyFrom(const VideoDecoderConfig& video_config); |
| 94 | 92 |
| 95 // Returns true if this object has appropriate configuration values, false | 93 // Returns true if this object has appropriate configuration values, false |
| 96 // otherwise. | 94 // otherwise. |
| 97 bool IsValidConfig() const; | 95 bool IsValidConfig() const; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 114 // in this region are valid. | 112 // in this region are valid. |
| 115 gfx::Size coded_size() const; | 113 gfx::Size coded_size() const; |
| 116 | 114 |
| 117 // Region of |coded_size_| that is visible. | 115 // Region of |coded_size_| that is visible. |
| 118 gfx::Rect visible_rect() const; | 116 gfx::Rect visible_rect() const; |
| 119 | 117 |
| 120 // Final visible width and height of a video frame with aspect ratio taken | 118 // Final visible width and height of a video frame with aspect ratio taken |
| 121 // into account. | 119 // into account. |
| 122 gfx::Size natural_size() const; | 120 gfx::Size natural_size() const; |
| 123 | 121 |
| 124 // Frame rate in seconds expressed as a fraction. | |
| 125 // | |
| 126 // This information is required to properly timestamp video frames for | |
| 127 // codecs that contain repeated frames, such as found in H.264's | |
| 128 // supplemental enhancement information. | |
| 129 int frame_rate_numerator() const; | |
| 130 int frame_rate_denominator() const; | |
| 131 | |
| 132 // Aspect ratio of the decoded video frame expressed as a fraction. | 122 // Aspect ratio of the decoded video frame expressed as a fraction. |
| 133 // | 123 // |
| 134 // TODO(scherkus): think of a better way to avoid having video decoders | 124 // TODO(scherkus): think of a better way to avoid having video decoders |
| 135 // handle tricky aspect ratio dimension calculations. | 125 // handle tricky aspect ratio dimension calculations. |
| 136 int aspect_ratio_numerator() const; | 126 int aspect_ratio_numerator() const; |
| 137 int aspect_ratio_denominator() const; | 127 int aspect_ratio_denominator() const; |
| 138 | 128 |
| 139 // Optional byte data required to initialize video decoders, such as H.264 | 129 // Optional byte data required to initialize video decoders, such as H.264 |
| 140 // AAVC data. | 130 // AAVC data. |
| 141 uint8* extra_data() const; | 131 uint8* extra_data() const; |
| 142 size_t extra_data_size() const; | 132 size_t extra_data_size() const; |
| 143 | 133 |
| 144 private: | 134 private: |
| 145 VideoCodec codec_; | 135 VideoCodec codec_; |
| 146 VideoCodecProfile profile_; | 136 VideoCodecProfile profile_; |
| 147 | 137 |
| 148 VideoFrame::Format format_; | 138 VideoFrame::Format format_; |
| 149 | 139 |
| 150 gfx::Size coded_size_; | 140 gfx::Size coded_size_; |
| 151 gfx::Rect visible_rect_; | 141 gfx::Rect visible_rect_; |
| 152 gfx::Size natural_size_; | 142 gfx::Size natural_size_; |
| 153 | 143 |
| 154 int frame_rate_numerator_; | |
| 155 int frame_rate_denominator_; | |
| 156 | |
| 157 int aspect_ratio_numerator_; | 144 int aspect_ratio_numerator_; |
| 158 int aspect_ratio_denominator_; | 145 int aspect_ratio_denominator_; |
| 159 | 146 |
| 160 scoped_array<uint8> extra_data_; | 147 scoped_array<uint8> extra_data_; |
| 161 size_t extra_data_size_; | 148 size_t extra_data_size_; |
| 162 | 149 |
| 163 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); | 150 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); |
| 164 }; | 151 }; |
| 165 | 152 |
| 166 } // namespace media | 153 } // namespace media |
| 167 | 154 |
| 168 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 155 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
| OLD | NEW |