| 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 "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // VideoFrame. The image data resides in |data| and is assumed to be packed | 141 // VideoFrame. The image data resides in |data| and is assumed to be packed |
| 142 // tightly in a buffer of logical dimensions |coded_size| with the appropriate | 142 // tightly in a buffer of logical dimensions |coded_size| with the appropriate |
| 143 // bit depth and plane count as given by |format|. When the frame is | 143 // bit depth and plane count as given by |format|. When the frame is |
| 144 // destroyed |no_longer_needed_cb.Run()| will be called. | 144 // destroyed |no_longer_needed_cb.Run()| will be called. |
| 145 static scoped_refptr<VideoFrame> WrapExternalSharedMemory( | 145 static scoped_refptr<VideoFrame> WrapExternalSharedMemory( |
| 146 Format format, | 146 Format format, |
| 147 const gfx::Size& coded_size, | 147 const gfx::Size& coded_size, |
| 148 const gfx::Rect& visible_rect, | 148 const gfx::Rect& visible_rect, |
| 149 const gfx::Size& natural_size, | 149 const gfx::Size& natural_size, |
| 150 uint8* data, | 150 uint8* data, |
| 151 size_t data_size, |
| 151 base::SharedMemoryHandle handle, | 152 base::SharedMemoryHandle handle, |
| 152 base::TimeDelta timestamp, | 153 base::TimeDelta timestamp, |
| 153 const base::Closure& no_longer_needed_cb); | 154 const base::Closure& no_longer_needed_cb); |
| 154 | 155 |
| 155 // Wraps external YUV data of the given parameters with a VideoFrame. | 156 // Wraps external YUV data of the given parameters with a VideoFrame. |
| 156 // The returned VideoFrame does not own the data passed in. When the frame | 157 // The returned VideoFrame does not own the data passed in. When the frame |
| 157 // is destroyed |no_longer_needed_cb.Run()| will be called. | 158 // is destroyed |no_longer_needed_cb.Run()| will be called. |
| 158 // TODO(sheu): merge this into WrapExternalSharedMemory(). | 159 // TODO(sheu): merge this into WrapExternalSharedMemory(). |
| 159 // http://crbug.com/270217 | 160 // http://crbug.com/270217 |
| 160 static scoped_refptr<VideoFrame> WrapExternalYuvData( | 161 static scoped_refptr<VideoFrame> WrapExternalYuvData( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 185 // equivalent of RGB(0,0,0). | 186 // equivalent of RGB(0,0,0). |
| 186 static scoped_refptr<VideoFrame> CreateBlackFrame(const gfx::Size& size); | 187 static scoped_refptr<VideoFrame> CreateBlackFrame(const gfx::Size& size); |
| 187 | 188 |
| 188 #if defined(GOOGLE_TV) | 189 #if defined(GOOGLE_TV) |
| 189 // Allocates a hole frame. | 190 // Allocates a hole frame. |
| 190 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); | 191 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); |
| 191 #endif | 192 #endif |
| 192 | 193 |
| 193 static size_t NumPlanes(Format format); | 194 static size_t NumPlanes(Format format); |
| 194 | 195 |
| 196 // Returns the required allocation size for a (tightly packed) frame of the |
| 197 // given coded size and format. |
| 198 static size_t AllocationSize(Format format, const gfx::Size& coded_size); |
| 199 |
| 195 Format format() const { return format_; } | 200 Format format() const { return format_; } |
| 196 | 201 |
| 197 const gfx::Size& coded_size() const { return coded_size_; } | 202 const gfx::Size& coded_size() const { return coded_size_; } |
| 198 const gfx::Rect& visible_rect() const { return visible_rect_; } | 203 const gfx::Rect& visible_rect() const { return visible_rect_; } |
| 199 const gfx::Size& natural_size() const { return natural_size_; } | 204 const gfx::Size& natural_size() const { return natural_size_; } |
| 200 | 205 |
| 201 int stride(size_t plane) const; | 206 int stride(size_t plane) const; |
| 202 | 207 |
| 203 // Returns the number of bytes per row and number of rows for a given plane. | 208 // Returns the number of bytes per row and number of rows for a given plane. |
| 204 // | 209 // |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 base::Closure no_longer_needed_cb_; | 290 base::Closure no_longer_needed_cb_; |
| 286 | 291 |
| 287 base::TimeDelta timestamp_; | 292 base::TimeDelta timestamp_; |
| 288 | 293 |
| 289 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 294 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 290 }; | 295 }; |
| 291 | 296 |
| 292 } // namespace media | 297 } // namespace media |
| 293 | 298 |
| 294 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 299 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |