Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: media/base/video_frame.h

Issue 48113011: Remove media::VideoFrame from media::VideoCaptureDevice::Client interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: 4969ee91 Initial. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const gfx::Size& natural_size, 130 const gfx::Size& natural_size,
131 base::TimeDelta timestamp, 131 base::TimeDelta timestamp,
132 const ReadPixelsCB& read_pixels_cb, 132 const ReadPixelsCB& read_pixels_cb,
133 const base::Closure& no_longer_needed_cb); 133 const base::Closure& no_longer_needed_cb);
134 134
135 // Read pixels from the native texture backing |*this| and write 135 // Read pixels from the native texture backing |*this| and write
136 // them to |pixels| as BGRA. |pixels| must point to a buffer at 136 // them to |pixels| as BGRA. |pixels| must point to a buffer at
137 // least as large as 4*visible_rect().width()*visible_rect().height(). 137 // least as large as 4*visible_rect().width()*visible_rect().height().
138 void ReadPixelsFromNativeTexture(const SkBitmap& pixels); 138 void ReadPixelsFromNativeTexture(const SkBitmap& pixels);
139 139
140 // Wraps image data in a buffer backed by a base::SharedMemoryHandle with a 140 // Wraps packed image data residing in a memory buffer with a VideoFrame.
141 // VideoFrame. The image data resides in |data| and is assumed to be packed 141 // The image data resides in |data| and is assumed to be packed tightly in a
142 // tightly in a buffer of logical dimensions |coded_size| with the appropriate 142 // buffer of logical dimensions |coded_size| with the appropriate bit depth
143 // bit depth and plane count as given by |format|. When the frame is 143 // and plane count as given by |format|. The shared memory handle of the
144 // destroyed |no_longer_needed_cb.Run()| will be called. 144 // backing allocation, if present, can be passed in with |handle|. When the
145 static scoped_refptr<VideoFrame> WrapExternalSharedMemory( 145 // frame is destroyed, |no_longer_needed_cb.Run()| will be called.
146 static scoped_refptr<VideoFrame> WrapExternalPackedMemory(
146 Format format, 147 Format format,
147 const gfx::Size& coded_size, 148 const gfx::Size& coded_size,
148 const gfx::Rect& visible_rect, 149 const gfx::Rect& visible_rect,
149 const gfx::Size& natural_size, 150 const gfx::Size& natural_size,
150 uint8* data, 151 uint8* data,
151 size_t data_size, 152 size_t data_size,
152 base::SharedMemoryHandle handle, 153 base::SharedMemoryHandle handle,
153 base::TimeDelta timestamp, 154 base::TimeDelta timestamp,
154 const base::Closure& no_longer_needed_cb); 155 const base::Closure& no_longer_needed_cb);
155 156
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Allocates a hole frame. 191 // Allocates a hole frame.
191 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); 192 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size);
192 #endif 193 #endif
193 194
194 static size_t NumPlanes(Format format); 195 static size_t NumPlanes(Format format);
195 196
196 // Returns the required allocation size for a (tightly packed) frame of the 197 // Returns the required allocation size for a (tightly packed) frame of the
197 // given coded size and format. 198 // given coded size and format.
198 static size_t AllocationSize(Format format, const gfx::Size& coded_size); 199 static size_t AllocationSize(Format format, const gfx::Size& coded_size);
199 200
201 // Returns the required allocation size for a (tightly packed) plane of the
202 // given coded size and format.
203 static size_t PlaneAllocationSize(Format format,
204 size_t plane,
205 const gfx::Size& coded_size);
206
200 Format format() const { return format_; } 207 Format format() const { return format_; }
201 208
202 const gfx::Size& coded_size() const { return coded_size_; } 209 const gfx::Size& coded_size() const { return coded_size_; }
203 const gfx::Rect& visible_rect() const { return visible_rect_; } 210 const gfx::Rect& visible_rect() const { return visible_rect_; }
204 const gfx::Size& natural_size() const { return natural_size_; } 211 const gfx::Size& natural_size() const { return natural_size_; }
205 212
206 int stride(size_t plane) const; 213 int stride(size_t plane) const;
207 214
208 // Returns the number of bytes per row and number of rows for a given plane. 215 // Returns the number of bytes per row and number of rows for a given plane.
209 // 216 //
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 base::Closure no_longer_needed_cb_; 297 base::Closure no_longer_needed_cb_;
291 298
292 base::TimeDelta timestamp_; 299 base::TimeDelta timestamp_;
293 300
294 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); 301 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);
295 }; 302 };
296 303
297 } // namespace media 304 } // namespace media
298 305
299 #endif // MEDIA_BASE_VIDEO_FRAME_H_ 306 #endif // MEDIA_BASE_VIDEO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698