Lines Matching refs:format

49  * for that format) that are supported by a camera device.</p>
51 * <p>This also contains the minimum frame durations and stall durations for each format/size
105 // For each format, track how many sizes there are available to configure
142 * Get the image {@code format} output formats in this stream configuration.
150 * @return an array of integer format
160 * Get the image {@code format} input formats in this stream configuration.
165 * @return an array of integer format
177 * Get the supported input sizes for this input format.
179 * <p>The format must have come from {@link #getInputFormats}; otherwise
182 * @param format a format from {@link #getInputFormats}
183 * @return a non-empty array of sizes, or {@code null} if the format was not available.
187 public Size[] getInputSizes(final int format) {
188 return getPublicFormatSizes(format, /*output*/false);
192 * Determine whether or not output surfaces with a particular user-defined format can be passed
195 * <p>This method determines that the output {@code format} is supported by the camera device;
196 * each output {@code surface} target may or may not itself support that {@code format}.
202 * @param format an image format from either {@link ImageFormat} or {@link PixelFormat}
204 * {@code true} iff using a {@code surface} with this {@code format} will be
208 * if the image format was not a defined named constant
215 public boolean isOutputSupportedFor(int format) {
216 checkArgumentFormat(format);
218 format = imageFormatToInternal(format);
219 return getFormatsMap(/*output*/true).containsKey(format);
249 * <p>Since not all of the above classes support output of all format and size combinations,
292 * <li>Using a format that's not listed by {@link #getOutputFormats}
293 * <li>Using a format/size combination that's not listed by {@link #getOutputSizes}
299 * not match a camera-supported size, as long as the format (or class) is supported and the
300 * camera device supports a size that is equal to or less than 1080p in that format. If such as
340 // Mathing format, either need exact size match, or a flexible consumer
357 * an opaque/implementation-defined (under-the-hood) format; this function only returns
358 * sizes for the implementation-defined format.</p>
364 * <p>If a well-defined format such as {@code NV21} is required, use
394 * Get a list of sizes compatible with the requested image {@code format}.
396 * <p>The {@code format} should be a supported format (one of the formats returned by
399 * @param format an image format from {@link ImageFormat} or {@link PixelFormat}
402 * or {@code null} if the {@code format} is not a supported output
408 public Size[] getOutputSizes(int format) {
409 return getPublicFormatSizes(format, /*output*/true);
471 throw new IllegalArgumentException(String.format(
547 throw new IllegalArgumentException(String.format(
563 * for the format/size combination (in nanoseconds).
565 * <p>{@code format} should be one of the ones returned by {@link #getOutputFormats()}.</p>
582 * <p>The minimum frame duration of a stream (of a particular format, size) is the same
586 * @param format an image format from {@link ImageFormat} or {@link PixelFormat}
591 * @throws IllegalArgumentException if {@code format} or {@code size} was not supported
599 public long getOutputMinFrameDuration(int format, Size size) {
601 checkArgumentFormatSupported(format, /*output*/true);
603 return getInternalFormatDuration(imageFormatToInternal(format), size, DURATION_MIN_FRAME);
610 * <p>This assumes a the {@code klass} is set up to use an implementation-defined format.
632 * <p>The minimum frame duration of a stream (of a particular format, size) is the same
660 * Get the stall duration for the format/size combination (in nanoseconds).
662 * <p>{@code format} should be one of the ones returned by {@link #getOutputFormats()}.</p>
730 * @param format an image format from {@link ImageFormat} or {@link PixelFormat}
734 * @throws IllegalArgumentException if {@code format} or {@code size} was not supported
741 public long getOutputStallDuration(int format, Size size) {
742 checkArgumentFormatSupported(format, /*output*/true);
744 return getInternalFormatDuration(imageFormatToInternal(format),
751 * <p>This assumes a the {@code klass} is set up to use an implementation-defined format.
825 private int checkArgumentFormatSupported(int format, boolean output) {
826 checkArgumentFormat(format);
830 if (format == formats[i]) {
831 return format;
835 throw new IllegalArgumentException(String.format(
836 "format %x is not supported by this stream configuration map", format));
840 * Ensures that the format is either user-defined or implementation defined.
842 * <p>If a format has a different internal representation than the public representation,
851 * @param format image format
852 * @return the format
854 * @throws IllegalArgumentException if the format was invalid
856 static int checkArgumentFormatInternal(int format) {
857 switch (format) {
861 return format;
864 "ImageFormat.JPEG is an unknown internal format");
866 return checkArgumentFormat(format);
871 * Ensures that the format is publicly user-defined in either ImageFormat or PixelFormat.
873 * <p>If a format has a different public representation than the internal representation,
885 * @param format image format
886 * @return the format
888 * @throws IllegalArgumentException if the format was not user-defined
890 static int checkArgumentFormat(int format) {
891 if (!ImageFormat.isPublicFormat(format) && !PixelFormat.isPublicFormat(format)) {
892 throw new IllegalArgumentException(String.format(
893 "format 0x%x was not defined in either ImageFormat or PixelFormat", format));
896 return format;
900 * Convert a public-visible {@code ImageFormat} into an internal format
909 * <p>Passing in an implementation-defined format which has no public equivalent will fail;
910 * as will passing in a public format which has a different internal format equivalent.
911 * See {@link #checkArgumentFormat} for more details about a legal public format.</p>
917 * @param format image format from {@link ImageFormat} or {@link PixelFormat}
921 * if {@code format} is {@code HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED} or
928 static int imageFormatToPublic(int format) {
929 switch (format) {
934 "ImageFormat.JPEG is an unknown internal format");
939 return format;
964 * Convert a public format compatible with {@code ImageFormat} to an internal format
973 * <p>Passing in an implementation-defined format here will fail (it's not a public format);
974 * as will passing in an internal format which has a different public format equivalent.
975 * See {@link #checkArgumentFormat} for more details about a legal public format.</p>
981 * @param format public image format from {@link ImageFormat} or {@link PixelFormat}
988 * if {@code format} was {@code HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED}
990 static int imageFormatToInternal(int format) {
991 switch (format) {
998 return format;
1024 private Size[] getPublicFormatSizes(int format, boolean output) {
1026 checkArgumentFormatSupported(format, output);
1031 format = imageFormatToInternal(format);
1033 return getInternalFormatSizes(format, output);
1036 private Size[] getInternalFormatSizes(int format, boolean output) {
1039 Integer sizesCount = formatsMap.get(format);
1041 throw new IllegalArgumentException("format not available");
1049 if (config.getFormat() == format && config.isOutput() == output) {
1068 for (int format : getFormatsMap(output).keySet()) {
1069 if (format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED &&
1070 format != HAL_PIXEL_FORMAT_RAW_OPAQUE) {
1071 formats[i++] = format;
1082 /** Get the format -> size count map for either output or input formats */
1087 private long getInternalFormatDuration(int format, Size size, int duration) {
1088 // assume format is already checked, since its internal
1090 if (!arrayContains(getInternalFormatSizes(format, /*output*/true), size)) {
1097 if (configurationDuration.getFormat() == format &&