Skip to content

Commit

Permalink
Merge pull request #7260 from misl6/fix/use-nsstring-for-avsessionèreset
Browse files Browse the repository at this point in the history
Camera: Use NSString instead of AVCaptureSessionPreset in order to support MacOS < 10.13
  • Loading branch information
matham committed Dec 11, 2020
2 parents 4e2cd98 + eb81f78 commit 1c0656c
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 1c0656c

Please sign in to comment.