OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/media/cma/filters/hole_frame_factory.h" | 5 #include "chromecast/renderer/media/hole_frame_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
11 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
12 #include "media/renderers/gpu_video_accelerator_factories.h" | 12 #include "media/renderers/gpu_video_accelerator_factories.h" |
13 | 13 |
14 namespace chromecast { | 14 namespace chromecast { |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 HoleFrameFactory::HoleFrameFactory( | 17 HoleFrameFactory::HoleFrameFactory( |
18 const scoped_refptr<::media::GpuVideoAcceleratorFactories>& gpu_factories) | 18 const scoped_refptr<::media::GpuVideoAcceleratorFactories>& gpu_factories) |
19 : gpu_factories_(gpu_factories), | 19 : gpu_factories_(gpu_factories), texture_(0), image_id_(0), sync_point_(0) { |
20 texture_(0), | |
21 image_id_(0), | |
22 sync_point_(0) { | |
23 if (gpu_factories_) { | 20 if (gpu_factories_) { |
24 gpu::gles2::GLES2Interface* gl = gpu_factories_->GetGLES2Interface(); | 21 gpu::gles2::GLES2Interface* gl = gpu_factories_->GetGLES2Interface(); |
25 CHECK(gl); | 22 CHECK(gl); |
26 | 23 |
27 gl->GenTextures(1, &texture_); | 24 gl->GenTextures(1, &texture_); |
28 gl->BindTexture(GL_TEXTURE_2D, texture_); | 25 gl->BindTexture(GL_TEXTURE_2D, texture_); |
29 image_id_ = gl->CreateGpuMemoryBufferImageCHROMIUM(1, 1, GL_RGBA, | 26 image_id_ = gl->CreateGpuMemoryBufferImageCHROMIUM( |
30 GL_SCANOUT_CHROMIUM); | 27 1, 1, GL_RGBA, GL_SCANOUT_CHROMIUM); |
31 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_); | 28 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_); |
32 | 29 |
33 gl->GenMailboxCHROMIUM(mailbox_.name); | 30 gl->GenMailboxCHROMIUM(mailbox_.name); |
34 gl->ProduceTextureDirectCHROMIUM(texture_, GL_TEXTURE_2D, mailbox_.name); | 31 gl->ProduceTextureDirectCHROMIUM(texture_, GL_TEXTURE_2D, mailbox_.name); |
35 | 32 |
36 sync_point_ = gl->InsertSyncPointCHROMIUM(); | 33 sync_point_ = gl->InsertSyncPointCHROMIUM(); |
37 } | 34 } |
38 } | 35 } |
39 | 36 |
40 HoleFrameFactory::~HoleFrameFactory() { | 37 HoleFrameFactory::~HoleFrameFactory() { |
(...skipping 22 matching lines...) Expand all Loading... |
63 true); | 60 true); |
64 return frame; | 61 return frame; |
65 } else { | 62 } else { |
66 // This case is needed for audio-only devices. | 63 // This case is needed for audio-only devices. |
67 return ::media::VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); | 64 return ::media::VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); |
68 } | 65 } |
69 } | 66 } |
70 | 67 |
71 } // namespace media | 68 } // namespace media |
72 } // namespace chromecast | 69 } // namespace chromecast |
OLD | NEW |