| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 5 |
| 6 #include "media/gpu/generic_v4l2_device.h" | 6 #include "media/gpu/generic_v4l2_device.h" |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <libdrm/drm_fourcc.h> | 10 #include <libdrm/drm_fourcc.h> |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 return egl_image; | 289 return egl_image; |
| 290 } | 290 } |
| 291 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); | 291 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); |
| 292 glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, egl_image); | 292 glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, egl_image); |
| 293 | 293 |
| 294 return egl_image; | 294 return egl_image; |
| 295 } | 295 } |
| 296 | 296 |
| 297 EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, | 297 EGLBoolean GenericV4L2Device::DestroyEGLImage(EGLDisplay egl_display, |
| 298 EGLImageKHR egl_image) { | 298 EGLImageKHR egl_image) { |
| 299 return eglDestroyImageKHR(egl_display, egl_image); | 299 EGLBoolean result = eglDestroyImageKHR(egl_display, egl_image); |
| 300 if (result != EGL_TRUE) { |
| 301 LOG(WARNING) << "Destroy EGLImage failed."; |
| 302 } |
| 303 return result; |
| 300 } | 304 } |
| 301 | 305 |
| 302 GLenum GenericV4L2Device::GetTextureTarget() { | 306 GLenum GenericV4L2Device::GetTextureTarget() { |
| 303 return GL_TEXTURE_EXTERNAL_OES; | 307 return GL_TEXTURE_EXTERNAL_OES; |
| 304 } | 308 } |
| 305 | 309 |
| 306 uint32_t GenericV4L2Device::PreferredInputFormat() { | 310 uint32_t GenericV4L2Device::PreferredInputFormat() { |
| 307 // TODO(posciak): We should support "dontcare" returns here once we | 311 // TODO(posciak): We should support "dontcare" returns here once we |
| 308 // implement proper handling (fallback, negotiation) for this in users. | 312 // implement proper handling (fallback, negotiation) for this in users. |
| 309 CHECK_EQ(type_, kEncoder); | 313 CHECK_EQ(type_, kEncoder); |
| 310 return V4L2_PIX_FMT_NV12M; | 314 return V4L2_PIX_FMT_NV12M; |
| 311 } | 315 } |
| 312 | 316 |
| 313 // static | 317 // static |
| 314 bool GenericV4L2Device::PostSandboxInitialization() { | 318 bool GenericV4L2Device::PostSandboxInitialization() { |
| 315 #if defined(USE_LIBV4L2) | 319 #if defined(USE_LIBV4L2) |
| 316 StubPathMap paths; | 320 StubPathMap paths; |
| 317 paths[kModuleV4l2].push_back(kV4l2Lib); | 321 paths[kModuleV4l2].push_back(kV4l2Lib); |
| 318 | 322 |
| 319 return InitializeStubs(paths); | 323 return InitializeStubs(paths); |
| 320 #else | 324 #else |
| 321 return true; | 325 return true; |
| 322 #endif | 326 #endif |
| 323 } | 327 } |
| 324 | 328 |
| 325 } // namespace media | 329 } // namespace media |
| OLD | NEW |