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

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

Issue 22645005: media::VideoFrame::WrapExternalSharedMemory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: 87b7a18a Rebase, added TODO Created 7 years, 4 months 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
« no previous file with comments | « content/renderer/pepper/content_decryptor_delegate.cc ('k') | media/base/video_frame.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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
143 // bit depth and plane count as given by |format|. When the frame is
144 // destroyed |no_longer_needed_cb.Run()| will be called.
145 static scoped_refptr<VideoFrame> WrapExternalSharedMemory(
146 Format format,
147 const gfx::Size& coded_size,
148 const gfx::Rect& visible_rect,
149 const gfx::Size& natural_size,
150 uint8* data,
151 base::SharedMemoryHandle handle,
152 base::TimeDelta timestamp,
153 const base::Closure& no_longer_needed_cb);
154
140 // Wraps external YUV data of the given parameters with a VideoFrame. 155 // Wraps external YUV data of the given parameters with a VideoFrame.
141 // The returned VideoFrame does not own the data passed in. When the frame 156 // The returned VideoFrame does not own the data passed in. When the frame
142 // is destroyed |no_longer_needed_cb.Run()| will be called. 157 // is destroyed |no_longer_needed_cb.Run()| will be called.
158 // TODO(sheu): merge this into WrapExternalSharedMemory().
159 // http://crbug.com/270217
143 static scoped_refptr<VideoFrame> WrapExternalYuvData( 160 static scoped_refptr<VideoFrame> WrapExternalYuvData(
144 Format format, 161 Format format,
145 const gfx::Size& coded_size, 162 const gfx::Size& coded_size,
146 const gfx::Rect& visible_rect, 163 const gfx::Rect& visible_rect,
147 const gfx::Size& natural_size, 164 const gfx::Size& natural_size,
148 int32 y_stride, 165 int32 y_stride,
149 int32 u_stride, 166 int32 u_stride,
150 int32 v_stride, 167 int32 v_stride,
151 uint8* y_data, 168 uint8* y_data,
152 uint8* u_data, 169 uint8* u_data,
153 uint8* v_data, 170 uint8* v_data,
154 base::TimeDelta timestamp, 171 base::TimeDelta timestamp,
155 base::SharedMemoryHandle shm_handle, // may be NULLHandle()
156 const base::Closure& no_longer_needed_cb); 172 const base::Closure& no_longer_needed_cb);
157 173
158 // Creates a frame with format equals to VideoFrame::EMPTY, width, height, 174 // Creates a frame with format equals to VideoFrame::EMPTY, width, height,
159 // and timestamp are all 0. 175 // and timestamp are all 0.
160 static scoped_refptr<VideoFrame> CreateEmptyFrame(); 176 static scoped_refptr<VideoFrame> CreateEmptyFrame();
161 177
162 // Allocates YV12 frame based on |size|, and sets its data to the YUV(y,u,v). 178 // Allocates YV12 frame based on |size|, and sets its data to the YUV(y,u,v).
163 static scoped_refptr<VideoFrame> CreateColorFrame( 179 static scoped_refptr<VideoFrame> CreateColorFrame(
164 const gfx::Size& size, 180 const gfx::Size& size,
165 uint8 y, uint8 u, uint8 v, 181 uint8 y, uint8 u, uint8 v,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 base::Closure no_longer_needed_cb_; 285 base::Closure no_longer_needed_cb_;
270 286
271 base::TimeDelta timestamp_; 287 base::TimeDelta timestamp_;
272 288
273 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); 289 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);
274 }; 290 };
275 291
276 } // namespace media 292 } // namespace media
277 293
278 #endif // MEDIA_BASE_VIDEO_FRAME_H_ 294 #endif // MEDIA_BASE_VIDEO_FRAME_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/content_decryptor_delegate.cc ('k') | media/base/video_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698