當前位置: 首頁>>代碼示例>>Java>>正文


Java CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY屬性代碼示例

本文整理匯總了Java中android.hardware.camera2.CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY屬性的典型用法代碼示例。如果您正苦於以下問題:Java CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY屬性的具體用法?Java CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY怎麽用?Java CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.hardware.camera2.CameraCharacteristics的用法示例。


在下文中一共展示了CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: logSupportedHardwareLevel

private void logSupportedHardwareLevel(@NonNull String cameraId) {
    int hardwareLevel = cameraCharacteristicsHelper.getSupportedHardwareLevel(cameraId);

    String hardwareLevelName = String.valueOf(hardwareLevel);  // for level 3 and higher
    switch (hardwareLevel) {
        case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY:
            hardwareLevelName = "legacy";
            break;
        case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED:
            hardwareLevelName = "limited";
            break;
        case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL:
            hardwareLevelName = "full";
            break;
    }

    log.d("using camera with supported hardware level: %s", hardwareLevelName);
}
 
開發者ID:BioID-GmbH,項目名稱:BWS-Android,代碼行數:18,代碼來源:CameraHelper.java

示例2: isSupported

/**
 * Checks if API is supported and all cameras have better than legacy support.
 */
public static boolean isSupported(Context context) {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    return false;
  }

  CameraManager cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
  try {
    String[] cameraIds = cameraManager.getCameraIdList();
    for (String id : cameraIds) {
      CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(id);
      if (characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)
          == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
        return false;
      }
    }
    // On Android OS pre 4.4.2, a class will not load because of VerifyError if it contains a
    // catch statement with an Exception from a newer API, even if the code is never executed.
    // https://code.google.com/p/android/issues/detail?id=209129
  } catch (/* CameraAccessException */ AndroidException e) {
    Logging.e(TAG, "Camera access exception: " + e);
    return false;
  }
  return true;
}
 
開發者ID:Piasy,項目名稱:AppRTC-Android,代碼行數:27,代碼來源:Camera2Enumerator.java

示例3: hasCamera2

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static boolean hasCamera2(Context context) {
    if (context == null) return false;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return false;
    try {
        CameraManager manager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
        String[] idList = manager.getCameraIdList();
        boolean notNull = true;
        if (idList.length == 0) {
            notNull = false;
        } else {
            for (final String str : idList) {
                if (str == null || str.trim().isEmpty()) {
                    notNull = false;
                    break;
                }
                final CameraCharacteristics characteristics = manager.getCameraCharacteristics(str);

                final int supportLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
                if (supportLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
                    notNull = false;
                    break;
                }
            }
        }
        return notNull;
    } catch (Throwable ignore) {
        return false;
    }
}
 
開發者ID:florent37,項目名稱:CameraFragment,代碼行數:30,代碼來源:CameraHelper.java

示例4: isHardwareLevelSupported

private boolean isHardwareLevelSupported(
    CameraCharacteristics characteristics, int requiredLevel) {
  int deviceLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
  if (deviceLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
    return requiredLevel == deviceLevel;
  }
  // deviceLevel is not LEGACY, can use numerical sort
  return requiredLevel <= deviceLevel;
}
 
開發者ID:Nilhcem,項目名稱:tensorflow-classifier-android,代碼行數:9,代碼來源:CameraActivity.java

示例5: isCamera2Native

public boolean isCamera2Native() {
    try {
        if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {return false;}
        manager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE);
        mCameraId = manager.getCameraIdList()[mFacing];
        CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraId);
        //CHECK CAMERA HARDWARE LEVEL. IF CAMERA2 IS NOT NATIVELY SUPPORTED, GO BACK TO CAMERA1
        Integer deviceLevel = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
        return deviceLevel != null && (deviceLevel != CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY);
    }
    catch (CameraAccessException ex) {return false;}
    catch (NullPointerException e) {return false;}
    catch (ArrayIndexOutOfBoundsException ez) {return false;}
}
 
開發者ID:EzequielAdrianM,項目名稱:Camera2Vision,代碼行數:14,代碼來源:Camera2Source.java

示例6: getSupportedSizes

static List<Size> getSupportedSizes(CameraCharacteristics cameraCharacteristics) {
  final StreamConfigurationMap streamMap =
      cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
  final int supportLevel =
      cameraCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);

  final android.util.Size[] nativeSizes = streamMap.getOutputSizes(SurfaceTexture.class);
  final List<Size> sizes = convertSizes(nativeSizes);

  // Video may be stretched pre LMR1 on legacy implementations.
  // Filter out formats that have different aspect ratio than the sensor array.
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1
      && supportLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
    final Rect activeArraySize =
        cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
    final ArrayList<Size> filteredSizes = new ArrayList<Size>();

    for (Size size : sizes) {
      if (activeArraySize.width() * size.height == activeArraySize.height() * size.width) {
        filteredSizes.add(size);
      }
    }

    return filteredSizes;
  } else {
    return sizes;
  }
}
 
開發者ID:Piasy,項目名稱:AppRTC-Android,代碼行數:28,代碼來源:Camera2Enumerator.java

示例7: isLegacyLocked

/**
 * Check if we are using a device that only supports the LEGACY hardware level.
 * <p/>
 * Call this only with {@link #mCameraStateLock} held.
 *
 * @return true if this is a legacy device.
 */
private boolean isLegacyLocked() {
    return mCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL) ==
            CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY;
}
 
開發者ID:gengqifu,項目名稱:361Camera,代碼行數:11,代碼來源:Camera2Fragment.java


注:本文中的android.hardware.camera2.CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。