From patchwork Wed Dec 15 12:35:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32530 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8176927iog; Wed, 15 Dec 2021 04:37:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwv6zIDm/AhTRw/Qi/jZcFF1emSh4MlEH19suN9WPNiwsnWWmzug9vNX48lvgwqVRLvDuBi X-Received: by 2002:a17:906:c144:: with SMTP id dp4mr8121091ejc.88.1639571866558; Wed, 15 Dec 2021 04:37:46 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h13si1425574ede.483.2021.12.15.04.37.45; Wed, 15 Dec 2021 04:37:46 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=ZFRtpmbf; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2ED9D68B123; Wed, 15 Dec 2021 14:36:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067045.outbound.protection.outlook.com [40.92.67.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A041468B10A for ; Wed, 15 Dec 2021 14:36:11 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2UxjrV7rmdEnZbBY3WZUVsBGo/68Ie3C4cUHP0T9uwHWGfYi6o9Fc+8PpbOxNATEjMPg0zIFVLvJVyWs3LsXaPbeqU9Qn61fvt5RNcKgUqR+NNO7ZpJo1EAB7H8KlVdrZr9lq0PZsukXWnybgp661Nnw27UiA6m3e86oSRoPy7R+KVJXw2PoPKSo7qDs3cFv1AuJybS6eUikJPcrQJfodtScsiHIHOOIV6XX976tJtzDArcQHzEAHo+9uYbLM8Max1Mc8u0nH73DZLhNvG6shsho9SPpPu0kX6pfpOxHQSn2p92ntgBVcNQFXr2KrZxDX3woWpqfOYDP3fS0MUDvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0xez/CoA5lWByq2EyiprBqArt2CUSY159jbocs1c00Q=; b=Gd1bdE0yfGgJmQl10JtrPLpgoPKwGJtLAYu9uEiIFhTqL7rERcAA7uC9wsoCEl2kU+sw+L6VLoAQ2xhsA4yhj1nC2vavQxWpZqGutiOiqe6i3iIx5Y0cd2xq65YkY6H37CTFkfbJZOfVzU9WOhoYgZYkZbD4GAuO4/n0CBU1QRZs9lfRyBmZVpVqFWhy2HLwJwzXZOo3OwJyX55Mwl3pxE4G3i+fO+m/A5Wx53mktL9LwD5/ecQ38HQhvqAh702HHKGdapzNbFIN6TvwOvQr/zGXn8nbAH2rj0LfGctk/fiCQ8xTGUGrwee8J8ZyzBP+ChVdItenXHdBJyZy+q0Y8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0xez/CoA5lWByq2EyiprBqArt2CUSY159jbocs1c00Q=; b=ZFRtpmbfBtsFxRCGw1jDY5L8jn+hlNAzbbJANWCJdLjyNbWBYWRBtHt8qV+wQsx6sxsLA29oSgSKdlNmrZbh7HlVNVDUZX/aRnO539DFurmHDrYA4Tv+qu3srIM2CanB+zEDaDWYXPRNQj+32rXVMnX9ESTCrlkUACbXLNQumu9Cmo6bmBKaWrgCTyvVQCx8gGxw6GN8PvVrv2qATNbOOBPmHyKh9LCR3OwkoBudhPEFabFsUkoKcAN/1nAvhmr0qbZSSWIxdPbTdiBX2WMg7ovK26Wa20P7QByeXTKkE+D4GzLNB2CHEy/JQq5mLQo6HXJIhT7GtPm5jEd0vNK9ww== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:36:08 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:36:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:41 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [ZWmFEWizwZuP+xGZsFkztzCauHbLr/Wv] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-10-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd96ace0-ec77-4720-7e62-08d9bfc77803 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWm3GLoeUntTG6KfWWWbWhlGo9mVYV4KWQ1G214Skfvhzqa3klEqxeLN+h7+MzbLD4y+ey59xxKajjaHAgqb5qY/PsQxTfdtO2I3hLK8t7YmAeg/peK4LffvRKcnCnhcvjRGq+crdmzvqjJAmt55RYoLa3rEZJm2Uw5OnEp1sblUGZrGzA2Hj2QYo3memyTCkvuJFcF+ka/ItXvZPac9Huquw57nObQTgFLDNlk23zMkNVUVAKHotcgbTqkjbov0x81wT+2fSHNQCrO3BqDPwHFpW+06rbhvRseoCapxQ3p2YCfOwa38rNdSkX2yPTMDHAQjbhGS4H72Z5DN4/dju5eo114OUq7dPoyO9Bcu1LDlQjxpm9j7Y9FsEGXQ3LvjobNZcCSGxUBZT0OV/7PbCHV4jVHHjrLVwjHjmiUEBd5wjykbxYeiMGl6Q47+mKN+EmBod0XkzCi9Q7n2d95v8j9oH/xpkz+z8WkFZI2u1CNAW3cZpQVjTMfnHE7kfF2AbL/cH3NiWeJp/QHeXJqoWeRNJNb9+xdZUhbaXpdQpxBB8ZPOajjiSc4o/qUKwjP4/SEA4NLjlP4hw+kesDQzY/SHc0nPn0fikA/fPwzbQdLwqFGbJG2X7VHamCMUEdwgwW4xkdIQKQS1HU+vRhRwLSqPVxJZoDJZssCmhKK10+bER9HMmfRUpgvuDmNbr8Edd+12f1a/PsRygl4L0EQpQuxx+ZJxSqee8k= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sY8gzTrWYJa836yR1VsFxEIYWe8H0Gb8jr8dtlFEh2GwZr7cwO2ZTOgJpL7x5STaD4mSY+ZBuYMY0CB0xhu5FzdPrTrDvx60Qv0tsOX5ur0ZNKgcwdVN4t95cPRoABTxAjazvduJjHufC6obSQxJSwWFZ/481nIFUNxtJDFy1+AOAyALj80OInBYmqkDhTFnO97DdhnaT9rowUoMBYvQ82fy+wlzgTq2df2i3MloTygdQXRn8R2CWraKGPIfDa+X2ZtoYVVWgOKyeoeVvv//YaTHxdzQhWX/34xHeM1//M7Armq9CgXOlmmmyslYJoC42XN9vlAYmMXluYsbu1CNB95KiIxuaP15pzXrsWSwt2omJs+fFPULHpAktumLW4RgrImHrX1i2cX8j0ij7UqiHcpu99PUEHS/tjI4nxkEAmNzLF9+Z7/RwgyCXD19e/FZu519lq/JP4o8Pg/AxsTke8NxuUFzQ6gXh5dBE5QUkRTw0tWM6LcOl74GHlz+aBPPiy7Ybxv71YKKkqtBSZAUdjKwzPquKlD+oDfS53wlzFok3nT7ShZicJFPJoNKGnhoRsRWjn1dMAv0TtWfk8X2xA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HmCe84ZISgk5KJHyfm070Kqkm1Ry9xTc+/cRlepB80kncRL0s6VReOALrBqc5XESi3O2nNp7fa885mnD64uL4DGm3tuBxpeBeH76JQIebqcgTTbgnfHlcegC0rMjnHnzGAHWoggkjQckR9lJ4pPofT770Ns/zk6Qiqiijty5eGZpXkTyc3H0Oj5MUUAGaRuacwUKDt1bwJF8yvYHU2OZ9nyXyFjebTTow4ds8fIG3tEAqIyklFGYeWqZFD9vOje1m/BGeaX8wRaafP5eQsG4402p+i//bxiitacVzCBG5TybeR8Wh/1dMbI7Aedy7GoG5q0/Fv3oCObsF7e8p7lDNi0LXA5U1IaX4G4DPKsp1h+LEcQHKULX7W7XEdrbcV074PLnm5QqAG5cIY/EW6S9FhLFawNwBZrI3ugX7UID2k3a1IPgWywpVcIdDGokXqzDjU49sfN6MyX9PFwb4yM8tCSL0DEYzxlpzZPvI7QBGCNJAhRPlqgVlhuZXG8ReHbbfsBjORCVJDmtdx0LsFNYg6ogBS27Bz2aYuBE3iFSdO9w4UQUhim0lWwR/Lqb3eyT3BcEfAWDJPaA15pXP1CNhOth7jODPw5eypFVxMTwoKxKMkJ9ZcvC7dNCNZO7nl59mbwkWWJYLXee15nVCjP9sU5bGTLsFUjWHzkiVdjdH5fsnkj3ZQyI78CenYUsyCbKFTGQ4D9hAj7wIozeKcKuHxeuWZRrhMdb5KjXDN5uEMkFltVGMaAt4cdnvtTxjnaR0iAqPg1mcLF9Nd6Lv/40gJf7DYJMo91UTC2UHm/lYOLVRpOP3epVIyMUJLQoHoh7kV1CR4Slrp2yhrECpR1LRBCmCaJmmZTvV6BdaLfrcRG5XNXPtGjM3+2NCzW4CHmgaXnwxu4CIEbjYgueRnO0ZldE00K+2hC8VSyWaJGEkA7JVEBFtu7/HWndLUFR9P3egTbhEFHpuFF1VG1KYeam4g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd96ace0-ec77-4720-7e62-08d9bfc77803 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:36:08.4402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 11/11] avcodec/utils: Unavpriv avpriv_toupper4() 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: i2Njp+k2ziOP This function is quite small (96B with GCC 11.2 on x64 Ubuntu 21.10 at -O3), making it more economical to duplicate it into libavformat instead of exporting it as avpriv: Doing so saves 2x24B in .dynsim, 2x16B in .dynstr, 2x2B .gnu.version, 24B in .rela.plt, 16B in .plt, 16B in .plt.sec (if enabled), 4B .gnu.hash; besides the actual duplicated code this also adds 2x8B .eh_frame_hdr and 24B .eh_frame. In other words: Duplicating is neutral size-wise (it is also presumed neutral for other systems). Given that it avoids the runtime overhead of dynamic symbols, it is advantageouos to duplicate the function. Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 4 +++- libavcodec/internal.h | 2 +- libavcodec/mpeg12dec.c | 2 +- libavcodec/mpegvideo.c | 2 +- libavcodec/to_upper4.c | 23 +++++++++++++++++++++++ libavcodec/to_upper4.h | 37 +++++++++++++++++++++++++++++++++++++ libavcodec/utils.c | 8 -------- libavformat/Makefile | 2 +- libavformat/movenc.c | 2 +- libavformat/mux.c | 2 +- libavformat/to_upper4.c | 23 +++++++++++++++++++++++ libavformat/utils.c | 2 +- 12 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 libavcodec/to_upper4.c create mode 100644 libavcodec/to_upper4.h create mode 100644 libavformat/to_upper4.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 0b4aaf544e..292a105266 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -126,7 +126,8 @@ OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \ mpegvideo_motion.o mpegutils.o \ - mpegvideodata.o mpegpicture.o + mpegvideodata.o mpegpicture.o \ + to_upper4.o OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \ motion_est.o ratecontrol.o \ mpegvideoencdsp.o @@ -993,6 +994,7 @@ OBJS-$(CONFIG_FITS_DEMUXER) += fits.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o # libavformat dependencies for static builds +STLIBOBJS-$(CONFIG_AVFORMAT) += to_upper4.o STLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o STLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o diff --git a/libavcodec/internal.h b/libavcodec/internal.h index d3ee0214c5..72ca1553f6 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -225,7 +225,7 @@ extern const uint8_t ff_log2_run[41]; */ int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b); -unsigned int avpriv_toupper4(unsigned int x); +unsigned int ff_toupper4(unsigned int x); void ff_color_frame(AVFrame *frame, const int color[4]); diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 09b2902bca..172ea92b16 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2831,7 +2831,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, } #endif - s2->codec_tag = avpriv_toupper4(avctx->codec_tag); + s2->codec_tag = ff_toupper4(avctx->codec_tag); if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2") || s2->codec_tag == AV_RL32("BW10") )) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index ba5b51955e..90d0a9fd50 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -707,7 +707,7 @@ void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) s->workaround_bugs = avctx->workaround_bugs; /* convert fourcc to upper case */ - s->codec_tag = avpriv_toupper4(avctx->codec_tag); + s->codec_tag = ff_toupper4(avctx->codec_tag); } /** diff --git a/libavcodec/to_upper4.c b/libavcodec/to_upper4.c new file mode 100644 index 0000000000..29f65bf5c3 --- /dev/null +++ b/libavcodec/to_upper4.c @@ -0,0 +1,23 @@ +/* + * Converting FOURCCs to uppercase + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * 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 + */ + +#include "to_upper4.h" diff --git a/libavcodec/to_upper4.h b/libavcodec/to_upper4.h new file mode 100644 index 0000000000..d9648b5ef6 --- /dev/null +++ b/libavcodec/to_upper4.h @@ -0,0 +1,37 @@ +/* + * Converting FOURCCs to uppercase + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * 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 AVCODEC_TO_UPPER4_H +#define AVCODEC_TO_UPPER4_H + +#include "libavutil/avstring.h" +#include "internal.h" + +unsigned int ff_toupper4(unsigned int x) +{ + return av_toupper(x & 0xFF) | + (av_toupper((x >> 8) & 0xFF) << 8) | + (av_toupper((x >> 16) & 0xFF) << 16) | +((unsigned)av_toupper((x >> 24) & 0xFF) << 24); +} + +#endif diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4d236ff1cd..b19befef21 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -863,14 +863,6 @@ const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index) return &codec->hw_configs[index]->public; } -unsigned int avpriv_toupper4(unsigned int x) -{ - return av_toupper(x & 0xFF) + - (av_toupper((x >> 8) & 0xFF) << 8) + - (av_toupper((x >> 16) & 0xFF) << 16) + -((unsigned)av_toupper((x >> 24) & 0xFF) << 24); -} - int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src) { int ret; diff --git a/libavformat/Makefile b/libavformat/Makefile index 6e93d082d9..c5c9e78fa8 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -677,7 +677,7 @@ OBJS-$(CONFIG_LIBSSH_PROTOCOL) += libssh.o OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o # Objects duplicated from other libraries for shared builds -SHLIBOBJS += log2_tab.o +SHLIBOBJS += log2_tab.o to_upper4.o SHLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o SHLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 7216331fa1..fc309fb416 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1716,7 +1716,7 @@ static unsigned int validate_codec_tag(const AVCodecTag *const *tags, for (i = 0; tags && tags[i]; i++) { const AVCodecTag *codec_tags = tags[i]; while (codec_tags->id != AV_CODEC_ID_NONE) { - if (avpriv_toupper4(codec_tags->tag) == avpriv_toupper4(tag) && + if (ff_toupper4(codec_tags->tag) == ff_toupper4(tag) && codec_tags->id == codec_id) return codec_tags->tag; codec_tags++; diff --git a/libavformat/mux.c b/libavformat/mux.c index d93dc73f8e..b9c4abb9cf 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -204,7 +204,7 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st) for (int n = 0; s->oformat->codec_tag[n]; n++) { avctag = s->oformat->codec_tag[n]; while (avctag->id != AV_CODEC_ID_NONE) { - if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codecpar->codec_tag)) { + if (ff_toupper4(avctag->tag) == ff_toupper4(st->codecpar->codec_tag)) { id = avctag->id; if (id == st->codecpar->codec_id) return 1; diff --git a/libavformat/to_upper4.c b/libavformat/to_upper4.c new file mode 100644 index 0000000000..e84c803675 --- /dev/null +++ b/libavformat/to_upper4.c @@ -0,0 +1,23 @@ +/* + * Converting FOURCCs to uppercase + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * 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 + */ + +#include "libavcodec/to_upper4.h" diff --git a/libavformat/utils.c b/libavformat/utils.c index b5a4a09ae8..bd076d532b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -361,7 +361,7 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag) if (tag == tags[i].tag) return tags[i].id; for (int i = 0; tags[i].id != AV_CODEC_ID_NONE; i++) - if (avpriv_toupper4(tag) == avpriv_toupper4(tags[i].tag)) + if (ff_toupper4(tag) == ff_toupper4(tags[i].tag)) return tags[i].id; return AV_CODEC_ID_NONE; }