@Test public void transformSurfaceConfigWithYUVMaximumSize() { setupCamera( false); SupportedSurfaceCombination supportedSurfaceCombination = new SupportedSurfaceCombination( mContext, LEGACY_CAMERA_ID, mMockCamcorderProfileHelper); SurfaceConfig surfaceConfig = supportedSurfaceCombination.transformSurfaceConfig( ImageFormat.YUV_420_888, mMaximumSize); SurfaceConfig expectedSurfaceConfig = SurfaceConfig.create(ConfigType.YUV, ConfigSize.MAXIMUM); assertEquals(expectedSurfaceConfig, surfaceConfig); }
SurfaceConfig transformSurfaceConfig(int imageFormat, Size size) { ConfigType configType; ConfigSize configSize = ConfigSize.NOT_SUPPORT; if (getAllOutputSizesByFormat(imageFormat) == null) { throw new IllegalArgumentException( "Can not get supported output size for the format: " + imageFormat); } if (imageFormat == ImageFormat.YUV_420_888) { configType = ConfigType.YUV; } else if (imageFormat == ImageFormat.JPEG) { configType = ConfigType.JPEG; } else if (imageFormat == ImageFormat.RAW_SENSOR) { configType = ConfigType.RAW; } else { configType = ConfigType.PRIV; } Size maxSize = fetchMaxSize(imageFormat); if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getAnalysisSize().getWidth() * mSurfaceSizeDefinition.getAnalysisSize().getHeight()) { configSize = ConfigSize.ANALYSIS; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getPreviewSize().getWidth() * mSurfaceSizeDefinition.getPreviewSize().getHeight()) { configSize = ConfigSize.PREVIEW; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getRecordSize().getWidth() * mSurfaceSizeDefinition.getRecordSize().getHeight()) { configSize = ConfigSize.RECORD; } else if (size.getWidth() * size.getHeight() <= maxSize.getWidth() * maxSize.getHeight()) { configSize = ConfigSize.MAXIMUM; } return SurfaceConfig.create(configType, configSize); }
SupportedSurfaceCombination { SurfaceConfig transformSurfaceConfig(int imageFormat, Size size) { ConfigType configType; ConfigSize configSize = ConfigSize.NOT_SUPPORT; if (getAllOutputSizesByFormat(imageFormat) == null) { throw new IllegalArgumentException( "Can not get supported output size for the format: " + imageFormat); } if (imageFormat == ImageFormat.YUV_420_888) { configType = ConfigType.YUV; } else if (imageFormat == ImageFormat.JPEG) { configType = ConfigType.JPEG; } else if (imageFormat == ImageFormat.RAW_SENSOR) { configType = ConfigType.RAW; } else { configType = ConfigType.PRIV; } Size maxSize = fetchMaxSize(imageFormat); if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getAnalysisSize().getWidth() * mSurfaceSizeDefinition.getAnalysisSize().getHeight()) { configSize = ConfigSize.ANALYSIS; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getPreviewSize().getWidth() * mSurfaceSizeDefinition.getPreviewSize().getHeight()) { configSize = ConfigSize.PREVIEW; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getRecordSize().getWidth() * mSurfaceSizeDefinition.getRecordSize().getHeight()) { configSize = ConfigSize.RECORD; } else if (size.getWidth() * size.getHeight() <= maxSize.getWidth() * maxSize.getHeight()) { configSize = ConfigSize.MAXIMUM; } return SurfaceConfig.create(configType, configSize); } }
SupportedSurfaceCombination { SurfaceConfig transformSurfaceConfig(int imageFormat, Size size) { ConfigType configType; ConfigSize configSize = ConfigSize.NOT_SUPPORT; if (getAllOutputSizesByFormat(imageFormat) == null) { throw new IllegalArgumentException( "Can not get supported output size for the format: " + imageFormat); } if (imageFormat == ImageFormat.YUV_420_888) { configType = ConfigType.YUV; } else if (imageFormat == ImageFormat.JPEG) { configType = ConfigType.JPEG; } else if (imageFormat == ImageFormat.RAW_SENSOR) { configType = ConfigType.RAW; } else { configType = ConfigType.PRIV; } Size maxSize = fetchMaxSize(imageFormat); if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getAnalysisSize().getWidth() * mSurfaceSizeDefinition.getAnalysisSize().getHeight()) { configSize = ConfigSize.ANALYSIS; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getPreviewSize().getWidth() * mSurfaceSizeDefinition.getPreviewSize().getHeight()) { configSize = ConfigSize.PREVIEW; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getRecordSize().getWidth() * mSurfaceSizeDefinition.getRecordSize().getHeight()) { configSize = ConfigSize.RECORD; } else if (size.getWidth() * size.getHeight() <= maxSize.getWidth() * maxSize.getHeight()) { configSize = ConfigSize.MAXIMUM; } return SurfaceConfig.create(configType, configSize); } SupportedSurfaceCombination(
            Context context, String cameraId, CamcorderProfileHelper camcorderProfileHelper); private  SupportedSurfaceCombination(); }
