Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[camera_platform_interface] Added imageFormatGroup to initialize #3364

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions packages/camera/camera_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.0

- Introduces option to set ImageFormat when initializing

## 1.0.4

- Added the torch option to the FlashMode enum, which when implemented indicates the flash light should be turned on continuously.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MethodChannelCamera extends CameraPlatform {
}

@override
Future<void> initializeCamera(int cameraId) {
Future<void> initializeCamera(int cameraId, {int imageFormatGroup}) {
_channels.putIfAbsent(cameraId, () {
final channel = MethodChannel('flutter.io/cameraPlugin/camera$cameraId');
channel.setMethodCallHandler(
Expand All @@ -93,6 +93,7 @@ class MethodChannelCamera extends CameraPlatform {
'initialize',
<String, dynamic>{
'cameraId': cameraId,
'imageFormatGroup': imageFormatGroup,
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ abstract class CameraPlatform extends PlatformInterface {
}

/// Initializes the camera on the device.
Future<void> initializeCamera(int cameraId) {
///
/// [imageFormatGroup] is used to specify the image formatting used.
/// On Android this defaults to ImageFormat.YUV_420_888 and applies only to the imageStream.
/// On iOS this defaults to kCVPixelFormatType_32BGRA
Future<void> initializeCamera(int cameraId, {int imageFormatGroup}) {
throw UnimplementedError('initializeCamera() is not implemented.');
}

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 @@ -3,7 +3,7 @@ description: A common platform interface for the camera plugin.
homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera_platform_interface
# 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: 1.0.4
version: 1.1.0

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ void main() {
MethodChannelMock cameraMockChannel = MethodChannelMock(
channelName: 'plugins.flutter.io/camera',
methods: {
'create': {'cameraId': 1}
'create': {
'cameraId': 1,
'imageFormatGroup': null,
}
});
final camera = MethodChannelCamera();

Expand Down Expand Up @@ -107,7 +110,10 @@ void main() {
MethodChannelMock cameraMockChannel = MethodChannelMock(
channelName: 'plugins.flutter.io/camera',
methods: {
'create': {'cameraId': 1},
'create': {
'cameraId': 1,
'imageFormatGroup': null,
},
'initialize': null
});
final camera = MethodChannelCamera();
Expand All @@ -130,6 +136,7 @@ void main() {
'initialize',
arguments: {
'cameraId': 1,
'imageFormatGroup': null,
},
),
]);
Expand Down