Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java

Issue 2124363003: ImageCapture: Implement focus mode for Android and Fake Video Capture Devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reillyg@ comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 package org.chromium.media; 5 package org.chromium.media;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.content.Context; 8 import android.content.Context;
9 import android.graphics.ImageFormat; 9 import android.graphics.ImageFormat;
10 import android.graphics.Rect; 10 import android.graphics.Rect;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 // The Min and Max zoom are returned as x100 by the API to avoid using f loating point. There 565 // The Min and Max zoom are returned as x100 by the API to avoid using f loating point. There
566 // is no min-zoom per se, so clamp it to always 100 (TODO(mcasas): make const member). 566 // is no min-zoom per se, so clamp it to always 100 (TODO(mcasas): make const member).
567 final int minZoom = 100; 567 final int minZoom = 100;
568 final int maxZoom = Math.round(mMaxZoom * 100); 568 final int maxZoom = Math.round(mMaxZoom * 100);
569 569
570 // Width Ratio x100 is used as measure of current zoom. 570 // Width Ratio x100 is used as measure of current zoom.
571 final int currentZoom = 100 * mPreviewRequest.get(CaptureRequest.SCALER_ CROP_REGION).width() 571 final int currentZoom = 100 * mPreviewRequest.get(CaptureRequest.SCALER_ CROP_REGION).width()
572 / cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_AC TIVE_ARRAY_SIZE) 572 / cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_AC TIVE_ARRAY_SIZE)
573 .width(); 573 .width();
574 574
575 return new PhotoCapabilities(maxZoom, minZoom, currentZoom); 575 final int focusMode = mPreviewRequest.get(CaptureRequest.CONTROL_AF_MODE );
576 Log.d(TAG, "focusMode " + focusMode);
577 final boolean isFocusManual = (focusMode == CameraMetadata.CONTROL_AF_MO DE_OFF)
578 || (focusMode == CameraMetadata.CONTROL_AF_MODE_EDOF);
579
580 return new PhotoCapabilities(maxZoom, minZoom, currentZoom, !isFocusManu al);
576 } 581 }
577 582
578 @Override 583 @Override
579 public void setZoom(int zoom) { 584 public void setZoom(int zoom) {
580 final CameraCharacteristics cameraCharacteristics = getCameraCharacteris tics(mContext, mId); 585 final CameraCharacteristics cameraCharacteristics = getCameraCharacteris tics(mContext, mId);
581 final Rect canvas = 586 final Rect canvas =
582 cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTI VE_ARRAY_SIZE); 587 cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTI VE_ARRAY_SIZE);
583 588
584 final float normalizedZoom = Math.max(100, Math.min(zoom, mMaxZoom * 100 )) / 100; 589 final float normalizedZoom = Math.max(100, Math.min(zoom, mMaxZoom * 100 )) / 100;
585 final float cropFactor = (normalizedZoom - 1) / (2 * normalizedZoom); 590 final float cropFactor = (normalizedZoom - 1) / (2 * normalizedZoom);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 return false; 651 return false;
647 } 652 }
648 return true; 653 return true;
649 } 654 }
650 655
651 @Override 656 @Override
652 public void deallocate() { 657 public void deallocate() {
653 Log.d(TAG, "deallocate"); 658 Log.d(TAG, "deallocate");
654 } 659 }
655 } 660 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698