| 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 // MacOSX implementation of generic VideoCaptureDevice, using either QTKit or | 5 // MacOSX implementation of generic VideoCaptureDevice, using either QTKit or |
| 6 // AVFoundation as native capture API. QTKit is available in all OSX versions, | 6 // AVFoundation as native capture API. QTKit is available in all OSX versions, |
| 7 // although namely deprecated in 10.9, and AVFoundation is available in versions | 7 // although namely deprecated in 10.9, and AVFoundation is available in versions |
| 8 // 10.7 (Lion) and later. | 8 // 10.7 (Lion) and later. |
| 9 | 9 |
| 10 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 10 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const std::string& reason); | 91 const std::string& reason); |
| 92 bool UpdateCaptureResolution(); | 92 bool UpdateCaptureResolution(); |
| 93 | 93 |
| 94 // Flag indicating the internal state. | 94 // Flag indicating the internal state. |
| 95 enum InternalState { kNotInitialized, kIdle, kCapturing, kError }; | 95 enum InternalState { kNotInitialized, kIdle, kCapturing, kError }; |
| 96 | 96 |
| 97 Name device_name_; | 97 Name device_name_; |
| 98 scoped_ptr<VideoCaptureDevice::Client> client_; | 98 scoped_ptr<VideoCaptureDevice::Client> client_; |
| 99 | 99 |
| 100 VideoCaptureFormat capture_format_; | 100 VideoCaptureFormat capture_format_; |
| 101 // These variables control the two-step configure-start process for QTKit HD: | |
| 102 // the device is first started with no configuration and the captured frames | |
| 103 // are inspected to check if the camera really supports HD. AVFoundation does | |
| 104 // not need this process so |final_resolution_selected_| is false then. | |
| 105 bool final_resolution_selected_; | |
| 106 bool tried_to_square_pixels_; | |
| 107 | 101 |
| 108 // Only read and write state_ from inside this loop. | 102 // Only read and write state_ from inside this loop. |
| 109 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 103 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 110 InternalState state_; | 104 InternalState state_; |
| 111 | 105 |
| 112 id<PlatformVideoCapturingMac> capture_device_; | 106 id<PlatformVideoCapturingMac> capture_device_; |
| 113 | 107 |
| 114 base::TimeDelta first_timestamp_; | 108 base::TimeDelta first_timestamp_; |
| 115 base::TimeTicks first_aligned_timestamp_; | 109 base::TimeTicks first_aligned_timestamp_; |
| 116 | 110 |
| 117 // Used with Bind and PostTask to ensure that methods aren't called after the | 111 // Used with Bind and PostTask to ensure that methods aren't called after the |
| 118 // VideoCaptureDeviceMac is destroyed. | 112 // VideoCaptureDeviceMac is destroyed. |
| 119 // NOTE: Weak pointers must be invalidated before all other member variables. | 113 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 120 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; | 114 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; |
| 121 | 115 |
| 122 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); | 116 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); |
| 123 }; | 117 }; |
| 124 | 118 |
| 125 } // namespace media | 119 } // namespace media |
| 126 | 120 |
| 127 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 121 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| OLD | NEW |