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