| 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 "media/video/gpu_memory_buffer_video_frame_pool.h" | 5 #include "media/video/gpu_memory_buffer_video_frame_pool.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 gles2->ActiveTexture(GL_TEXTURE0); | 256 gles2->ActiveTexture(GL_TEXTURE0); |
| 257 size_t planes = VideoFrame::NumPlanes(format); | 257 size_t planes = VideoFrame::NumPlanes(format); |
| 258 FrameResources* frame_resources = new FrameResources(format, size); | 258 FrameResources* frame_resources = new FrameResources(format, size); |
| 259 resources_pool_.push_back(frame_resources); | 259 resources_pool_.push_back(frame_resources); |
| 260 for (size_t i = 0; i < planes; ++i) { | 260 for (size_t i = 0; i < planes; ++i) { |
| 261 PlaneResource& plane_resource = frame_resources->plane_resources[i]; | 261 PlaneResource& plane_resource = frame_resources->plane_resources[i]; |
| 262 const size_t width = VideoFrame::Columns(i, format, size.width()); | 262 const size_t width = VideoFrame::Columns(i, format, size.width()); |
| 263 const size_t height = VideoFrame::Rows(i, format, size.height()); | 263 const size_t height = VideoFrame::Rows(i, format, size.height()); |
| 264 const gfx::Size plane_size(width, height); | 264 const gfx::Size plane_size(width, height); |
| 265 plane_resource.gpu_memory_buffer = gpu_factories_->AllocateGpuMemoryBuffer( | 265 plane_resource.gpu_memory_buffer = gpu_factories_->AllocateGpuMemoryBuffer( |
| 266 plane_size, gfx::GpuMemoryBuffer::R_8, gfx::GpuMemoryBuffer::MAP); | 266 plane_size, gfx::BufferFormat::R_8, gfx::BufferUsage::MAP); |
| 267 | 267 |
| 268 gles2->GenTextures(1, &plane_resource.texture_id); | 268 gles2->GenTextures(1, &plane_resource.texture_id); |
| 269 gles2->BindTexture(texture_target_, plane_resource.texture_id); | 269 gles2->BindTexture(texture_target_, plane_resource.texture_id); |
| 270 gles2->TexParameteri(texture_target_, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 270 gles2->TexParameteri(texture_target_, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 271 gles2->TexParameteri(texture_target_, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 271 gles2->TexParameteri(texture_target_, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 272 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 272 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 273 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 273 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 274 gles2->GenMailboxCHROMIUM(plane_resource.mailbox.name); | 274 gles2->GenMailboxCHROMIUM(plane_resource.mailbox.name); |
| 275 gles2->ProduceTextureCHROMIUM(texture_target_, plane_resource.mailbox.name); | 275 gles2->ProduceTextureCHROMIUM(texture_target_, plane_resource.mailbox.name); |
| 276 } | 276 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 #endif | 346 #endif |
| 347 case PIXEL_FORMAT_ARGB: | 347 case PIXEL_FORMAT_ARGB: |
| 348 case PIXEL_FORMAT_XRGB: | 348 case PIXEL_FORMAT_XRGB: |
| 349 case PIXEL_FORMAT_UNKNOWN: | 349 case PIXEL_FORMAT_UNKNOWN: |
| 350 break; | 350 break; |
| 351 } | 351 } |
| 352 return video_frame; | 352 return video_frame; |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace media | 355 } // namespace media |
| OLD | NEW |