From patchwork Fri Feb 26 13:18:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26010 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 AFCA044A6E6 for ; Fri, 26 Feb 2021 15:18:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 93FA368AA64; Fri, 26 Feb 2021 15:18:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8AB8A68AA53 for ; Fri, 26 Feb 2021 15:18:31 +0200 (EET) Received: by mail-ej1-f54.google.com with SMTP id w1so14777548ejf.11 for ; Fri, 26 Feb 2021 05:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=JI1EnQYiqAukO9y32saRvDkRsrrjRNJFnqf8stM84fM=; b=GLf4LP09Y/vDbjtNU5INvHAxJSGmMzrEhyDsNA3qHhUfgRGiiEOvYspavTYlKQHYRz pJCAqJHtao4sPLl9GMp11IC0LrTsRvVGCNv4Qh95JUZ95cbHftp05Qu1+gUhH1ja/ryt keAWJpg+sIYBoFEeEQAPqEEpEhh7qTA6+DpyrzJhsFG6MD4yl/TYE/bZQQNluNvkXHiz RqvgDTGQkz6r6qt1WPELodTRyL40LUzfVOJedRCKRuj8L7a5izANm9+6Xfb0WPjPS1kl y9mequyipwCo9Yb4tiPZS3AiaW6n/+yHQs2/bJlbp/vEw2S+j50ZVSUsWbDnFGfNgrxc bHZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=JI1EnQYiqAukO9y32saRvDkRsrrjRNJFnqf8stM84fM=; b=MMa8JctfsC+XZ+NAXxE/1Me+q3Z3Vg5F1FaNNTzUtDGMUHteTPIULfre5Esn2aEA3I oNfQGzcWHS6Y3928NoXVrB47aZybrADnW/Uyga0AhbNGA+yJFrqN2OZ3lo4EUwQQiC5b RbWnqJTIzj8bU386kY2iB1suITkgKJ6BK83R3izAlyP0X6wLVGCdX9qQb43OpnSM9UID LQzimliuZ/nuTMyzXJnlmQHgyr78MIY5sVzkXfbhItX1VZ9a5oyh/PzbeJKEkQTD+ABX lXhvrhoaRHe8dwY0/wVP+XmBylY1Zm/FHSifK07YuNQWPf3BuYzG2J2cJP3hxrIG70wL xzLA== X-Gm-Message-State: AOAM53051+N3KEweMCH99DFFWM0MEuH4u4ObY5bJ4UijoY49pSyS+6SB tLj8G97PzA4BvWAaFztFIkAZDLBcOIs= X-Google-Smtp-Source: ABdhPJwAurzlpAyEl7VuIZhZQsOca4BL3sXisQwI7lAUlGVl5hATbzpzZXx787MmD3z7pdzWLtHaqg== X-Received: by 2002:a17:906:1457:: with SMTP id q23mr3350190ejc.43.1614345510874; Fri, 26 Feb 2021 05:18:30 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id ca26sm5867480edb.4.2021.02.26.05.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 05:18:30 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 26 Feb 2021 14:18:03 +0100 Message-Id: <20210226131806.1990485-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210226131806.1990485-1-andreas.rheinhardt@gmail.com> References: <20210226131806.1990485-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avcodec: Add missing FF_API define for libavcodec pix fmt API 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" avcodec_find_best_pix_fmt2 has been deprecated and replaced by avcodec_find_best_pix_fmt_of_2 in 2a54ae9df8cbc1717b3929222ac75f384e2ff240. avcodec_find_best_pix_fmt_of_2 and avcodec_get_pix_fmt_loss meanwhile were deprecated in 617e866e25b72fa5d9f9d6bbcbd7e4bd69e63a54 when these functions were de facto moved to libavutil; this has been mentioned in APIchanges in f7a1c5e4d2294a8970ede7f6deb2fe0a64e202a5. Yet the attribute_deprecated was never set for the latter two functions and they were not wrapped in an FF_API define. This commit does this. Signed-off-by: Andreas Rheinhardt --- libavcodec/avcodec.h | 15 +++++++++------ libavcodec/imgconvert.c | 6 ++++-- libavcodec/version.h | 3 +++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3d77d2f6fd..3178c163b9 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3786,12 +3786,6 @@ void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int */ unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); -/** - * @deprecated see av_get_pix_fmt_loss() - */ -int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, - int has_alpha); - /** * Find the best pixel format to convert to given a certain source pixel * format. When converting from one pixel format to another, information loss @@ -3813,15 +3807,24 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); +#if FF_API_AVCODEC_PIX_FMT +/** + * @deprecated see av_get_pix_fmt_loss() + */ +attribute_deprecated +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, + int has_alpha); /** * @deprecated see av_find_best_pix_fmt_of_2() */ +attribute_deprecated enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); attribute_deprecated enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); +#endif enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 1fd636c83d..8de1563404 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -44,6 +44,7 @@ void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int } #endif +#if FF_API_AVCODEC_PIX_FMT int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, int has_alpha) @@ -60,9 +61,10 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) { - return avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, has_alpha, loss_ptr); + return av_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, has_alpha, loss_ptr); } +#endif enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr){ @@ -73,7 +75,7 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p for (i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) { loss = loss_ptr ? *loss_ptr : 0; - best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, &loss); + best = av_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, &loss); } if (loss_ptr) diff --git a/libavcodec/version.h b/libavcodec/version.h index e5a5ec8abc..516411b4b2 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -144,6 +144,9 @@ #ifndef FF_API_OLD_ENCDEC #define FF_API_OLD_ENCDEC (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_AVCODEC_PIX_FMT +#define FF_API_AVCODEC_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #ifndef FF_API_THREAD_SAFE_CALLBACKS #define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60) #endif