Skip to content

[camera_platform_interface] Add NV21 as an image stream format #3469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/camera/camera_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 2.5.0

* Adds NV21 as an image stream format (suitable for Android).
* Aligns Dart and Flutter SDK constraints.

## 2.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ enum ImageFormatGroup {
/// On Android, this is `android.graphics.ImageFormat.JPEG`. See
/// https://developer.android.com/reference/android/graphics/ImageFormat#JPEG
jpeg,

/// YCrCb format used for images, which uses the NV21 encoding format.
///
/// On Android, this is `android.graphics.ImageFormat.NV21`. See
/// https://developer.android.com/reference/android/graphics/ImageFormat#NV21
nv21,
}

/// Extension on [ImageFormatGroup] to stringify the enum
Expand All @@ -46,6 +52,8 @@ extension ImageFormatGroupName on ImageFormatGroup {
return 'yuv420';
case ImageFormatGroup.jpeg:
return 'jpeg';
case ImageFormatGroup.nv21:
return 'nv21';
case ImageFormatGroup.unknown:
return 'unknown';
}
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.4.1
version: 2.5.0

environment:
sdk: ">=2.17.0 <4.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void main() {
expect(ImageFormatGroup.bgra8888.name(), 'bgra8888');
expect(ImageFormatGroup.yuv420.name(), 'yuv420');
expect(ImageFormatGroup.jpeg.name(), 'jpeg');
expect(ImageFormatGroup.nv21.name(), 'nv21');
expect(ImageFormatGroup.unknown.name(), 'unknown');
});
});
Expand Down