Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
8c63615
add heic support image iOS
Mairramer Jul 29, 2023
78a86ec
format files
Mairramer Jul 29, 2023
a43d149
Merge branch 'main' into add-heic-support-ios
Mairramer Jul 29, 2023
88c7228
update version camera_platform_interface
Mairramer Jul 29, 2023
a90a81b
fix version
Mairramer Jul 29, 2023
a98c047
new test
Mairramer Jul 29, 2023
19b6ee2
update example
Mairramer Jul 29, 2023
44b7f43
refactor and adjusts code
Mairramer Jul 30, 2023
c67bf61
Update FLTCam_Test.h
Mairramer Jul 30, 2023
5f9a5fc
Update FLTCam.m
Mairramer Jul 30, 2023
88bb20d
Update CameraPlugin.m
Mairramer Jul 30, 2023
1e77287
new adjusts
Mairramer Jul 30, 2023
2abeabe
Update FLTCam.h
Mairramer Jul 30, 2023
d889f8b
Update CHANGELOG.md
Mairramer Jul 30, 2023
53a5838
fix versions
Mairramer Jul 30, 2023
89905f7
fix versions
Mairramer Jul 30, 2023
c748a86
fix versions to NEXT
Mairramer Jul 30, 2023
4d7b623
versions next section
Mairramer Jul 30, 2023
f0a42b2
Merge branch 'main' into add-heic-support-ios
Mairramer Jul 30, 2023
42cdd9d
fix tests
Mairramer Jul 31, 2023
897414f
Merge branch 'main' into add-heic-support-ios
Mairramer Aug 2, 2023
e7c21a1
Merge branch 'main' into add-heic-support-ios
Mairramer Aug 3, 2023
4ee2527
refactor code
Mairramer Aug 3, 2023
a446d01
added default value
Mairramer Aug 4, 2023
d5e261d
Merge remote-tracking branch 'origin/main' into add-heic-support-ios
Mairramer Oct 13, 2023
c5a812a
rebase main
Mairramer Oct 14, 2023
d15112e
fix header
Mairramer Oct 14, 2023
f906e99
format code
Mairramer Oct 14, 2023
2bad48f
Merge branch 'main' into add-heic-support-ios
Mairramer Oct 14, 2023
b6be5b5
add interface
Mairramer Oct 14, 2023
f57a9c2
fixes
Mairramer Oct 14, 2023
729b7a2
add interface
Mairramer Oct 14, 2023
d14f6cb
added test
Mairramer Oct 14, 2023
305c3b4
improves
Mairramer Oct 14, 2023
e62f6d2
rename extension
Mairramer Oct 15, 2023
4fc1da0
format
Mairramer Oct 15, 2023
3df56b3
refactor code
Mairramer Oct 18, 2023
3cb6af3
fix tests
Mairramer Oct 18, 2023
8564f1c
fix test
Mairramer Oct 18, 2023
cf53b1c
remove comment
Mairramer Oct 18, 2023
dc2fb21
code format
Mairramer Oct 18, 2023
c22989e
fix format
Mairramer Oct 18, 2023
a95ccef
format code
Mairramer Oct 18, 2023
97408df
fix format
Mairramer Oct 18, 2023
a5b8f1b
code improve
Mairramer Oct 19, 2023
1a39b9a
fix
Mairramer Oct 19, 2023
2b94bdb
improve code
Mairramer Oct 19, 2023
fb88b94
fix test
Mairramer Oct 19, 2023
59f1a10
format code
Mairramer Oct 20, 2023
383afa2
Merge branch 'main' into add-heic-support-ios
Mairramer Oct 20, 2023
7d9f5f5
fix mistake
Mairramer Oct 20, 2023
4bc9eb8
fix update android
Mairramer Oct 20, 2023
998d2b6
rename file
Mairramer Oct 20, 2023
441eb68
fix export
Mairramer Oct 20, 2023
c5ac5b6
update version
Mairramer Oct 20, 2023
0e55574
Merge branch 'main' into add-heic-support-ios
Mairramer Oct 20, 2023
6ad2422
refactor logic
Mairramer Oct 20, 2023
d728a4f
Merge branch 'main' into add-heic-support-ios
Mairramer Oct 20, 2023
4846d4a
improve code
Mairramer Oct 22, 2023
b010609
format code
Mairramer Oct 22, 2023
369aa1b
clang format
Mairramer Oct 23, 2023
f07bc24
next to camera
Mairramer Oct 23, 2023
c9f4df4
Merge branch 'main' into add-heic-support-ios
Mairramer Oct 23, 2023
b2ea23d
Merge branch 'main' into add-heic-support-ios
Mairramer Oct 23, 2023
eb49544
some changes
Mairramer Oct 31, 2023
73680ff
Merge branch 'main' into add-heic-support-ios
Mairramer Nov 1, 2023
23375ab
fix false positive tests
Mairramer Nov 1, 2023
0bdd96a
fix
Mairramer Nov 1, 2023
a7ede43
fix changelog
Mairramer Nov 2, 2023
7ae8540
fix tests
Mairramer Nov 3, 2023
5ed3a45
Merge branch 'main' into add-heic-support-ios
Mairramer Nov 17, 2023
c95d0f0
rename
Mairramer Nov 17, 2023
572eef1
Merge branch 'main' into add-heic-support-ios
Mairramer Nov 28, 2023
09e8f0a
new changes
Mairramer Nov 28, 2023
e271274
remove changes camera
Mairramer Nov 28, 2023
2338ac7
fix
Mairramer Nov 28, 2023
33b2dde
fix import
Mairramer Nov 28, 2023
df51b0b
new changes
Mairramer Nov 28, 2023
be233cb
fix
Mairramer Nov 28, 2023
f4b77ec
fix
Mairramer Nov 28, 2023
5cbb66b
new fixes
Mairramer Nov 29, 2023
4079924
format code
Mairramer Nov 29, 2023
9410af7
update some wording
bparrishMines Dec 5, 2023
d32d324
Merge branch 'main' of github.com:flutter/packages into add-heic-supp…
bparrishMines Dec 5, 2023
396a1bc
Merge branch 'main' into add-heic-support-ios
Mairramer Dec 22, 2023
344d22e
remove federated
Mairramer Dec 22, 2023
8bf202d
Merge branch 'main' into add-heic-support-ios
Mairramer Dec 28, 2023
0587ba5
Merge branch 'main' into add-heic-support-ios
Mairramer Jan 4, 2024
25b0676
Merge branch 'main' into add-heic-support-ios
Mairramer Jan 6, 2024
ebc79ba
Merge branch 'main' into add-heic-support-ios
Mairramer Jan 13, 2024
570db5f
Merge branch 'main' into add-heic-support-ios
Mairramer Jan 17, 2024
3d26f58
Merge branch 'main' into add-heic-support-ios
Mairramer Jan 19, 2024
feeff1f
Merge branch 'main' into add-heic-support-ios
Mairramer Jan 24, 2024
9588e3e
Update project.pbxproj
bparrishMines Jan 24, 2024
dbf5161
Merge branch 'main' into add-heic-support-ios
bparrishMines Jan 24, 2024
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
Prev Previous commit
Next Next commit
improve code
  • Loading branch information
