[FFmpeg-devel] [PATCH 1/2] lavd/avfoundation.m: Remove transport controls for iOS.
Thilo Borgmann
thilo.borgmann at mail.de
Sat Apr 4 14:57:32 EEST 2020
$Subject
-Thilo
-------------- next part --------------
From 20f16ed1ef9f99b847798a28fff46812246a8039 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann <thilo.borgmann at mail.de>
Date: Sat, 4 Apr 2020 13:49:46 +0200
Subject: [PATCH 1/2] lavd/avfoundation.m: Remove transport controls for iOS.
---
libavdevice/avfoundation.m | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 43b2edb44d..9f8186b4d7 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -168,6 +168,7 @@ - (id)initWithContext:(AVFContext*)context
_context = context;
// start observing if a device is set for it
+#if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
if (_context->observed_device) {
NSString *keyPath = NSStringFromSelector(@selector(transportControlsPlaybackMode));
NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew;
@@ -177,14 +178,19 @@ - (id)initWithContext:(AVFContext*)context
options: options
context: _context];
}
+#endif
}
return self;
}
- (void)dealloc {
// stop observing if a device is set for it
- NSString *keyPath = NSStringFromSelector(@selector(transportControlsPlaybackMode));
- [_context->observed_device removeObserver: self forKeyPath: keyPath];
+#if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+ if (_context->observed_device) {
+ NSString *keyPath = NSStringFromSelector(@selector(transportControlsPlaybackMode));
+ [_context->observed_device removeObserver: self forKeyPath: keyPath];
+ }
+#endif
[super dealloc];
}
@@ -537,6 +543,7 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device)
}
[ctx->video_output setAlwaysDiscardsLateVideoFrames:ctx->drop_late_frames];
+#if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
// check for transport control support and set observer device if supported
int trans_ctrl = [video_device transportControlsSupported];
AVCaptureDeviceTransportControlsPlaybackMode trans_mode = [video_device transportControlsPlaybackMode];
@@ -545,6 +552,7 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device)
ctx->observed_mode = trans_mode;
ctx->observed_device = video_device;
}
+#endif
ctx->avf_delegate = [[AVFFrameReceiver alloc] initWithContext:ctx];
--
2.20.1 (Apple Git-117)
More information about the ffmpeg-devel
mailing list