| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 scoped_ptr<VideoCaptureDevice::Client> client) override; | 63 scoped_ptr<VideoCaptureDevice::Client> client) override; |
| 64 void StopAndDeAllocate() override; | 64 void StopAndDeAllocate() override; |
| 65 | 65 |
| 66 bool Init(VideoCaptureDevice::Name::CaptureApiType capture_api_type); | 66 bool Init(VideoCaptureDevice::Name::CaptureApiType capture_api_type); |
| 67 | 67 |
| 68 // Called to deliver captured video frames. | 68 // Called to deliver captured video frames. |
| 69 void ReceiveFrame(const uint8* video_frame, | 69 void ReceiveFrame(const uint8* video_frame, |
| 70 int video_frame_length, | 70 int video_frame_length, |
| 71 const VideoCaptureFormat& frame_format, | 71 const VideoCaptureFormat& frame_format, |
| 72 int aspect_numerator, | 72 int aspect_numerator, |
| 73 int aspect_denominator); | 73 int aspect_denominator, |
| 74 base::TimeDelta timestamp); |
| 74 | 75 |
| 75 // Forwarder to VideoCaptureDevice::Client::OnError(). | 76 // Forwarder to VideoCaptureDevice::Client::OnError(). |
| 76 void ReceiveError(const std::string& reason); | 77 void ReceiveError(const std::string& reason); |
| 77 | 78 |
| 78 // Forwarder to VideoCaptureDevice::Client::OnLog(). | 79 // Forwarder to VideoCaptureDevice::Client::OnLog(). |
| 79 void LogMessage(const std::string& message); | 80 void LogMessage(const std::string& message); |
| 80 | 81 |
| 81 private: | 82 private: |
| 82 void SetErrorState(const std::string& reason); | 83 void SetErrorState(const std::string& reason); |
| 83 bool UpdateCaptureResolution(); | 84 bool UpdateCaptureResolution(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 95 // not need this process so |final_resolution_selected_| is false then. | 96 // not need this process so |final_resolution_selected_| is false then. |
| 96 bool final_resolution_selected_; | 97 bool final_resolution_selected_; |
| 97 bool tried_to_square_pixels_; | 98 bool tried_to_square_pixels_; |
| 98 | 99 |
| 99 // Only read and write state_ from inside this loop. | 100 // Only read and write state_ from inside this loop. |
| 100 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 101 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 101 InternalState state_; | 102 InternalState state_; |
| 102 | 103 |
| 103 id<PlatformVideoCapturingMac> capture_device_; | 104 id<PlatformVideoCapturingMac> capture_device_; |
| 104 | 105 |
| 106 base::TimeDelta first_timestamp_; |
| 107 base::TimeTicks first_aligned_timestamp_; |
| 108 |
| 105 // Used with Bind and PostTask to ensure that methods aren't called after the | 109 // Used with Bind and PostTask to ensure that methods aren't called after the |
| 106 // VideoCaptureDeviceMac is destroyed. | 110 // VideoCaptureDeviceMac is destroyed. |
| 107 // NOTE: Weak pointers must be invalidated before all other member variables. | 111 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 108 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; | 112 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; |
| 109 | 113 |
| 110 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); | 114 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 } // namespace media | 117 } // namespace media |
| 114 | 118 |
| 115 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 119 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| OLD | NEW |