mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-02 07:08:19 +00:00
Use AV capture methods available since iOS 7
This commit is contained in:
committed by
Sam Lantinga
parent
016a1b87a6
commit
0270da4d1f
@@ -440,13 +440,11 @@ static bool COREMEDIA_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *spec)
|
||||
}
|
||||
[session addOutput:output];
|
||||
|
||||
// Try to set the frame rate on the connection
|
||||
AVCaptureConnection *connection = [output connectionWithMediaType:AVMediaTypeVideo];
|
||||
if (connection && connection.isVideoMinFrameDurationSupported) {
|
||||
connection.videoMinFrameDuration = frameDuration;
|
||||
if (connection.isVideoMaxFrameDurationSupported) {
|
||||
connection.videoMaxFrameDuration = frameDuration;
|
||||
}
|
||||
// Try to set the frame rate on the device (preferred modern approach)
|
||||
if ([avdevice lockForConfiguration:nil]) {
|
||||
avdevice.activeVideoMinFrameDuration = frameDuration;
|
||||
avdevice.activeVideoMaxFrameDuration = frameDuration;
|
||||
[avdevice unlockForConfiguration];
|
||||
}
|
||||
|
||||
[session commitConfiguration];
|
||||
|
||||
Reference in New Issue
Block a user