当前位置: 首页>>代码示例>>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;未经允许,请勿转载。