From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id F11394021A for ; Sun, 19 Dec 2021 22:17:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A580C68AEE0; Mon, 20 Dec 2021 00:17:45 +0200 (EET) Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7549568A5E4 for ; Mon, 20 Dec 2021 00:17:38 +0200 (EET) Received: by mail-il1-f171.google.com with SMTP id j6so4779625ila.4 for ; Sun, 19 Dec 2021 14:17:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rcombs.me; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=89QFBP1vEt+QzI4whDmKP7ydLR0PujRrV2spbHLMOuo=; b=HhNdJUfcHvfkehzntkWYjBxYnhn108HUwwD6PUhrYJFJurdi6SLANOD3mYWNPuoxeq xotyWxjBEe+se7jeo7H8pO+ZSU+eIrGOwZXE4xm8pC42KsIXltQ6pJADM4So4V2B/lW8 OxEHaX6r4cgRiDwuYDNq9MjbgSnor0yO+OUJIv3MdKjpbMZYjhGgGNmBMmRsdbdKb8yQ r8G9JXrcjVnFUsjY2edwxUMQJ44ATjIwACtA87o/P0vvTzFRmD94cgB5j5T5nuxMEMOS dhPwGU9V02ezQFGw9JLqbx7sstCcAgph6oh+iFUmNuSA4et6AfoilLbCAPG4+PP7tr76 Gn9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=89QFBP1vEt+QzI4whDmKP7ydLR0PujRrV2spbHLMOuo=; b=NdJIbZFebkY/kTaIA7shDeR8OcgPaFTR0is2tbYJesukuWGdoZS0iKciNSmJvuSm7V vxvjjOJSsyi4OS1WMwihtrFUQ9CjKbtVY+A4qS4mL5TVEKGZ80+UmOc/3u8xSwSye/l5 e4vkWZaqVyzD2Rm/IRH/gRXsJLBPdQ1fMyk+63DCN0c6GubNLtAyr2lXuUdniMEYjNNz 0unzlGwH8v3WF5toHLuvwgKa4m4bnK7tujfTNK9dZHCSsLmrAhLNPeDTvCxnhgXSHm9V szM+Q7sE0gM141I1Nn3vnxrQyDcNQzQO+7l012C+Umlk1MZfTB49+OEgD2ErJ6rbzDok iCOg== X-Gm-Message-State: AOAM530qXw1MlfA/upmmJXvncP2Pz0Zu7v7mJvwNJW564gYMCFTskwgP HkHS6g/wuFjattaihLFrPDtv X-Google-Smtp-Source: ABdhPJx6905SI3Q1omVpUjlLNMb5kzAAad9iyENxYUW5A1dlzVWxwSzkaUHfyvPV87c1EWSUHDNTUw== X-Received: by 2002:a92:d304:: with SMTP id x4mr6120760ila.149.1639952256939; Sun, 19 Dec 2021 14:17:36 -0800 (PST) Received: from smtpclient.apple ([2601:243:2000:5ac:4004:a55:d96d:da04]) by smtp.gmail.com with ESMTPSA id c22sm7778539ioz.15.2021.12.19.14.17.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Dec 2021 14:17:36 -0800 (PST) From: Ridley Combs Message-Id: Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Date: Sun, 19 Dec 2021 16:17:35 -0600 In-Reply-To: <3F585874-A24F-4758-AFAD-A3C7FB266068@gmail.com> To: Marvin Scholz References: <20211217200418.68942-1-ffmpeg@tmm1.net> <20211217200418.68942-3-ffmpeg@tmm1.net> <08de8d98-1b78-07c4-3b07-c4619635c610@gmail.com> <3F585874-A24F-4758-AFAD-A3C7FB266068@gmail.com> X-Mailer: Apple Mail (2.3693.40.0.1.81) X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v4 3/5] avutil: add obj-c helpers into header-only include X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: ffmpeg-devel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > On Dec 19, 2021, at 12:03, Marvin Scholz wrote: > > > > On 19 Dec 2021, at 18:35, Aman Karmani wrote: > >> On Sun, Dec 19, 2021 at 9:09 AM James Almer wrote: >> >>> On 12/17/2021 5:04 PM, Aman Karmani wrote: >>>> From: Aman Karmani >>>> >>>> Reviewed-by: Ridley Combs >>>> Signed-off-by: Aman Karmani >>>> --- >>>> libavutil/objc.h | 32 ++++++++++++++++++++++++++++++++ >>>> 1 file changed, 32 insertions(+) >>>> create mode 100644 libavutil/objc.h >>>> >>>> diff --git a/libavutil/objc.h b/libavutil/objc.h >>>> new file mode 100644 >>>> index 0000000000..0db993f716 >>>> --- /dev/null >>>> +++ b/libavutil/objc.h >>>> @@ -0,0 +1,32 @@ >>>> +/* >>>> + * This file is part of FFmpeg. >>>> + * >>>> + * FFmpeg is free software; you can redistribute it and/or >>>> + * modify it under the terms of the GNU Lesser General Public >>>> + * License as published by the Free Software Foundation; either >>>> + * version 2.1 of the License, or (at your option) any later version. >>>> + * >>>> + * FFmpeg is distributed in the hope that it will be useful, >>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >>>> + * Lesser General Public License for more details. >>>> + * >>>> + * You should have received a copy of the GNU Lesser General Public >>>> + * License along with FFmpeg; if not, write to the Free Software >>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >>> 02110-1301 USA >>>> + */ >>>> + >>>> +#ifndef AVUTIL_OBJC_H >>>> +#define AVUTIL_OBJC_H >>>> + >>>> +#include >>>> + >>>> +static inline void ff_objc_release(NSObject **obj) >>>> +{ >>>> + if (*obj) { >>>> + [*obj release]; >>>> + *obj = nil; >>>> + } >>>> +} >>>> + >>>> +#endif /* AVUTIL_OBJC_H */ >>> >>> This breaks checkheaders. It should be added to SKIPHEADERS with the >>> corresponding check. >>> >> >> Sorry, will fix. >> >> >>> >>> Also, why is this in lavu if it's ultimately only used in lavfi? And >>> does it need to be a separate header at all? It's apparently not even C. >>> >> >> It is a generic helper requested by rcombs. I think the plan is to reuse it >> in other filters/decoders/encoders written in obj-c. >> >> One of the reasons is becausing calling `[nil release]` can crash. > > That's not true, dispatching a message to nil in Objective-C has no effect. > I don't really see the benefit of this helper, personally. The main point is the same as av_freep: it combines releasing the memory and nulling out the pointer into a single call, so we can't end up with dangling pointers by mistake. > >> >> You're right that it is not C, its obj-c and that's why it was simpler to >> have it be an include only header. I'm not sure if using a different >> extension would have been preferred. >> >> Aman >> >> >>> _______________________________________________ >>> 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". _______________________________________________ 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".