| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/capture/video/android/video_capture_device_android.h" | 5 #include "media/capture/video/android/video_capture_device_android.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 413 } |
| 414 | 414 |
| 415 mojom::BlobPtr blob = mojom::Blob::New(); | 415 mojom::BlobPtr blob = mojom::Blob::New(); |
| 416 base::android::JavaByteArrayToByteVector(env, data.obj(), &blob->data); | 416 base::android::JavaByteArrayToByteVector(env, data.obj(), &blob->data); |
| 417 blob->mime_type = blob->data.empty() ? "" : "image/jpeg"; | 417 blob->mime_type = blob->data.empty() ? "" : "image/jpeg"; |
| 418 cb->Run(std::move(blob)); | 418 cb->Run(std::move(blob)); |
| 419 | 419 |
| 420 photo_callbacks_.erase(reference_it); | 420 photo_callbacks_.erase(reference_it); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void VideoCaptureDeviceAndroid::ConfigureForTesting() { | |
| 424 Java_VideoCapture_setTestMode(AttachCurrentThread(), j_capture_); | |
| 425 } | |
| 426 | |
| 427 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { | 423 VideoPixelFormat VideoCaptureDeviceAndroid::GetColorspace() { |
| 428 JNIEnv* env = AttachCurrentThread(); | 424 JNIEnv* env = AttachCurrentThread(); |
| 429 const int current_capture_colorspace = | 425 const int current_capture_colorspace = |
| 430 Java_VideoCapture_getColorspace(env, j_capture_); | 426 Java_VideoCapture_getColorspace(env, j_capture_); |
| 431 switch (current_capture_colorspace) { | 427 switch (current_capture_colorspace) { |
| 432 case ANDROID_IMAGE_FORMAT_YV12: | 428 case ANDROID_IMAGE_FORMAT_YV12: |
| 433 return media::PIXEL_FORMAT_YV12; | 429 return media::PIXEL_FORMAT_YV12; |
| 434 case ANDROID_IMAGE_FORMAT_YUV_420_888: | 430 case ANDROID_IMAGE_FORMAT_YUV_420_888: |
| 435 return media::PIXEL_FORMAT_I420; | 431 return media::PIXEL_FORMAT_I420; |
| 436 case ANDROID_IMAGE_FORMAT_NV21: | 432 case ANDROID_IMAGE_FORMAT_NV21: |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 static_cast<int>(exposure_mode), width, height, points_of_interest, | 581 static_cast<int>(exposure_mode), width, height, points_of_interest, |
| 586 settings->has_exposure_compensation, exposure_compensation, | 582 settings->has_exposure_compensation, exposure_compensation, |
| 587 static_cast<int>(white_balance_mode), iso, | 583 static_cast<int>(white_balance_mode), iso, |
| 588 settings->has_red_eye_reduction, settings->red_eye_reduction, | 584 settings->has_red_eye_reduction, settings->red_eye_reduction, |
| 589 static_cast<int>(fill_light_mode)); | 585 static_cast<int>(fill_light_mode)); |
| 590 | 586 |
| 591 callback.Run(true); | 587 callback.Run(true); |
| 592 } | 588 } |
| 593 | 589 |
| 594 } // namespace media | 590 } // namespace media |
| OLD | NEW |