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 |
73 // Frame rate in seconds expressed as a fraction. | 75 // Frame rate in seconds expressed as a fraction. |
74 // TODO(scherkus): fairly certain decoders don't require frame rates. | 76 // |
| 77 // This information is required to properly timestamp video frames for |
| 78 // codecs that contain repeated frames, such as found in H.264's |
| 79 // supplemental enhancement information. |
75 int frame_rate_numerator() const; | 80 int frame_rate_numerator() const; |
76 int frame_rate_denominator() const; | 81 int frame_rate_denominator() const; |
77 | 82 |
| 83 // Aspect ratio of the decoded video frame expressed as a fraction. |
| 84 // |
| 85 // TODO(scherkus): think of a better way to avoid having video decoders |
| 86 // handle tricky aspect ratio dimension calculations. |
| 87 int aspect_ratio_numerator() const; |
| 88 int aspect_ratio_denominator() const; |
| 89 |
78 // Optional byte data required to initialize video decoders, such as H.264 | 90 // Optional byte data required to initialize video decoders, such as H.264 |
79 // AAVC data. | 91 // AAVC data. |
80 uint8* extra_data() const; | 92 uint8* extra_data() const; |
81 size_t extra_data_size() const; | 93 size_t extra_data_size() const; |
82 | 94 |
83 private: | 95 private: |
84 VideoCodec codec_; | 96 VideoCodec codec_; |
85 | 97 |
86 VideoFrame::Format format_; | 98 VideoFrame::Format format_; |
87 | 99 |
88 gfx::Size coded_size_; | 100 gfx::Size coded_size_; |
89 gfx::Rect visible_rect_; | 101 gfx::Rect visible_rect_; |
90 | 102 |
91 int frame_rate_numerator_; | 103 int frame_rate_numerator_; |
92 int frame_rate_denominator_; | 104 int frame_rate_denominator_; |
93 | 105 |
| 106 int aspect_ratio_numerator_; |
| 107 int aspect_ratio_denominator_; |
| 108 |
94 scoped_array<uint8> extra_data_; | 109 scoped_array<uint8> extra_data_; |
95 size_t extra_data_size_; | 110 size_t extra_data_size_; |
96 | 111 |
97 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); | 112 DISALLOW_COPY_AND_ASSIGN(VideoDecoderConfig); |
98 }; | 113 }; |
99 | 114 |
100 } // namespace media | 115 } // namespace media |
101 | 116 |
102 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ | 117 #endif // MEDIA_BASE_VIDEO_DECODER_CONFIG_H_ |
OLD | NEW |