| 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 "media/video/capture/screen/screen_capturer.h" | 5 #include "media/video/capture/screen/screen_capturer.h" |
| 6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <IOKit/pwr_mgt/IOPMLib.h> | 10 #include <IOKit/pwr_mgt/IOPMLib.h> |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 // the machine has no monitor connected, so we fall back to depcreated APIs | 693 // the machine has no monitor connected, so we fall back to depcreated APIs |
| 694 // when running on 10.6. | 694 // when running on 10.6. |
| 695 if (base::mac::IsOSLionOrLater()) { | 695 if (base::mac::IsOSLionOrLater()) { |
| 696 LOG(INFO) << "Using CgBlitPostLion."; | 696 LOG(INFO) << "Using CgBlitPostLion."; |
| 697 // No need for any OpenGL support on Lion | 697 // No need for any OpenGL support on Lion |
| 698 return; | 698 return; |
| 699 } | 699 } |
| 700 | 700 |
| 701 // Dynamically link to the deprecated pre-Lion capture APIs. | 701 // Dynamically link to the deprecated pre-Lion capture APIs. |
| 702 std::string app_services_library_error; | 702 std::string app_services_library_error; |
| 703 FilePath app_services_path(kApplicationServicesLibraryName); | 703 base::FilePath app_services_path(kApplicationServicesLibraryName); |
| 704 app_services_library_.Reset( | 704 app_services_library_.Reset( |
| 705 base::LoadNativeLibrary(app_services_path, &app_services_library_error)); | 705 base::LoadNativeLibrary(app_services_path, &app_services_library_error)); |
| 706 CHECK(app_services_library_.is_valid()) << app_services_library_error; | 706 CHECK(app_services_library_.is_valid()) << app_services_library_error; |
| 707 | 707 |
| 708 std::string opengl_library_error; | 708 std::string opengl_library_error; |
| 709 FilePath opengl_path(kOpenGlLibraryName); | 709 base::FilePath opengl_path(kOpenGlLibraryName); |
| 710 opengl_library_.Reset( | 710 opengl_library_.Reset( |
| 711 base::LoadNativeLibrary(opengl_path, &opengl_library_error)); | 711 base::LoadNativeLibrary(opengl_path, &opengl_library_error)); |
| 712 CHECK(opengl_library_.is_valid()) << opengl_library_error; | 712 CHECK(opengl_library_.is_valid()) << opengl_library_error; |
| 713 | 713 |
| 714 cg_display_base_address_ = reinterpret_cast<CGDisplayBaseAddressFunc>( | 714 cg_display_base_address_ = reinterpret_cast<CGDisplayBaseAddressFunc>( |
| 715 app_services_library_.GetFunctionPointer("CGDisplayBaseAddress")); | 715 app_services_library_.GetFunctionPointer("CGDisplayBaseAddress")); |
| 716 cg_display_bytes_per_row_ = reinterpret_cast<CGDisplayBytesPerRowFunc>( | 716 cg_display_bytes_per_row_ = reinterpret_cast<CGDisplayBytesPerRowFunc>( |
| 717 app_services_library_.GetFunctionPointer("CGDisplayBytesPerRow")); | 717 app_services_library_.GetFunctionPointer("CGDisplayBytesPerRow")); |
| 718 cg_display_bits_per_pixel_ = reinterpret_cast<CGDisplayBitsPerPixelFunc>( | 718 cg_display_bits_per_pixel_ = reinterpret_cast<CGDisplayBitsPerPixelFunc>( |
| 719 app_services_library_.GetFunctionPointer("CGDisplayBitsPerPixel")); | 719 app_services_library_.GetFunctionPointer("CGDisplayBitsPerPixel")); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 | 865 |
| 866 // static | 866 // static |
| 867 scoped_ptr<ScreenCapturer> ScreenCapturer::Create() { | 867 scoped_ptr<ScreenCapturer> ScreenCapturer::Create() { |
| 868 scoped_ptr<ScreenCapturerMac> capturer(new ScreenCapturerMac()); | 868 scoped_ptr<ScreenCapturerMac> capturer(new ScreenCapturerMac()); |
| 869 if (!capturer->Init()) | 869 if (!capturer->Init()) |
| 870 capturer.reset(); | 870 capturer.reset(); |
| 871 return capturer.PassAs<ScreenCapturer>(); | 871 return capturer.PassAs<ScreenCapturer>(); |
| 872 } | 872 } |
| 873 | 873 |
| 874 } // namespace media | 874 } // namespace media |
| OLD | NEW |