Skip to content
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

Camera: Use NSString instead of AVCaptureSessionPreset in order to support MacOS < 10.13 #7260

Merged
merged 1 commit into from
Dec 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions kivy/core/camera/camera_avfoundation_implem.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ -(void)setNewMetadata:(bool)status{
int startCaptureDevice();
void stopCaptureDevice();
bool attemptFrameRateSelection(int desiredFrameRate);
bool attemptCapturePreset(AVCaptureSessionPreset preset);
bool attemptCapturePreset(NSString *preset);
bool attemptStartMetadataAnalysis();
bool haveNewMetadata();

Expand Down Expand Up @@ -294,7 +294,7 @@ -(void)setNewMetadata:(bool)status{
return isFPSSupported;
}

bool Camera::attemptCapturePreset(AVCaptureSessionPreset preset){
bool Camera::attemptCapturePreset(NSString *preset){
// See available presets: https://developer.apple.com/documentation/avfoundation/avcapturesessionpreset
if([mCaptureSession canSetSessionPreset: preset]){
[mCaptureSession setSessionPreset: preset];
Expand Down Expand Up @@ -393,7 +393,7 @@ -(void)setNewMetadata:(bool)status{
/* By default, We're using the AVCaptureSessionPresetHigh preset for capturing frames on both iOS and MacOS.
The user can override these settings by calling the attemptCapturePreset() function
*/
attemptCapturePreset(AVCaptureSessionPresetHigh);
attemptCapturePreset(@"AVCaptureSessionPresetHigh");

[mCaptureSession addInput:mCaptureDeviceInput];
[mCaptureSession addOutput:mCaptureDecompressedVideoOutput];
Expand Down Expand Up @@ -702,7 +702,7 @@ bool avf_camera_attempt_framerate_selection(camera_t camera, int fps){
}

bool avf_camera_attempt_capture_preset(camera_t camera, char *preset){
AVCaptureSessionPreset capture_preset = (AVCaptureSessionPreset)[NSString stringWithUTF8String:preset];
NSString *capture_preset = [NSString stringWithUTF8String:preset];
NSLog(@"Preset: %@", capture_preset);
return ((Camera *)camera)->attemptCapturePreset(capture_preset);
}
Expand Down