Mairramer committed Oct 19, 2023
commit 2b94bdb7bc26f0020149298ac68b8119312e4f9b
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ - (void)testCaptureToFile_mustSetExtensionToHeicIfAvailablePhotoCodecTypesContai
dispatch_queue_set_specific(captureSessionQueue, FLTCaptureSessionQueueSpecific,
(void *)FLTCaptureSessionQueueSpecific, NULL);
FLTCam *cam = FLTCreateCamWithCaptureSessionQueue(captureSessionQueue);
[cam setFileFormat:FLTFileFormatHEIF];

[cam setFileFormat:FCPFileFormatHEIF];

// Set photo settings to HEVC
AVCapturePhotoSettings *settings =
Expand Down Expand Up @@ -139,4 +138,43 @@ - (void)testCaptureToFile_mustSetExtensionToHeicIfAvailablePhotoCodecTypesContai
});
[self waitForExpectationsWithTimeout:1 handler:nil];
}

- (void)testCaptureToFile_mustSetExtensionToJpegIfAvailablePhotoCodecTypesDoesNotContainHEVC {
XCTestExpectation *expectation =
[self expectationWithDescription:
@"Test must set extension to jpeg if availablePhotoCodecTypes does not contain HEVC."];
dispatch_queue_t captureSessionQueue = dispatch_queue_create("capture_session_queue", NULL);
dispatch_queue_set_specific(captureSessionQueue, FLTCaptureSessionQueueSpecific,
(void *)FLTCaptureSessionQueueSpecific, NULL);
FLTCam *cam = FLTCreateCamWithCaptureSessionQueue(captureSessionQueue);
[cam setFileFormat:FCPFileFormatHEIF];

AVCapturePhotoSettings *settings = [AVCapturePhotoSettings photoSettings];
id mockSettings = OCMClassMock([AVCapturePhotoSettings class]);
OCMStub([mockSettings photoSettings]).andReturn(settings);

NSString *filePath = @"test";
id mockResult = OCMClassMock([FLTThreadSafeFlutterResult class]);
OCMStub([mockResult sendSuccessWithData:filePath]).andDo(^(NSInvocation *invocation) {
[expectation fulfill];
});

id mockOutput = OCMClassMock([AVCapturePhotoOutput class]);

OCMStub([mockOutput capturePhotoWithSettings:OCMOCK_ANY delegate:OCMOCK_ANY])
.andDo(^(NSInvocation *invocation) {
FLTSavePhotoDelegate *delegate = cam.inProgressSavePhotoDelegates[@(settings.uniqueID)];
// Completion runs on IO queue.
dispatch_queue_t ioQueue = dispatch_queue_create("io_queue", NULL);
dispatch_async(ioQueue, ^{
delegate.completionHandler(filePath, nil);
});
});
cam.capturePhotoOutput = mockOutput;
// `FLTCam::captureToFile` runs on capture session queue.
dispatch_async(captureSessionQueue, ^{
[cam captureToFile:mockResult];
[self waitForExpectationsWithTimeout:1 handler:nil];
});
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ extern OSType FLTGetVideoFormatFromString(NSString *videoFormatString);
/**
* Represents image format. Mirrors FileFormat in camera.dart.
*/
typedef NS_ENUM(NSInteger, FLTFileFormat) {
FLTFileFormatJPEG,
FLTFileFormatHEIF,
typedef NS_ENUM(NSInteger, FCPFileFormat) {
FCPFileFormatJPEG,
FCPFileFormatHEIF,
};

#pragma mark - image extension

/**
* Gets a string representation of FileFormat.
*/
extern FLTFileFormat FLTGetFileFormatFromString(NSString *fileFormatString);
extern FCPFileFormat FLTGetFileFormatFromString(NSString *fileFormatString);

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ OSType FLTGetVideoFormatFromString(NSString *videoFormatString) {

#pragma mark - video codec

FLTFileFormat FLTGetFileFormatFromString(NSString *fileFormatString) {
FCPFileFormat FLTGetFileFormatFromString(NSString *fileFormatString) {
if ([fileFormatString isEqualToString:@"jpg"]) {
return FLTFileFormatJPEG;
return FCPFileFormatJPEG;
} else if ([fileFormatString isEqualToString:@"heif"]) {
return FLTFileFormatHEIF;
return FCPFileFormatHEIF;
} else {
NSError *error = [NSError
errorWithDomain:NSCocoaErrorDomain
Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera_avfoundation/ios/Classes/FLTCam.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(assign, nonatomic) FLTFlashMode flashMode;
// Format used for video and image streaming.
@property(assign, nonatomic) FourCharCode videoFormat;
@property(assign, nonatomic) FLTFileFormat fileFormat;
@property(assign, nonatomic) FCPFileFormat fileFormat;

/// Initializes an `FLTCam` instance.
/// @param cameraName a name used to uniquely identify the camera.
Expand All @@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)captureToFile:(FLTThreadSafeFlutterResult *)result;
- (void)close;
- (void)startVideoRecordingWithResult:(FLTThreadSafeFlutterResult *)result;
- (void)setFileFormat:(FLTFileFormat)fileFormat;
- (void)setFileFormat:(FCPFileFormat)fileFormat;
/**
* Starts recording a video with an optional streaming messenger.
* If the messenger is non-null then it will be called for each
Expand Down
6 changes: 3 additions & 3 deletions packages/camera/camera_avfoundation/ios/Classes/FLTCam.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ - (instancetype)initWithCameraName:(NSString *)cameraName
_deviceOrientation = orientation;
_videoFormat = kCVPixelFormatType_32BGRA;
_inProgressSavePhotoDelegates = [NSMutableDictionary dictionary];
_fileFormat = FLTFileFormatJPEG;
_fileFormat = FCPFileFormatJPEG;

// To limit memory consumption, limit the number of frames pending processing.
// After some testing, 4 was determined to be the best maximum value.
Expand Down Expand Up @@ -219,7 +219,7 @@ - (void)setVideoFormat:(OSType)videoFormat {
@{(NSString *)kCVPixelBufferPixelFormatTypeKey : @(videoFormat)};
}

- (void)setFileFormat:(FLTFileFormat)fileFormat {
- (void)setFileFormat:(FCPFileFormat)fileFormat {
_fileFormat = fileFormat;
}

Expand Down Expand Up @@ -264,7 +264,7 @@ - (void)captureToFile:(FLTThreadSafeFlutterResult *)result {
[settings setHighResolutionPhotoEnabled:YES];
}

if (_fileFormat == FLTFileFormatHEIF) {
if (_fileFormat == FCPFileFormatHEIF) {
if ([self.capturePhotoOutput.availablePhotoCodecTypes containsObject:AVVideoCodecTypeHEVC]) {
settings = [AVCapturePhotoSettings
photoSettingsWithFormat:@{AVVideoCodecKey : AVVideoCodecTypeHEVC}];
Expand Down