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