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_FRAME_H_ | 5 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ |
6 #define MEDIA_BASE_VIDEO_FRAME_H_ | 6 #define MEDIA_BASE_VIDEO_FRAME_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 return duration_; | 112 return duration_; |
113 } | 113 } |
114 void SetDuration(const base::TimeDelta& duration) { | 114 void SetDuration(const base::TimeDelta& duration) { |
115 duration_ = duration; | 115 duration_ = duration; |
116 } | 116 } |
117 | 117 |
118 // Used to keep a running hash of seen frames. Expects an initialized MD5 | 118 // Used to keep a running hash of seen frames. Expects an initialized MD5 |
119 // context. Calls MD5Update with the context and the contents of the frame. | 119 // context. Calls MD5Update with the context and the contents of the frame. |
120 void HashFrameForTesting(base::MD5Context* context); | 120 void HashFrameForTesting(base::MD5Context* context); |
121 | 121 |
122 private: | |
123 friend class base::RefCountedThreadSafe<VideoFrame>; | |
124 // Clients must use the static CreateFrame() method to create a new frame. | |
125 VideoFrame(Format format, | 122 VideoFrame(Format format, |
126 size_t video_width, | 123 size_t video_width, |
127 size_t video_height, | 124 size_t video_height, |
128 base::TimeDelta timestamp, | 125 base::TimeDelta timestamp, |
129 base::TimeDelta duration); | 126 base::TimeDelta duration); |
127 int AllocateAlignedWithStrides(int strides[], int aligned_h); | |
Ami GONE FROM CHROMIUM
2012/05/26 22:52:34
This change (ctor public, add public allocate meth
| |
128 | |
129 private: | |
130 friend class base::RefCountedThreadSafe<VideoFrame>; | |
130 virtual ~VideoFrame(); | 131 virtual ~VideoFrame(); |
131 | 132 |
132 // Used internally by CreateFrame(). | 133 // Used internally by CreateFrame(). |
133 void AllocateRGB(size_t bytes_per_pixel); | 134 void AllocateRGB(size_t bytes_per_pixel); |
134 void AllocateYUV(); | 135 void AllocateYUV(); |
135 | 136 |
136 // Used to DCHECK() plane parameters. | 137 // Used to DCHECK() plane parameters. |
137 bool IsValidPlane(size_t plane) const; | 138 bool IsValidPlane(size_t plane) const; |
138 | 139 |
139 // Frame format. | 140 // Frame format. |
140 Format format_; | 141 Format format_; |
141 | 142 |
142 // Width and height of surface. | 143 // Width and height of surface. |
143 size_t width_; | 144 size_t width_; |
144 size_t height_; | 145 size_t height_; |
145 | 146 |
146 // Array of strides for each plane, typically greater or equal to the width | 147 // Array of strides for each plane, typically greater or equal to the width |
147 // of the surface divided by the horizontal sampling period. Note that | 148 // of the surface divided by the horizontal sampling period. Note that |
148 // strides can be negative. | 149 // strides can be negative. |
149 int32 strides_[kMaxPlanes]; | 150 int32 strides_[kMaxPlanes]; |
150 | 151 |
151 // Array of data pointers to each plane. | 152 // Array of data pointers to each plane. |
152 uint8* data_[kMaxPlanes]; | 153 uint8* data_[kMaxPlanes]; |
154 int is_aligned_alloc_; | |
153 | 155 |
154 // Native texture ID, if this is a NATIVE_TEXTURE frame. | 156 // Native texture ID, if this is a NATIVE_TEXTURE frame. |
155 uint32 texture_id_; | 157 uint32 texture_id_; |
156 uint32 texture_target_; | 158 uint32 texture_target_; |
157 base::Closure texture_no_longer_needed_; | 159 base::Closure texture_no_longer_needed_; |
158 | 160 |
159 base::TimeDelta timestamp_; | 161 base::TimeDelta timestamp_; |
160 base::TimeDelta duration_; | 162 base::TimeDelta duration_; |
161 | 163 |
162 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 164 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
163 }; | 165 }; |
164 | 166 |
165 } // namespace media | 167 } // namespace media |
166 | 168 |
167 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 169 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |