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_ |
11 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 11 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
12 | 12 |
| 13 #import <Foundation/Foundation.h> |
| 14 |
13 #include <string> | 15 #include <string> |
14 | 16 |
15 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/mac/scoped_nsobject.h" |
16 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
18 #include "media/video/capture/video_capture_device.h" | 21 #include "media/video/capture/video_capture_device.h" |
19 #include "media/video/capture/video_capture_types.h" | 22 #include "media/video/capture/video_capture_types.h" |
20 | 23 |
21 @protocol PlatformVideoCapturingMac; | 24 @protocol PlatformVideoCapturingMac; |
22 | 25 |
23 namespace base { | 26 namespace base { |
24 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
25 } | 28 } |
26 | 29 |
| 30 // Small class to bundle device name and connection type into a dictionary. |
| 31 MEDIA_EXPORT |
| 32 @interface DeviceNameAndTransportType : NSObject { |
| 33 @private |
| 34 base::scoped_nsobject<NSString> deviceName_; |
| 35 // The transport type of the device (USB, PCI, etc), values are defined in |
| 36 // <IOKit/audio/IOAudioTypes.h> as kIOAudioDeviceTransportType*. |
| 37 int32_t transportType_; |
| 38 } |
| 39 |
| 40 - (id)initWithName:(NSString*)name transportType:(int32_t)transportType; |
| 41 |
| 42 - (NSString*)deviceName; |
| 43 - (int32_t)transportType; |
| 44 @end |
| 45 |
27 namespace media { | 46 namespace media { |
28 | 47 |
| 48 enum { |
| 49 // Unknown transport type, addition to the kIOAudioDeviceTransportType* |
| 50 // family for QTKit devices where this attribute isn't published. |
| 51 kIOAudioDeviceTransportTypeUnknown = 'unkn' |
| 52 }; |
| 53 |
29 // Called by VideoCaptureManager to open, close and start, stop Mac video | 54 // Called by VideoCaptureManager to open, close and start, stop Mac video |
30 // capture devices. | 55 // capture devices. |
31 class VideoCaptureDeviceMac : public VideoCaptureDevice { | 56 class VideoCaptureDeviceMac : public VideoCaptureDevice { |
32 public: | 57 public: |
33 explicit VideoCaptureDeviceMac(const Name& device_name); | 58 explicit VideoCaptureDeviceMac(const Name& device_name); |
34 virtual ~VideoCaptureDeviceMac(); | 59 virtual ~VideoCaptureDeviceMac(); |
35 | 60 |
36 // VideoCaptureDevice implementation. | 61 // VideoCaptureDevice implementation. |
37 virtual void AllocateAndStart( | 62 virtual void AllocateAndStart( |
38 const VideoCaptureParams& params, | 63 const VideoCaptureParams& params, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // VideoCaptureDeviceMac is destroyed. | 109 // VideoCaptureDeviceMac is destroyed. |
85 // NOTE: Weak pointers must be invalidated before all other member variables. | 110 // NOTE: Weak pointers must be invalidated before all other member variables. |
86 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; | 111 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; |
87 | 112 |
88 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); | 113 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); |
89 }; | 114 }; |
90 | 115 |
91 } // namespace media | 116 } // namespace media |
92 | 117 |
93 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ | 118 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ |
OLD | NEW |