OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_FACTORY_ANDROID_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_FACTORY_ANDROID_H_ |
6 #define MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_FACTORY_ANDROID_H_ | 6 #define MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_FACTORY_ANDROID_H_ |
7 | 7 |
8 #include "media/capture/video/video_capture_device_factory.h" | 8 #include "media/capture/video/video_capture_device_factory.h" |
9 | 9 |
10 #include <jni.h> | 10 #include <jni.h> |
11 | 11 |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "media/capture/video/video_capture_device.h" | 14 #include "media/capture/video/video_capture_device.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 // VideoCaptureDeviceFactory on Android. This class implements the static | 18 // VideoCaptureDeviceFactory on Android. This class implements the static |
19 // VideoCapture methods and the factory of VideoCaptureAndroid. | 19 // VideoCapture methods and the factory of VideoCaptureAndroid. |
20 class CAPTURE_EXPORT VideoCaptureDeviceFactoryAndroid | 20 class CAPTURE_EXPORT VideoCaptureDeviceFactoryAndroid |
21 : public VideoCaptureDeviceFactory { | 21 : public VideoCaptureDeviceFactory { |
22 public: | 22 public: |
23 static base::android::ScopedJavaLocalRef<jobject> createVideoCaptureAndroid( | 23 static base::android::ScopedJavaLocalRef<jobject> createVideoCaptureAndroid( |
24 int id, | 24 int id, |
25 jlong nativeVideoCaptureDeviceAndroid); | 25 jlong nativeVideoCaptureDeviceAndroid); |
26 | 26 |
27 VideoCaptureDeviceFactoryAndroid() {} | 27 VideoCaptureDeviceFactoryAndroid() : test_mode_(false) {} |
28 ~VideoCaptureDeviceFactoryAndroid() override {} | 28 ~VideoCaptureDeviceFactoryAndroid() override {} |
29 | 29 |
30 std::unique_ptr<VideoCaptureDevice> CreateDevice( | 30 std::unique_ptr<VideoCaptureDevice> CreateDevice( |
31 const VideoCaptureDeviceDescriptor& device_descriptor) override; | 31 const VideoCaptureDeviceDescriptor& device_descriptor) override; |
32 void GetDeviceDescriptors( | 32 void GetDeviceDescriptors( |
33 VideoCaptureDeviceDescriptors* device_descriptors) override; | 33 VideoCaptureDeviceDescriptors* device_descriptors) override; |
34 void GetSupportedFormats(const VideoCaptureDeviceDescriptor& device, | 34 void GetSupportedFormats(const VideoCaptureDeviceDescriptor& device, |
35 VideoCaptureFormats* supported_formats) override; | 35 VideoCaptureFormats* supported_formats) override; |
36 | 36 |
| 37 static bool IsLegacyOrDeprecatedDevice(const std::string& device_id); |
| 38 |
| 39 // Configures all subsequent CreateDevice()s in test mode. |
| 40 void ConfigureForTesting() { test_mode_ = true; } |
| 41 |
37 private: | 42 private: |
| 43 // Switch to indicate that all created Java capturers will be in test mode. |
| 44 bool test_mode_; |
| 45 |
38 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryAndroid); | 46 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryAndroid); |
39 }; | 47 }; |
40 } // namespace media | 48 } // namespace media |
41 | 49 |
42 #endif // MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_FACTORY_ANDROID_H_ | 50 #endif // MEDIA_CAPTURE_VIDEO_ANDROID_VIDEO_CAPTURE_DEVICE_FACTORY_ANDROID_H_ |
OLD | NEW |