| 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 used in OSX versions 10.6 and | 6 // AVFoundation as native capture API. QTKit is used in OSX versions 10.6 and |
| 7 // previous, and AVFoundation is used in the rest. | 7 // previous, and AVFoundation is used in the rest. |
| 8 | 8 |
| 9 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 9 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| 10 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 10 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/message_loop/message_loop_proxy.h" | |
| 18 #include "media/video/capture/video_capture_device.h" | 17 #include "media/video/capture/video_capture_device.h" |
| 19 #include "media/video/capture/video_capture_types.h" | 18 #include "media/video/capture/video_capture_types.h" |
| 20 | 19 |
| 21 @protocol PlatformVideoCapturingMac; | 20 @protocol PlatformVideoCapturingMac; |
| 22 | 21 |
| 22 namespace base { |
| 23 class SingleThreadTaskRunner; |
| 24 } |
| 25 |
| 23 namespace media { | 26 namespace media { |
| 24 | 27 |
| 25 // Called by VideoCaptureManager to open, close and start, stop video capture | 28 // Called by VideoCaptureManager to open, close and start, stop video capture |
| 26 // devices. | 29 // devices. |
| 27 class VideoCaptureDeviceMac : public VideoCaptureDevice { | 30 class VideoCaptureDeviceMac : public VideoCaptureDevice { |
| 28 public: | 31 public: |
| 29 explicit VideoCaptureDeviceMac(const Name& device_name); | 32 explicit VideoCaptureDeviceMac(const Name& device_name); |
| 30 virtual ~VideoCaptureDeviceMac(); | 33 virtual ~VideoCaptureDeviceMac(); |
| 31 | 34 |
| 32 // VideoCaptureDevice implementation. | 35 // VideoCaptureDevice implementation. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 Name device_name_; | 64 Name device_name_; |
| 62 scoped_ptr<VideoCaptureDevice::Client> client_; | 65 scoped_ptr<VideoCaptureDevice::Client> client_; |
| 63 | 66 |
| 64 VideoCaptureFormat capture_format_; | 67 VideoCaptureFormat capture_format_; |
| 65 bool sent_frame_info_; | 68 bool sent_frame_info_; |
| 66 bool tried_to_square_pixels_; | 69 bool tried_to_square_pixels_; |
| 67 | 70 |
| 68 // Only read and write state_ from inside this loop. | 71 // Only read and write state_ from inside this loop. |
| 69 const scoped_refptr<base::MessageLoopProxy> loop_proxy_; | 72 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 70 InternalState state_; | 73 InternalState state_; |
| 71 | 74 |
| 72 // Used with Bind and PostTask to ensure that methods aren't called | 75 // Used with Bind and PostTask to ensure that methods aren't called |
| 73 // after the VideoCaptureDeviceMac is destroyed. | 76 // after the VideoCaptureDeviceMac is destroyed. |
| 74 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; | 77 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; |
| 75 base::WeakPtr<VideoCaptureDeviceMac> weak_this_; | 78 base::WeakPtr<VideoCaptureDeviceMac> weak_this_; |
| 76 | 79 |
| 77 id<PlatformVideoCapturingMac> capture_device_; | 80 id<PlatformVideoCapturingMac> capture_device_; |
| 78 | 81 |
| 79 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); | 82 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace media | 85 } // namespace media |
| 83 | 86 |
| 84 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 87 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| OLD | NEW |