| Index: media/capture/video/android/video_capture_device_factory_android.cc
|
| diff --git a/media/capture/video/android/video_capture_device_factory_android.cc b/media/capture/video/android/video_capture_device_factory_android.cc
|
| index 6b04cdc8bd766e87bdd80758c9e7803eae92b599..629629c5782e032b67c47f63329edcf7e3ecac4d 100644
|
| --- a/media/capture/video/android/video_capture_device_factory_android.cc
|
| +++ b/media/capture/video/android/video_capture_device_factory_android.cc
|
| @@ -34,15 +34,16 @@ VideoCaptureDeviceFactoryAndroid::createVideoCaptureAndroid(
|
| nativeVideoCaptureDeviceAndroid));
|
| }
|
|
|
| -std::unique_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryAndroid::Create(
|
| - const VideoCaptureDevice::Name& device_name) {
|
| +std::unique_ptr<VideoCaptureDevice>
|
| +VideoCaptureDeviceFactoryAndroid::CreateDevice(
|
| + const VideoCaptureDeviceDescriptor& device_descriptor) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| int id;
|
| - if (!base::StringToInt(device_name.id(), &id))
|
| + if (!base::StringToInt(device_descriptor.device_id, &id))
|
| return std::unique_ptr<VideoCaptureDevice>();
|
|
|
| std::unique_ptr<VideoCaptureDeviceAndroid> video_capture_device(
|
| - new VideoCaptureDeviceAndroid(device_name));
|
| + new VideoCaptureDeviceAndroid(device_descriptor));
|
|
|
| if (video_capture_device->Init())
|
| return std::move(video_capture_device);
|
| @@ -51,17 +52,17 @@ std::unique_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryAndroid::Create(
|
| return std::unique_ptr<VideoCaptureDevice>();
|
| }
|
|
|
| -void VideoCaptureDeviceFactoryAndroid::GetDeviceNames(
|
| - VideoCaptureDevice::Names* device_names) {
|
| +void VideoCaptureDeviceFactoryAndroid::GetDeviceDescriptors(
|
| + VideoCaptureDeviceDescriptors* device_descriptors) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| - device_names->clear();
|
| + device_descriptors->clear();
|
|
|
| JNIEnv* env = AttachCurrentThread();
|
|
|
| const jobject context = base::android::GetApplicationContext();
|
| const int num_cameras =
|
| Java_VideoCaptureFactory_getNumberOfCameras(env, context);
|
| - DVLOG(1) << "VideoCaptureDevice::GetDeviceNames: num_cameras=" << num_cameras;
|
| + DVLOG(1) << __FUNCTION__ << ": num_cameras=" << num_cameras;
|
| if (num_cameras <= 0)
|
| return;
|
|
|
| @@ -73,25 +74,28 @@ void VideoCaptureDeviceFactoryAndroid::GetDeviceNames(
|
|
|
| const int capture_api_type =
|
| Java_VideoCaptureFactory_getCaptureApiType(env, camera_id, context);
|
| -
|
| - VideoCaptureDevice::Name name(
|
| - base::android::ConvertJavaStringToUTF8(device_name),
|
| - base::IntToString(camera_id),
|
| - static_cast<VideoCaptureDevice::Name::CaptureApiType>(
|
| - capture_api_type));
|
| - device_names->push_back(name);
|
| -
|
| - DVLOG(1) << "VideoCaptureDeviceFactoryAndroid::GetDeviceNames: camera "
|
| - << "device_name=" << name.name() << ", unique_id=" << name.id();
|
| + const std::string display_name =
|
| + base::android::ConvertJavaStringToUTF8(device_name);
|
| + const std::string device_id = base::IntToString(camera_id);
|
| +
|
| + // Android cameras are not typically USB devices, and the model_id is
|
| + // currently only used for USB model identifiers, so this implementation
|
| + // just indicates an unknown device model (by not providing one).
|
| + device_descriptors->emplace_back(
|
| + display_name, device_id,
|
| + static_cast<VideoCaptureApi>(capture_api_type));
|
| +
|
| + DVLOG(1) << __FUNCTION__ << ": camera "
|
| + << "device_name=" << display_name << ", unique_id=" << device_id;
|
| }
|
| }
|
|
|
| -void VideoCaptureDeviceFactoryAndroid::GetDeviceSupportedFormats(
|
| - const VideoCaptureDevice::Name& device,
|
| +void VideoCaptureDeviceFactoryAndroid::GetSupportedFormats(
|
| + const VideoCaptureDeviceDescriptor& device,
|
| VideoCaptureFormats* capture_formats) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| int id;
|
| - if (!base::StringToInt(device.id(), &id))
|
| + if (!base::StringToInt(device.device_id, &id))
|
| return;
|
| JNIEnv* env = AttachCurrentThread();
|
| base::android::ScopedJavaLocalRef<jobjectArray> collected_formats =
|
| @@ -127,7 +131,7 @@ void VideoCaptureDeviceFactoryAndroid::GetDeviceSupportedFormats(
|
| format.obj()),
|
| pixel_format);
|
| capture_formats->push_back(capture_format);
|
| - DVLOG(1) << device.name() << " "
|
| + DVLOG(1) << device.display_name << " "
|
| << VideoCaptureFormat::ToString(capture_format);
|
| }
|
| }
|
|
|