[FFmpeg-devel] [PATCH] avdevice/avfoundation: replace deprecated AVCaptureDevice

Thilo Borgmann thilo.borgmann at mail.de
Wed Dec 6 19:39:19 EET 2023


Am 06.12.23 um 13:03 schrieb xufuji456 via ffmpeg-devel:
> Building with iOS platform, the compiler has a warning: "'devicesWithMediaType:' is deprecated: first deprecated in iOS 10.0 - Use AVCaptureDeviceDiscoverySession instead"
> 
> Signed-off-by: xufuji456 <839789740 at qq.com>
> ---
>   libavdevice/avfoundation.m | 23 ++++++++++++++++++-----
>   1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
> index 36ad834753..5ebfe89dca 100644
> --- a/libavdevice/avfoundation.m
> +++ b/libavdevice/avfoundation.m
> @@ -761,6 +761,19 @@ static int get_audio_config(AVFormatContext *s)
>       return 0;
>   }
>   
> +static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
> +#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101500))
> +    AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession =
> +        [AVCaptureDeviceDiscoverySession

> +        discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]

deviceTypes should be an array of all possible types or we risk loosing currently detected hardware.

Otherwise, LGTM.

-Thilo


More information about the ffmpeg-devel mailing list