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

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

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 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 | Annotate | Revision Log
« no previous file with comments | « media/base/seekable_buffer_unittest.cc ('k') | media/filters/audio_renderer_base_unittest.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 21 matching lines...) Expand all
32 void VideoFrame::CreateFrame(VideoFrame::Format format, 32 void VideoFrame::CreateFrame(VideoFrame::Format format,
33 size_t width, 33 size_t width,
34 size_t height, 34 size_t height,
35 base::TimeDelta timestamp, 35 base::TimeDelta timestamp,
36 base::TimeDelta duration, 36 base::TimeDelta duration,
37 scoped_refptr<VideoFrame>* frame_out) { 37 scoped_refptr<VideoFrame>* frame_out) {
38 DCHECK(width > 0 && height > 0); 38 DCHECK(width > 0 && height > 0);
39 DCHECK(width * height < 100000000); 39 DCHECK(width * height < 100000000);
40 DCHECK(frame_out); 40 DCHECK(frame_out);
41 bool alloc_worked = false; 41 bool alloc_worked = false;
42 scoped_refptr<VideoFrame> frame = 42 scoped_refptr<VideoFrame> frame(
43 new VideoFrame(VideoFrame::TYPE_SYSTEM_MEMORY, format, width, height); 43 new VideoFrame(VideoFrame::TYPE_SYSTEM_MEMORY, format, width, height));
44 if (frame) { 44 if (frame) {
45 frame->SetTimestamp(timestamp); 45 frame->SetTimestamp(timestamp);
46 frame->SetDuration(duration); 46 frame->SetDuration(duration);
47 switch (format) { 47 switch (format) {
48 case VideoFrame::RGB555: 48 case VideoFrame::RGB555:
49 case VideoFrame::RGB565: 49 case VideoFrame::RGB565:
50 alloc_worked = frame->AllocateRGB(2u); 50 alloc_worked = frame->AllocateRGB(2u);
51 break; 51 break;
52 case VideoFrame::RGB24: 52 case VideoFrame::RGB24:
53 alloc_worked = frame->AllocateRGB(3u); 53 alloc_worked = frame->AllocateRGB(3u);
(...skipping 24 matching lines...) Expand all
78 size_t width, 78 size_t width,
79 size_t height, 79 size_t height,
80 size_t planes, 80 size_t planes,
81 uint8* const data[kMaxPlanes], 81 uint8* const data[kMaxPlanes],
82 const int32 strides[kMaxPlanes], 82 const int32 strides[kMaxPlanes],
83 base::TimeDelta timestamp, 83 base::TimeDelta timestamp,
84 base::TimeDelta duration, 84 base::TimeDelta duration,
85 void* private_buffer, 85 void* private_buffer,
86 scoped_refptr<VideoFrame>* frame_out) { 86 scoped_refptr<VideoFrame>* frame_out) {
87 DCHECK(frame_out); 87 DCHECK(frame_out);
88 scoped_refptr<VideoFrame> frame = 88 scoped_refptr<VideoFrame> frame(
89 new VideoFrame(type, format, width, height); 89 new VideoFrame(type, format, width, height));
90 if (frame) { 90 if (frame) {
91 frame->SetTimestamp(timestamp); 91 frame->SetTimestamp(timestamp);
92 frame->SetDuration(duration); 92 frame->SetDuration(duration);
93 frame->external_memory_ = true; 93 frame->external_memory_ = true;
94 frame->planes_ = planes; 94 frame->planes_ = planes;
95 frame->private_buffer_ = private_buffer; 95 frame->private_buffer_ = private_buffer;
96 for (size_t i = 0; i < kMaxPlanes; ++i) { 96 for (size_t i = 0; i < kMaxPlanes; ++i) {
97 frame->data_[i] = data[i]; 97 frame->data_[i] = data[i];
98 frame->strides_[i] = strides[i]; 98 frame->strides_[i] = strides[i];
99 } 99 }
100 } 100 }
101 *frame_out = frame; 101 *frame_out = frame;
102 } 102 }
103 103
104 // static 104 // static
105 void VideoFrame::CreateFrameGlTexture(Format format, 105 void VideoFrame::CreateFrameGlTexture(Format format,
106 size_t width, 106 size_t width,
107 size_t height, 107 size_t height,
108 GlTexture const textures[kMaxPlanes], 108 GlTexture const textures[kMaxPlanes],
109 scoped_refptr<VideoFrame>* frame_out) { 109 scoped_refptr<VideoFrame>* frame_out) {
110 DCHECK(frame_out); 110 DCHECK(frame_out);
111 scoped_refptr<VideoFrame> frame = 111 scoped_refptr<VideoFrame> frame(
112 new VideoFrame(TYPE_GL_TEXTURE, format, width, height); 112 new VideoFrame(TYPE_GL_TEXTURE, format, width, height));
113 if (frame) { 113 if (frame) {
114 frame->external_memory_ = true; 114 frame->external_memory_ = true;
115 frame->planes_ = GetNumberOfPlanes(format); 115 frame->planes_ = GetNumberOfPlanes(format);
116 for (size_t i = 0; i < kMaxPlanes; ++i) { 116 for (size_t i = 0; i < kMaxPlanes; ++i) {
117 frame->gl_textures_[i] = textures[i]; 117 frame->gl_textures_[i] = textures[i];
118 // TODO(hclam): Fix me for color format other than RGBA. 118 // TODO(hclam): Fix me for color format other than RGBA.
119 frame->strides_[i] = width; 119 frame->strides_[i] = width;
120 } 120 }
121 } 121 }
122 *frame_out = frame; 122 *frame_out = frame;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // so just delete index 0. 245 // so just delete index 0.
246 if (!external_memory_) 246 if (!external_memory_)
247 delete[] data_[0]; 247 delete[] data_[0];
248 } 248 }
249 249
250 bool VideoFrame::IsEndOfStream() const { 250 bool VideoFrame::IsEndOfStream() const {
251 return format_ == VideoFrame::EMPTY; 251 return format_ == VideoFrame::EMPTY;
252 } 252 }
253 253
254 } // namespace media 254 } // namespace media
OLDNEW
« no previous file with comments | « media/base/seekable_buffer_unittest.cc ('k') | media/filters/audio_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698