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

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

Issue 9416087: Add texture target field to video frame (for use by native textures). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « media/base/video_frame.h ('k') | webkit/media/webvideoframe_impl.h » ('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 #include "media/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <GL/gl.h>
Ami GONE FROM CHROMIUM 2012/02/22 04:51:00 Can drop this if you take my suggestion below.
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "media/base/video_util.h" 10 #include "media/base/video_util.h"
9 11
10 namespace media { 12 namespace media {
11 13
12 // static 14 // static
13 scoped_refptr<VideoFrame> VideoFrame::CreateFrame( 15 scoped_refptr<VideoFrame> VideoFrame::CreateFrame(
14 VideoFrame::Format format, 16 VideoFrame::Format format,
15 size_t width, 17 size_t width,
16 size_t height, 18 size_t height,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( 52 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
51 uint32 texture_id, 53 uint32 texture_id,
52 size_t width, 54 size_t width,
53 size_t height, 55 size_t height,
54 base::TimeDelta timestamp, 56 base::TimeDelta timestamp,
55 base::TimeDelta duration, 57 base::TimeDelta duration,
56 const base::Closure& no_longer_needed) { 58 const base::Closure& no_longer_needed) {
57 scoped_refptr<VideoFrame> frame( 59 scoped_refptr<VideoFrame> frame(
58 new VideoFrame(NATIVE_TEXTURE, width, height, timestamp, duration)); 60 new VideoFrame(NATIVE_TEXTURE, width, height, timestamp, duration));
59 frame->texture_id_ = texture_id; 61 frame->texture_id_ = texture_id;
62 frame->texture_target_ = GL_TEXTURE_2D;
Ami GONE FROM CHROMIUM 2012/02/22 04:51:00 This smells wrong to me (b/c what's 2Dlicious abou
60 frame->texture_no_longer_needed_ = no_longer_needed; 63 frame->texture_no_longer_needed_ = no_longer_needed;
61 return frame; 64 return frame;
62 } 65 }
63 66
64 // static 67 // static
65 scoped_refptr<VideoFrame> VideoFrame::CreateEmptyFrame() { 68 scoped_refptr<VideoFrame> VideoFrame::CreateEmptyFrame() {
66 return new VideoFrame( 69 return new VideoFrame(
67 VideoFrame::EMPTY, 0, 0, base::TimeDelta(), base::TimeDelta()); 70 VideoFrame::EMPTY, 0, 0, base::TimeDelta(), base::TimeDelta());
68 } 71 }
69 72
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 134 }
132 135
133 VideoFrame::VideoFrame(VideoFrame::Format format, 136 VideoFrame::VideoFrame(VideoFrame::Format format,
134 size_t width, 137 size_t width,
135 size_t height, 138 size_t height,
136 base::TimeDelta timestamp, 139 base::TimeDelta timestamp,
137 base::TimeDelta duration) 140 base::TimeDelta duration)
138 : format_(format), 141 : format_(format),
139 width_(width), 142 width_(width),
140 height_(height), 143 height_(height),
141 texture_id_(0) { 144 texture_id_(0),
145 texture_target_(0) {
142 SetTimestamp(timestamp); 146 SetTimestamp(timestamp);
143 SetDuration(duration); 147 SetDuration(duration);
144 memset(&strides_, 0, sizeof(strides_)); 148 memset(&strides_, 0, sizeof(strides_));
145 memset(&data_, 0, sizeof(data_)); 149 memset(&data_, 0, sizeof(data_));
146 } 150 }
147 151
148 VideoFrame::~VideoFrame() { 152 VideoFrame::~VideoFrame() {
149 if (format_ == NATIVE_TEXTURE && !texture_no_longer_needed_.is_null()) { 153 if (format_ == NATIVE_TEXTURE && !texture_no_longer_needed_.is_null()) {
150 texture_no_longer_needed_.Run(); 154 texture_no_longer_needed_.Run();
151 texture_no_longer_needed_.Reset(); 155 texture_no_longer_needed_.Reset();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 uint8* VideoFrame::data(size_t plane) const { 245 uint8* VideoFrame::data(size_t plane) const {
242 DCHECK(IsValidPlane(plane)); 246 DCHECK(IsValidPlane(plane));
243 return data_[plane]; 247 return data_[plane];
244 } 248 }
245 249
246 uint32 VideoFrame::texture_id() const { 250 uint32 VideoFrame::texture_id() const {
247 DCHECK_EQ(format_, NATIVE_TEXTURE); 251 DCHECK_EQ(format_, NATIVE_TEXTURE);
248 return texture_id_; 252 return texture_id_;
249 } 253 }
250 254
255 uint32 VideoFrame::texture_target() const {
256 DCHECK_EQ(format_, NATIVE_TEXTURE);
257 return texture_target_;
258 }
259
251 bool VideoFrame::IsEndOfStream() const { 260 bool VideoFrame::IsEndOfStream() const {
252 return format_ == VideoFrame::EMPTY; 261 return format_ == VideoFrame::EMPTY;
253 } 262 }
254 263
255 } // namespace media 264 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | webkit/media/webvideoframe_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698