| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/video_decode_acceleration_support_mac.h" | 5 #include "ui/gfx/video_decode_acceleration_support_mac.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #import "base/mac/foundation_util.h" | 11 #import "base/mac/foundation_util.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/mac/scoped_nsautorelease_pool.h" | 13 #include "base/mac/scoped_nsautorelease_pool.h" |
| 14 #include "base/native_library.h" | 14 #include "base/native_library.h" |
| 15 | 15 |
| 16 using base::mac::CFToNSCast; | 16 using base::mac::CFToNSCast; |
| 17 using base::mac::NSToCFCast; | 17 using base::mac::NSToCFCast; |
| 18 | 18 |
| 19 const CFStringRef kVDADecoderConfiguration_Width = CFSTR("width"); | 19 const CFStringRef kVDADecoderConfiguration_Width = CFSTR("width"); |
| 20 const CFStringRef kVDADecoderConfiguration_Height = CFSTR("height"); | 20 const CFStringRef kVDADecoderConfiguration_Height = CFSTR("height"); |
| 21 const CFStringRef kVDADecoderConfiguration_SourceFormat = CFSTR("format"); | 21 const CFStringRef kVDADecoderConfiguration_SourceFormat = CFSTR("format"); |
| 22 const CFStringRef kVDADecoderConfiguration_avcCData = CFSTR("avcC"); | 22 const CFStringRef kVDADecoderConfiguration_avcCData = CFSTR("avcC"); |
| 23 const CFStringRef kCVPixelBufferIOSurfacePropertiesKey = | 23 const CFStringRef kCVPixelBufferIOSurfacePropertiesKey = |
| 24 CFSTR("IOSurfaceProperties"); | 24 CFSTR("IOSurfaceProperties"); |
| 25 | 25 |
| 26 #if !defined(MAC_OS_X_VERSION_10_6) || \ | |
| 27 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | |
| 28 enum { | |
| 29 kVDADecoderNoErr = 0, | |
| 30 kVDADecoderHardwareNotSupportedErr = -12470, | |
| 31 kVDADecoderFormatNotSupportedErr = -12471, | |
| 32 kVDADecoderFlush_EmitFrames = 1 << 0, | |
| 33 }; | |
| 34 | |
| 35 typedef void (*VDADecoderOutputCallback)( | |
| 36 void* decompressionOutputRefCon, | |
| 37 CFDictionaryRef frameInfo, | |
| 38 OSStatus status, | |
| 39 uint32_t infoFlags, | |
| 40 CVImageBufferRef imageBuffer); | |
| 41 #endif // MAC_OS_X_VERSION_10_6 | |
| 42 | |
| 43 namespace { | 26 namespace { |
| 44 | 27 |
| 45 // These are 10.6.3 APIs that we look up at run time. | 28 // These are 10.6.3 APIs that we look up at run time. |
| 46 typedef OSStatus (*VDADecoderCreateFunc)( | 29 typedef OSStatus (*VDADecoderCreateFunc)( |
| 47 CFDictionaryRef decoderConfiguration, | 30 CFDictionaryRef decoderConfiguration, |
| 48 CFDictionaryRef destinationImageBufferAttributes, | 31 CFDictionaryRef destinationImageBufferAttributes, |
| 49 VDADecoderOutputCallback* outputCallback, | 32 VDADecoderOutputCallback* outputCallback, |
| 50 void* decoderOutputCallbackRefcon, | 33 void* decoderOutputCallbackRefcon, |
| 51 VDADecoder* decoderOut); | 34 VDADecoder* decoderOut); |
| 52 | 35 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 OSStatus status, | 213 OSStatus status, |
| 231 int frame_id) { | 214 int frame_id) { |
| 232 frame_ready_callbacks_[frame_id].Run(image_buffer, status); | 215 frame_ready_callbacks_[frame_id].Run(image_buffer, status); |
| 233 // Match the retain in OnFrameReadyCallback. | 216 // Match the retain in OnFrameReadyCallback. |
| 234 if (image_buffer) | 217 if (image_buffer) |
| 235 CFRelease(image_buffer); | 218 CFRelease(image_buffer); |
| 236 frame_ready_callbacks_.erase(frame_id); | 219 frame_ready_callbacks_.erase(frame_id); |
| 237 } | 220 } |
| 238 | 221 |
| 239 } // namespace | 222 } // namespace |
| OLD | NEW |