| 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 used in OSX versions 10.6 and |
| 7 // although namely deprecated in 10.9, and AVFoundation is available in versions | 7 // previous, and AVFoundation is used in the rest. |
| 8 // 10.7 (Lion) and later. | |
| 9 | 8 |
| 10 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 9 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| 11 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 10 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| 12 | 11 |
| 13 #include <string> | 12 #include <string> |
| 14 | 13 |
| 15 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 16 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.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 |
| 23 namespace base { | 22 namespace base { |
| 24 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace media { | 26 namespace media { |
| 28 | 27 |
| 29 // Called by VideoCaptureManager to open, close and start, stop Mac video | 28 // Called by VideoCaptureManager to open, close and start, stop video capture |
| 30 // capture devices. | 29 // devices. |
| 31 class VideoCaptureDeviceMac : public VideoCaptureDevice { | 30 class VideoCaptureDeviceMac : public VideoCaptureDevice { |
| 32 public: | 31 public: |
| 33 explicit VideoCaptureDeviceMac(const Name& device_name); | 32 explicit VideoCaptureDeviceMac(const Name& device_name); |
| 34 virtual ~VideoCaptureDeviceMac(); | 33 virtual ~VideoCaptureDeviceMac(); |
| 35 | 34 |
| 36 // VideoCaptureDevice implementation. | 35 // VideoCaptureDevice implementation. |
| 37 virtual void AllocateAndStart( | 36 virtual void AllocateAndStart(const VideoCaptureParams& params, |
| 38 const VideoCaptureParams& params, | 37 scoped_ptr<VideoCaptureDevice::Client> client) |
| 39 scoped_ptr<VideoCaptureDevice::Client> client) OVERRIDE; | 38 OVERRIDE; |
| 40 virtual void StopAndDeAllocate() OVERRIDE; | 39 virtual void StopAndDeAllocate() OVERRIDE; |
| 41 | 40 |
| 42 bool Init(VideoCaptureDevice::Name::CaptureApiType capture_api_type); | 41 bool Init(); |
| 43 | 42 |
| 44 // Called to deliver captured video frames. | 43 // Called to deliver captured video frames. |
| 45 void ReceiveFrame(const uint8* video_frame, | 44 void ReceiveFrame(const uint8* video_frame, |
| 46 int video_frame_length, | 45 int video_frame_length, |
| 47 const VideoCaptureFormat& frame_format, | 46 const VideoCaptureFormat& frame_format, |
| 48 int aspect_numerator, | 47 int aspect_numerator, |
| 49 int aspect_denominator); | 48 int aspect_denominator); |
| 50 | 49 |
| 51 void ReceiveError(const std::string& reason); | 50 void ReceiveError(const std::string& reason); |
| 52 | 51 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 83 // VideoCaptureDeviceMac is destroyed. | 82 // VideoCaptureDeviceMac is destroyed. |
| 84 // NOTE: Weak pointers must be invalidated before all other member variables. | 83 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 85 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; | 84 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; |
| 86 | 85 |
| 87 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); | 86 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 } // namespace media | 89 } // namespace media |
| 91 | 90 |
| 92 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 91 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
| OLD | NEW |