| 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 #include "media/video/capture/android/video_capture_device_factory_android.h" | 5 #include "media/video/capture/android/video_capture_device_factory_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 DVLOG(1) << "VideoCaptureDevice::GetDeviceNames: num_cameras=" << num_cameras; | 64 DVLOG(1) << "VideoCaptureDevice::GetDeviceNames: num_cameras=" << num_cameras; |
| 65 if (num_cameras <= 0) | 65 if (num_cameras <= 0) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 for (int camera_id = num_cameras - 1; camera_id >= 0; --camera_id) { | 68 for (int camera_id = num_cameras - 1; camera_id >= 0; --camera_id) { |
| 69 base::android::ScopedJavaLocalRef<jstring> device_name = | 69 base::android::ScopedJavaLocalRef<jstring> device_name = |
| 70 Java_VideoCaptureFactory_getDeviceName(env, camera_id, context); | 70 Java_VideoCaptureFactory_getDeviceName(env, camera_id, context); |
| 71 if (device_name.obj() == NULL) | 71 if (device_name.obj() == NULL) |
| 72 continue; | 72 continue; |
| 73 | 73 |
| 74 const int capture_api_type = |
| 75 Java_VideoCaptureFactory_getCaptureApiType(env, camera_id, context); |
| 76 |
| 74 VideoCaptureDevice::Name name( | 77 VideoCaptureDevice::Name name( |
| 75 base::android::ConvertJavaStringToUTF8(device_name), | 78 base::android::ConvertJavaStringToUTF8(device_name), |
| 76 base::IntToString(camera_id)); | 79 base::IntToString(camera_id), |
| 80 static_cast<VideoCaptureDevice::Name::CaptureApiType>( |
| 81 capture_api_type)); |
| 77 device_names->push_back(name); | 82 device_names->push_back(name); |
| 78 | 83 |
| 79 DVLOG(1) << "VideoCaptureDeviceFactoryAndroid::GetDeviceNames: camera " | 84 DVLOG(1) << "VideoCaptureDeviceFactoryAndroid::GetDeviceNames: camera " |
| 80 << "device_name=" << name.name() << ", unique_id=" << name.id(); | 85 << "device_name=" << name.name() << ", unique_id=" << name.id(); |
| 81 } | 86 } |
| 82 } | 87 } |
| 83 | 88 |
| 84 void VideoCaptureDeviceFactoryAndroid::GetDeviceSupportedFormats( | 89 void VideoCaptureDeviceFactoryAndroid::GetDeviceSupportedFormats( |
| 85 const VideoCaptureDevice::Name& device, | 90 const VideoCaptureDevice::Name& device, |
| 86 VideoCaptureFormats* capture_formats) { | 91 VideoCaptureFormats* capture_formats) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 131 } |
| 127 | 132 |
| 128 // static | 133 // static |
| 129 VideoCaptureDeviceFactory* | 134 VideoCaptureDeviceFactory* |
| 130 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 135 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
| 131 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 136 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 132 return new VideoCaptureDeviceFactoryAndroid(); | 137 return new VideoCaptureDeviceFactoryAndroid(); |
| 133 } | 138 } |
| 134 | 139 |
| 135 } // namespace media | 140 } // namespace media |
| OLD | NEW |