From patchwork Wed Mar 29 08:03:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 3165 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp978002vss; Wed, 29 Mar 2017 01:03:27 -0700 (PDT) X-Received: by 10.28.100.196 with SMTP id y187mr17854108wmb.129.1490774607606; Wed, 29 Mar 2017 01:03:27 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s140si6229420wmd.158.2017.03.29.01.03.27; Wed, 29 Mar 2017 01:03:27 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 48860689AC7; Wed, 29 Mar 2017 11:03:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from golem.pkh.me (LStLambert-657-1-117-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 27023689A92 for ; Wed, 29 Mar 2017 11:02:55 +0300 (EEST) Received: from golem.pkh.me (localhost.localdomain [127.0.0.1]) by golem.pkh.me (OpenSMTPD) with ESMTPSA id f52937a0 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Wed, 29 Mar 2017 08:03:17 +0000 (UTC) Date: Wed, 29 Mar 2017 10:03:15 +0200 From: =?utf-8?B?Q2zDqW1lbnQgQsWTc2No?= To: FFmpeg development discussions and patches Message-ID: <20170329080315.GF14584@golem.pkh.me> Mail-Followup-To: FFmpeg development discussions and patches References: <20170327075203.7499-1-u@pkh.me> <20170328153153.GP3964@golem.pkh.me> <20170329074335.GD14584@golem.pkh.me> <20170329075612.GE14584@golem.pkh.me> MIME-Version: 1.0 In-Reply-To: <20170329075612.GE14584@golem.pkh.me> User-Agent: Mutt/1.8.0 (2017-02-23) Subject: Re: [FFmpeg-devel] [PATCH 01/10] lavu: add av_fourcc_make_string() and av_4cc2str() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Wed, Mar 29, 2017 at 09:56:14AM +0200, Clément Bœsch wrote: > On Wed, Mar 29, 2017 at 09:52:51AM +0200, Carl Eugen Hoyos wrote: > > 2017-03-29 9:43 GMT+02:00 Clément Bœsch : > > > On Wed, Mar 29, 2017 at 09:31:57AM +0200, Carl Eugen Hoyos wrote: > > >> 2017-03-28 17:31 GMT+02:00 Clément Bœsch : > > >> > On Mon, Mar 27, 2017 at 09:51:54AM +0200, Clément Bœsch wrote: > > >> >> --- > > >> >> doc/APIchanges | 4 ++++ > > >> >> libavutil/avutil.h | 14 ++++++++++++++ > > >> >> libavutil/utils.c | 21 +++++++++++++++++++++ > > >> >> libavutil/version.h | 2 +- > > >> >> 4 files changed, 40 insertions(+), 1 deletion(-) > > >> >> > > >> > > > >> > I'll start pushing that patchset tomorrow if I see no objection. > > >> > > >> > +#define av_4cc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc) > > >> > > >> Sorry, I really don't understand: > > >> If the preferred name for this function is "av_4cc2str", why not name > > >> it av_4cc2str()? > > >> > > > > > > I don't understand your question: are you asking why there is a macro > > > and a function with different names? > > > > Yes, why is a function with the preferred name not sufficient? > > > > Because we save the user the need to create a buffer thanks the compound > literal in the macro which can only exist in a macro. It's exactly like > av_ts2str(). > If that's still not clear, here is a typical use case: You can't do the same with a function only unless you ask the user to inline av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]{0}, tag) diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c index 75dcf74a0c..e1ea29b713 100644 --- a/libavformat/apngdec.c +++ b/libavformat/apngdec.c @@ -404,13 +404,9 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; return 0; default: - { - char tag_buf[32]; - - av_get_codec_tag_string(tag_buf, sizeof(tag_buf), tag); - avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32, tag_buf, tag, len); + avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32, + av_fourcc2str(tag), tag, len); avio_skip(pb, len + 4); - } } /* Handle the unsupported yet cases */