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 #include "base/file_descriptor_posix.h" | 5 #include "base/file_descriptor_posix.h" |
6 #include "media/gpu/va_surface.h" | 6 #include "media/gpu/va_surface.h" |
7 #include "media/gpu/vaapi_drm_picture.h" | 7 #include "media/gpu/vaapi_drm_picture.h" |
8 #include "media/gpu/vaapi_wrapper.h" | 8 #include "media/gpu/vaapi_wrapper.h" |
9 #include "third_party/libva/va/drm/va_drm.h" | 9 #include "third_party/libva/va/drm/va_drm.h" |
10 #include "third_party/libva/va/va.h" | 10 #include "third_party/libva/va/va.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return false; | 52 return false; |
53 } | 53 } |
54 | 54 |
55 pixmap_->SetProcessingCallback( | 55 pixmap_->SetProcessingCallback( |
56 base::Bind(&VaapiWrapper::ProcessPixmap, vaapi_wrapper_)); | 56 base::Bind(&VaapiWrapper::ProcessPixmap, vaapi_wrapper_)); |
57 | 57 |
58 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { | 58 if (texture_id_ != 0 && !make_context_current_cb_.is_null()) { |
59 if (!make_context_current_cb_.Run()) | 59 if (!make_context_current_cb_.Run()) |
60 return false; | 60 return false; |
61 | 61 |
62 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, | 62 gl::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
63 texture_id_); | 63 texture_id_); |
64 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( | 64 scoped_refptr<gl::GLImageOzoneNativePixmap> image( |
65 new gfx::GLImageOzoneNativePixmap(size_, GL_BGRA_EXT)); | 65 new gl::GLImageOzoneNativePixmap(size_, GL_BGRA_EXT)); |
66 if (!image->Initialize(pixmap_.get(), pixmap_->GetBufferFormat())) { | 66 if (!image->Initialize(pixmap_.get(), pixmap_->GetBufferFormat())) { |
67 LOG(ERROR) << "Failed to create GLImage"; | 67 LOG(ERROR) << "Failed to create GLImage"; |
68 return false; | 68 return false; |
69 } | 69 } |
70 gl_image_ = image; | 70 gl_image_ = image; |
71 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { | 71 if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { |
72 LOG(ERROR) << "Failed to bind texture to GLImage"; | 72 LOG(ERROR) << "Failed to bind texture to GLImage"; |
73 return false; | 73 return false; |
74 } | 74 } |
75 } | 75 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool VaapiDrmPicture::DownloadFromSurface( | 117 bool VaapiDrmPicture::DownloadFromSurface( |
118 const scoped_refptr<VASurface>& va_surface) { | 118 const scoped_refptr<VASurface>& va_surface) { |
119 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); | 119 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); |
120 } | 120 } |
121 | 121 |
122 bool VaapiDrmPicture::AllowOverlay() const { | 122 bool VaapiDrmPicture::AllowOverlay() const { |
123 return true; | 123 return true; |
124 } | 124 } |
125 | 125 |
126 } // namespace media | 126 } // namespace media |
OLD | NEW |