From patchwork Tue Sep 12 09:40:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 5103 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp4070073jaa; Tue, 12 Sep 2017 02:41:10 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5ZehGJSCoqcRs2a+zH5hyYKf1XMrvBEYVlvQLosvrQwBP29QNTWQNGRHxsQHqHvh3+sVrh X-Received: by 10.223.177.211 with SMTP id r19mr12110015wra.2.1505209270356; Tue, 12 Sep 2017 02:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505209270; cv=none; d=google.com; s=arc-20160816; b=Ajv9ApKhmcP09CIPk/uib/CTZGKPtNqw944/xBrjmz77Dvv4L8zpx1l/G4zaMXX1A8 3lYXFQO0dSQrymLmtibP5D1//ulfCNjWUtRgg7JI4RKrW6nyleSviRq5rWNOaZE1EqL/ UPnx7lMOICPLCau4r40aVBHwmfKbC0q+jjb1nYuhGCNZ6+F99t6jZg1K2KunA39OGFeP IFmzrhgApKi7RFqkf+R9OpDk35cslvji6ZP6aVJPBcbYbedSCNmUZL5zcibjBVBW5zVH 2l6C/dhqn+ZVamtWGeZEc2+d3QDcJ1DkH8Wg/6i30orzqG3P4ATx/ciUaDMoFiJP2kQd 05hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=LC9sFvBohFTSlYoEwBqPb5rqdefzWz8Se158MMalbdY=; b=1HVq+ruGBi/9NhRJxPLiLoLhWbNlfwuceoioKYiGfbtNvcdxR0Vcj9cWUa1bRahzTJ LOG2HEcdiV2hVniWygEuRVedVq/ACw5L2hu6vq6Q4yGkPoJZZga6xAkpkmaMneZhNVkL 01uSBse8yqw6NZNvRkM1eVUPW5sLNVve1Je4EDQbXtlxB/+GLFuNVZjGHJBJkAFi1nB0 fePwp7gnJrgwzL/6lVQsEiEql9+6ZkEQVzOyjY1hdyyO5Y00IctndqrJURTqbt5OWpyG QRtN1zTWFlPiDTYJKceQZxM3wqF5NsGJxddOaXEGbfkQUtWcPQGmBZv56kaq7xLAwcbF 8PuA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j34si8745799wre.302.2017.09.12.02.41.09; Tue, 12 Sep 2017 02:41:10 -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 1C771689D2F; Tue, 12 Sep 2017 12:41:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A569C688395 for ; Tue, 12 Sep 2017 12:40:51 +0300 (EEST) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v8C9evvZ008591 for ; Tue, 12 Sep 2017 11:40:57 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id F2E39E00CB; Tue, 12 Sep 2017 11:40:56 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Sep 2017 11:40:55 +0200 Message-Id: <20170912094055.16345-1-george@nsup.org> X-Mailer: git-send-email 2.14.1 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Tue, 12 Sep 2017 11:40:57 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH] lavfi/buffersink: deprecate non-AVOption init. 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Nicolas George --- doc/APIchanges | 3 +++ libavfilter/buffersink.c | 10 ++++++++++ libavfilter/buffersink.h | 12 ++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index cc67cbf6f8..be136ca11e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2017-09-12 - xxxxxxx - lavfi 6.XXX.100 - buffersink.h + Deprecate non-AVOption init of buffersink. + 2017-09-08 - xxxxxxx - lavfi 6.103.100 - buffersrc.h Add av_buffersrc_close(). diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 0f87b5439a..0d5380c681 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -127,6 +127,8 @@ int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx, return get_frame_internal(ctx, frame, 0, nb_samples); } +FF_DISABLE_DEPRECATION_WARNINGS + AVBufferSinkParams *av_buffersink_params_alloc(void) { static const int pixel_fmts[] = { AV_PIX_FMT_NONE }; @@ -147,6 +149,8 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void) return params; } +FF_ENABLE_DEPRECATION_WARNINGS + static av_cold int common_init(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; @@ -201,6 +205,7 @@ MAKE_AVFILTERLINK_ACCESSOR(int , sample_rate ) MAKE_AVFILTERLINK_ACCESSOR(AVBufferRef * , hw_frames_ctx ) +FF_DISABLE_DEPRECATION_WARNINGS static av_cold int vsink_init(AVFilterContext *ctx, void *opaque) { BufferSinkContext *buf = ctx->priv; @@ -208,12 +213,14 @@ static av_cold int vsink_init(AVFilterContext *ctx, void *opaque) int ret; if (params) { + av_log(ctx, AV_LOG_WARNING, "non-AVOption init of buffersink is deprecated\n"); if ((ret = av_opt_set_int_list(buf, "pix_fmts", params->pixel_fmts, AV_PIX_FMT_NONE, 0)) < 0) return ret; } return common_init(ctx); } +FF_ENABLE_DEPRECATION_WARNINGS #define CHECK_LIST_SIZE(field) \ if (buf->field ## _size % sizeof(*buf->field)) { \ @@ -244,6 +251,7 @@ static int vsink_query_formats(AVFilterContext *ctx) return 0; } +FF_DISABLE_DEPRECATION_WARNINGS static av_cold int asink_init(AVFilterContext *ctx, void *opaque) { BufferSinkContext *buf = ctx->priv; @@ -251,6 +259,7 @@ static av_cold int asink_init(AVFilterContext *ctx, void *opaque) int ret; if (params) { + av_log(ctx, AV_LOG_WARNING, "non-AVOption init of abuffersink is deprecated\n"); if ((ret = av_opt_set_int_list(buf, "sample_fmts", params->sample_fmts, AV_SAMPLE_FMT_NONE, 0)) < 0 || (ret = av_opt_set_int_list(buf, "sample_rates", params->sample_rates, -1, 0)) < 0 || (ret = av_opt_set_int_list(buf, "channel_layouts", params->channel_layouts, -1, 0)) < 0 || @@ -260,6 +269,7 @@ static av_cold int asink_init(AVFilterContext *ctx, void *opaque) } return common_init(ctx); } +FF_ENABLE_DEPRECATION_WARNINGS static int asink_query_formats(AVFilterContext *ctx) { diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h index 21d6bb505b..d607bca631 100644 --- a/libavfilter/buffersink.h +++ b/libavfilter/buffersink.h @@ -61,8 +61,10 @@ int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flag /** * Struct to use for initializing a buffersink context. + * + * @deprecated Use av_opt_set() on the newly created filter. */ -typedef struct AVBufferSinkParams { +attribute_deprecated typedef struct AVBufferSinkParams { const enum AVPixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by AV_PIX_FMT_NONE } AVBufferSinkParams; @@ -71,12 +73,14 @@ typedef struct AVBufferSinkParams { * * Must be freed with av_free(). */ -AVBufferSinkParams *av_buffersink_params_alloc(void); +attribute_deprecated AVBufferSinkParams *av_buffersink_params_alloc(void); /** * Struct to use for initializing an abuffersink context. + * + * @deprecated Use av_opt_set() on the newly created filter. */ -typedef struct AVABufferSinkParams { +attribute_deprecated typedef struct AVABufferSinkParams { const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1 const int *channel_counts; ///< list of allowed channel counts, terminated by -1 @@ -89,7 +93,7 @@ typedef struct AVABufferSinkParams { * * Must be freed with av_free(). */ -AVABufferSinkParams *av_abuffersink_params_alloc(void); +attribute_deprecated AVABufferSinkParams *av_abuffersink_params_alloc(void); /** * Set the frame size for an audio buffer sink.