Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "徐福隆 via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
To: =?gb18030?B?RkZtcGVnIGRldmVsb3BtZW50IGRpc2N1c3Npb25zIGFuZCBwYXRjaGVz?=
	<ffmpeg-devel@ffmpeg.org>
Cc: =?gb18030?B?0Oy4o8Kh?= <839789740@qq.com>,
	=?gb18030?B?dGhpbG8uYm9yZ21hbm4=?= <thilo.borgmann@mail.de>,
	=?gb18030?B?ZXBpcmF0MDc=?= <epirat07@gmail.com>
Subject: Re: [FFmpeg-devel] [PATCH] avdevice/avfoundation: replace AVCaptureDevice with new api
Date: Tue, 5 Dec 2023 17:42:46 +0800
Message-ID: <tencent_049E105DB6540C0DE32D7867B64A1EDCF206@qq.com> (raw)
In-Reply-To: <1179d31f-dcea-4a2d-b14a-59849e975d91@mail.de>

Thank you for your suggestion.
I will adapt the judgment condition, and submit again.


------------------&nbsp;Original&nbsp;------------------
From:                                                                                                                        "FFmpeg development discussions and patches"                                                                                    <ffmpeg-devel@ffmpeg.org&gt;;
Date:&nbsp;Mon, Dec 4, 2023 09:55 PM
To:&nbsp;"ffmpeg-devel"<ffmpeg-devel@ffmpeg.org&gt;;
Cc:&nbsp;"Thilo Borgmann"<thilo.borgmann@mail.de&gt;;
Subject:&nbsp;Re: [FFmpeg-devel] [PATCH] avdevice/avfoundation: replace AVCaptureDevice with new api



Am 04.12.23 um 13:47 schrieb xufuji456 via ffmpeg-devel:
&gt; Building with iOS platform, the compiler has a warning: "'devicesWithMediaType:' is deprecated: first deprecated in iOS 10.0 - Use AVCaptureDeviceDiscoverySession instead"
&gt; 
&gt; Signed-off-by: xufuji456 <839789740@qq.com&gt;
&gt; ---
&gt;&nbsp;&nbsp; libavdevice/avfoundation.m | 81 +++++++++++++++++++++++++++++++++++---
&gt;&nbsp;&nbsp; 1 file changed, 76 insertions(+), 5 deletions(-)
&gt; 
&gt; diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
&gt; index 36ad834753..668c726eb7 100644
&gt; --- a/libavdevice/avfoundation.m
&gt; +++ b/libavdevice/avfoundation.m
&gt; @@ -770,8 +770,38 @@ static int avf_read_header(AVFormatContext *s)
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AVCaptureDevice *video_device = nil;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AVCaptureDevice *audio_device = nil;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Find capture device
&gt; -&nbsp;&nbsp;&nbsp; NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
&gt; -&nbsp;&nbsp;&nbsp; NSArray *devices_muxed = [AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed];
&gt; +&nbsp;&nbsp;&nbsp; NSArray *devices = nil;
&gt; +&nbsp;&nbsp;&nbsp; NSArray *devices_muxed = nil;
&gt; +


&gt; +&nbsp;&nbsp;&nbsp; if (TARGET_OS_IPHONE) {
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (@available(iOS 10.0, *)) {

The preprocessor directives should be more reliable especially on older machines.
See other parts of the code which are handled that way and adopt for your case.


&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession =
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [AVCaptureDeviceDiscoverySession
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mediaType:AVMediaTypeVideo
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position:AVCaptureDevicePositionUnspecified];
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; devices = [captureDeviceDiscoverySession devices];

&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&gt; +&nbsp;&nbsp;&nbsp; } else {
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
&gt; +&nbsp;&nbsp;&nbsp; }

Here and in other chunks you can join the if() conditions into one and avoid the duplication of the old code.


-Thilo
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-12-05  9:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 12:47 xufuji456 via ffmpeg-devel
2023-12-04 13:55 ` Thilo Borgmann via ffmpeg-devel
2023-12-05  9:42   ` 徐福隆 via ffmpeg-devel [this message]
2023-12-04 14:25 ` epirat07
2023-12-05 13:33 xufuji456 via ffmpeg-devel
2023-12-05 14:16 ` Thilo Borgmann via ffmpeg-devel
2023-12-05 14:19   ` Thilo Borgmann via ffmpeg-devel
2023-12-05 14:21     ` Thilo Borgmann via ffmpeg-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_049E105DB6540C0DE32D7867B64A1EDCF206@qq.com \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=839789740@qq.com \
    --cc=epirat07@gmail.com \
    --cc=thilo.borgmann@mail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git