From patchwork Mon Dec 30 13:54:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 17067 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id CA598449AE8 for ; Mon, 30 Dec 2019 15:54:47 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B19D668AC27; Mon, 30 Dec 2019 15:54:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 03B5268ABA6 for ; Mon, 30 Dec 2019 15:54:38 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1577714072; bh=5Os0yAlkDz6+dNT05COhPzApNSQDy1OB36pmT3wtpXY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=xBzc9vg+udhc2Rer7+yfiPrK5XcF0LScVSwTY7jUT9s31P1lrw94MQqwvm6t7APPh OfCjV3ep2RXKe9cESMBq/4aiSn38ggXb4s77GOmSCk33oMiAdDL1WRovmGN1H47pzu WfmPd2tbEB9pRIwleTo4mXTTphGKsPc8bTg3f9N0= X-QQ-mid: esmtp3t1577714072tzf6ma04o Received: from ZHILIZHAO-MB1.tencent.com (unknown [14.17.22.54]) by esmtp4.qq.com (ESMTP) with id ; Mon, 30 Dec 2019 21:54:32 +0800 (CST) X-QQ-SSF: 01000000000000N0WG4000000000002 X-QQ-FEAT: dTkE+0DoOBZr5VlXOVyHnkiC3oZsGFSP98jS0/l01Jlsnl+lV7u1XNj+69gCW sfjhEP3PMuB5FKTCynWHLxuvuUH4HkQOxNFNoXkmSSjIyT5op2Aew5QbEkB2xLJ53yqHvcT i7P6NKBx2vHQ7Kfm4m3n3qilxFv9zMknZfMiuuvNxtTgWeheJmr8Z+6jviDP5TEVV+wIW10 t2q93Njv81zlMThQk1zc2eilhk7m94r0ezPIo/pOXJo/c2HpygvFn5rRBub5UYM9/N+0KhV oAqRrCeCG6vjvUy14ORgGFLb0= X-QQ-GoodBg: 0 From: quinkblack@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 30 Dec 2019 21:54:18 +0800 Message-Id: <20191230135419.56529-7-quinkblack@foxmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20191230135419.56529-1-quinkblack@foxmail.com> References: <20191230135419.56529-1-quinkblack@foxmail.com> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: esmtp:foxmail.com:bgforeign:bgforeign11 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH 7/8] avcodec/utils: remove access of AV_SAMPLE_FMT_NB 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 Cc: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Zhao Zhili --- libavcodec/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 8a49234bcd..c935e07538 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1510,7 +1510,7 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id) enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be) { - static const enum AVCodecID map[AV_SAMPLE_FMT_NB][2] = { + static const enum AVCodecID map[][2] = { [AV_SAMPLE_FMT_U8 ] = { AV_CODEC_ID_PCM_U8, AV_CODEC_ID_PCM_U8 }, [AV_SAMPLE_FMT_S16 ] = { AV_CODEC_ID_PCM_S16LE, AV_CODEC_ID_PCM_S16BE }, [AV_SAMPLE_FMT_S32 ] = { AV_CODEC_ID_PCM_S32LE, AV_CODEC_ID_PCM_S32BE }, @@ -1523,7 +1523,7 @@ enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be) [AV_SAMPLE_FMT_FLTP] = { AV_CODEC_ID_PCM_F32LE, AV_CODEC_ID_PCM_F32BE }, [AV_SAMPLE_FMT_DBLP] = { AV_CODEC_ID_PCM_F64LE, AV_CODEC_ID_PCM_F64BE }, }; - if (fmt < 0 || fmt >= AV_SAMPLE_FMT_NB) + if (fmt < 0 || fmt >= FF_ARRAY_ELEMS(map)) return AV_CODEC_ID_NONE; if (be < 0 || be > 1) be = AV_NE(1, 0);