SupportedSurfaceCombination { SurfaceConfig transformSurfaceConfig(int imageFormat, Size size) { ConfigType configType; ConfigSize configSize = ConfigSize.NOT_SUPPORT; if (getAllOutputSizesByFormat(imageFormat) == null) { throw new IllegalArgumentException( "Can not get supported output size for the format: " + imageFormat); } if (imageFormat == ImageFormat.YUV_420_888) { configType = ConfigType.YUV; } else if (imageFormat == ImageFormat.JPEG) { configType = ConfigType.JPEG; } else if (imageFormat == ImageFormat.RAW_SENSOR) { configType = ConfigType.RAW; } else { configType = ConfigType.PRIV; } Size maxSize = fetchMaxSize(imageFormat); if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getAnalysisSize().getWidth() * mSurfaceSizeDefinition.getAnalysisSize().getHeight()) { configSize = ConfigSize.ANALYSIS; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getPreviewSize().getWidth() * mSurfaceSizeDefinition.getPreviewSize().getHeight()) { configSize = ConfigSize.PREVIEW; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getRecordSize().getWidth() * mSurfaceSizeDefinition.getRecordSize().getHeight()) { configSize = ConfigSize.RECORD; } else if (size.getWidth() * size.getHeight() <= maxSize.getWidth() * maxSize.getHeight()) { configSize = ConfigSize.MAXIMUM; } return SurfaceConfig.create(configType, configSize); } SupportedSurfaceCombination(
            Context context, String cameraId, CamcorderProfileHelper camcorderProfileHelper); private  SupportedSurfaceCombination();  }
SupportedSurfaceCombination { SurfaceConfig transformSurfaceConfig(int imageFormat, Size size) { ConfigType configType; ConfigSize configSize = ConfigSize.NOT_SUPPORT; if (getAllOutputSizesByFormat(imageFormat) == null) { throw new IllegalArgumentException( "Can not get supported output size for the format: " + imageFormat); } if (imageFormat == ImageFormat.YUV_420_888) { configType = ConfigType.YUV; } else if (imageFormat == ImageFormat.JPEG) { configType = ConfigType.JPEG; } else if (imageFormat == ImageFormat.RAW_SENSOR) { configType = ConfigType.RAW; } else { configType = ConfigType.PRIV; } Size maxSize = fetchMaxSize(imageFormat); if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getAnalysisSize().getWidth() * mSurfaceSizeDefinition.getAnalysisSize().getHeight()) { configSize = ConfigSize.ANALYSIS; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getPreviewSize().getWidth() * mSurfaceSizeDefinition.getPreviewSize().getHeight()) { configSize = ConfigSize.PREVIEW; } else if (size.getWidth() * size.getHeight() <= mSurfaceSizeDefinition.getRecordSize().getWidth() * mSurfaceSizeDefinition.getRecordSize().getHeight()) { configSize = ConfigSize.RECORD; } else if (size.getWidth() * size.getHeight() <= maxSize.getWidth() * maxSize.getHeight()) { configSize = ConfigSize.MAXIMUM; } return SurfaceConfig.create(configType, configSize); } SupportedSurfaceCombination(
            Context context, String cameraId, CamcorderProfileHelper camcorderProfileHelper); private  SupportedSurfaceCombination();   }