OLD | NEW |
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 "chrome/gpu/media/fake_gl_video_device.h" | 5 #include "chrome/gpu/media/fake_gl_video_device.h" |
6 | 6 |
7 #include "app/gfx/gl/gl_bindings.h" | 7 #include "app/gfx/gl/gl_bindings.h" |
8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
9 | 9 |
10 void* FakeGlVideoDevice::GetDevice() { | 10 void* FakeGlVideoDevice::GetDevice() { |
(...skipping 19 matching lines...) Expand all Loading... |
30 frame); | 30 frame); |
31 return *frame != NULL; | 31 return *frame != NULL; |
32 } | 32 } |
33 | 33 |
34 void FakeGlVideoDevice::ReleaseVideoFrame( | 34 void FakeGlVideoDevice::ReleaseVideoFrame( |
35 const scoped_refptr<media::VideoFrame>& frame) { | 35 const scoped_refptr<media::VideoFrame>& frame) { |
36 // We didn't need to anything here because we didin't allocate any resources | 36 // We didn't need to anything here because we didin't allocate any resources |
37 // for the VideoFrame(s) generated. | 37 // for the VideoFrame(s) generated. |
38 } | 38 } |
39 | 39 |
40 bool FakeGlVideoDevice::UploadToVideoFrame( | 40 bool FakeGlVideoDevice::ConvertToVideoFrame( |
41 void* buffer, scoped_refptr<media::VideoFrame> frame) { | 41 void* buffer, scoped_refptr<media::VideoFrame> frame) { |
42 // Assume we are in the right context and then upload the content to the | 42 // Assume we are in the right context and then upload the content to the |
43 // texture. | 43 // texture. |
44 glBindTexture(GL_TEXTURE_2D, | 44 glBindTexture(GL_TEXTURE_2D, |
45 frame->gl_texture(media::VideoFrame::kRGBPlane)); | 45 frame->gl_texture(media::VideoFrame::kRGBPlane)); |
46 | 46 |
47 // |buffer| is also a VideoFrame. | 47 // |buffer| is also a VideoFrame. |
48 scoped_refptr<media::VideoFrame> frame_to_upload( | 48 scoped_refptr<media::VideoFrame> frame_to_upload( |
49 reinterpret_cast<media::VideoFrame*>(buffer)); | 49 reinterpret_cast<media::VideoFrame*>(buffer)); |
50 DCHECK_EQ(frame->width(), frame_to_upload->width()); | 50 DCHECK_EQ(frame->width(), frame_to_upload->width()); |
51 DCHECK_EQ(frame->height(), frame_to_upload->height()); | 51 DCHECK_EQ(frame->height(), frame_to_upload->height()); |
52 DCHECK_EQ(frame->format(), frame_to_upload->format()); | 52 DCHECK_EQ(frame->format(), frame_to_upload->format()); |
53 glTexImage2D( | 53 glTexImage2D( |
54 GL_TEXTURE_2D, 0, GL_RGBA, frame_to_upload->width(), | 54 GL_TEXTURE_2D, 0, GL_RGBA, frame_to_upload->width(), |
55 frame_to_upload->height(), 0, GL_RGBA, | 55 frame_to_upload->height(), 0, GL_RGBA, |
56 GL_UNSIGNED_BYTE, frame_to_upload->data(media::VideoFrame::kRGBPlane)); | 56 GL_UNSIGNED_BYTE, frame_to_upload->data(media::VideoFrame::kRGBPlane)); |
57 return true; | 57 return true; |
58 } | 58 } |
OLD | NEW |