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 "media/gpu/vt_video_decode_accelerator_mac.h" | 5 #include "media/gpu/vt_video_decode_accelerator_mac.h" |
6 | 6 |
7 #include <CoreVideo/CoreVideo.h> | 7 #include <CoreVideo/CoreVideo.h> |
8 #include <OpenGL/CGLIOSurface.h> | 8 #include <OpenGL/CGLIOSurface.h> |
9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 PictureInfo* picture_info = picture_info_map_.find(picture_id)->second.get(); | 1030 PictureInfo* picture_info = picture_info_map_.find(picture_id)->second.get(); |
1031 DCHECK(!picture_info->cv_image); | 1031 DCHECK(!picture_info->cv_image); |
1032 DCHECK(!picture_info->gl_image); | 1032 DCHECK(!picture_info->gl_image); |
1033 | 1033 |
1034 if (!make_context_current_cb_.Run()) { | 1034 if (!make_context_current_cb_.Run()) { |
1035 DLOG(ERROR) << "Failed to make GL context current"; | 1035 DLOG(ERROR) << "Failed to make GL context current"; |
1036 NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR); | 1036 NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR); |
1037 return false; | 1037 return false; |
1038 } | 1038 } |
1039 | 1039 |
| 1040 IOSurfaceRef io_surface = CVPixelBufferGetIOSurface(frame.image.get()); |
| 1041 |
1040 scoped_refptr<gl::GLImageIOSurface> gl_image( | 1042 scoped_refptr<gl::GLImageIOSurface> gl_image( |
1041 new gl::GLImageIOSurface(frame.coded_size, GL_BGRA_EXT)); | 1043 new gl::GLImageIOSurface(frame.coded_size, GL_BGRA_EXT)); |
1042 if (!gl_image->InitializeWithCVPixelBuffer( | 1044 if (!gl_image->Initialize(io_surface, gfx::GenericSharedMemoryId(), |
1043 frame.image.get(), gfx::GenericSharedMemoryId(), | 1045 gfx::BufferFormat::YUV_420_BIPLANAR)) { |
1044 gfx::BufferFormat::YUV_420_BIPLANAR)) { | |
1045 NOTIFY_STATUS("Failed to initialize GLImageIOSurface", PLATFORM_FAILURE, | 1046 NOTIFY_STATUS("Failed to initialize GLImageIOSurface", PLATFORM_FAILURE, |
1046 SFT_PLATFORM_ERROR); | 1047 SFT_PLATFORM_ERROR); |
1047 } | 1048 } |
1048 | 1049 |
1049 if (!bind_image_cb_.Run(picture_info->client_texture_id, | 1050 if (!bind_image_cb_.Run(picture_info->client_texture_id, |
1050 GL_TEXTURE_RECTANGLE_ARB, gl_image, false)) { | 1051 GL_TEXTURE_RECTANGLE_ARB, gl_image, false)) { |
1051 DLOG(ERROR) << "Failed to bind image"; | 1052 DLOG(ERROR) << "Failed to bind image"; |
1052 NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR); | 1053 NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR); |
1053 return false; | 1054 return false; |
1054 } | 1055 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 SupportedProfile profile; | 1142 SupportedProfile profile; |
1142 profile.profile = supported_profile; | 1143 profile.profile = supported_profile; |
1143 profile.min_resolution.SetSize(16, 16); | 1144 profile.min_resolution.SetSize(16, 16); |
1144 profile.max_resolution.SetSize(4096, 2160); | 1145 profile.max_resolution.SetSize(4096, 2160); |
1145 profiles.push_back(profile); | 1146 profiles.push_back(profile); |
1146 } | 1147 } |
1147 return profiles; | 1148 return profiles; |
1148 } | 1149 } |
1149 | 1150 |
1150 } // namespace media | 1151 } // namespace media |
OLD | NEW |