From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B2FA445DB1 for ; Wed, 12 Jul 2023 12:42:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C455768C545; Wed, 12 Jul 2023 15:42:27 +0300 (EEST) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1452C68C39B for ; Wed, 12 Jul 2023 15:42:22 +0300 (EEST) Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6b74faaac3bso5508132a34.1 for ; Wed, 12 Jul 2023 05:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689165740; x=1691757740; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=EKyJh93WYvimIhdmrMWPCzRk0fnqv6fDlBfv7rkFxBw=; b=RGjSNXp+XK3XdLhP57cthVHuaHGrvRWtphYsHu0uj3NWckSUF9m0docBPliyPxQuXE ag7tHVBpfyyESH0SmyfRwsuaeAp4Us8H8KegV60InkpUinvtHrCQcn64mm5HeJ9c0VrO 1rkaNcvNhjBW3qHjxHdNTU35JQfHWzV3/ntDtjeOXjkqSZy+gaPyx67nAxlg2Vyn/X3N F76ROFpRdHFftM85gy44+1AOAoX7/dVWv4pBEc/Ck8IBfTvU/Sf6GglzlE/jEuBWPGYp IbTHh80SKnZ9n7+r4UYv6Av0QAXWYyo/RWjr//7rr5eCNIC8XRXgpat9U90nK4O+C3Bb MutA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689165740; x=1691757740; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EKyJh93WYvimIhdmrMWPCzRk0fnqv6fDlBfv7rkFxBw=; b=YLvxyJRpfh1LVkBx3oHmUCJ6oHJ8Ke+AUmNcxx3uoiMdfCz4qYTRpkYoyxSabf6sfF JaBQ4J61pHEErh0rEVJbVFhwufS/zBU+WkLTjjjx1s/fvcNpK6HL8tzPTCci8VR95Nqv 35v4OGYW+Fp9v2C/J1LbmLYgwY7j6+axSa+cY0Ful0z2vqVDNKbtnYnY6jqNOJyFiGFx YQLTlZOgNJc5NjY7Y8PNdjMgO9gtbPgCj0pA7Hpz3BiMtSUbn3xgmLvr9/0oznBIEBnh cz+CQE/TDfG7w/Wnt4Zk8dJ1YZzxHBgMNDdiMCN6WWSS5zDVo1CsMP8ILfCG4G0V54xk amfA== X-Gm-Message-State: ABy/qLbU2fpqPEBxFsE+4Y0sNBuclUwVTdKca15VZfHa7+HYgTE0L3fe URmosdMWRViR/ZT+e3x7Uev1F/ZfI7g= X-Google-Smtp-Source: APBJJlFBokPkRm6tnwGrE5GYK5utYVXwEM9GC+LOYGOHGbH0tb7/tlRz9MHubkQ20tObKcB7nXfo+w== X-Received: by 2002:a9d:61d0:0:b0:6b9:48fb:1b5a with SMTP id h16-20020a9d61d0000000b006b948fb1b5amr9028279otk.8.1689165739931; Wed, 12 Jul 2023 05:42:19 -0700 (PDT) Received: from [192.168.0.16] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id l6-20020a9d6a86000000b006b9742a7575sm1828928otq.63.2023.07.12.05.42.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jul 2023 05:42:19 -0700 (PDT) Message-ID: <3f5fae87-e165-b8c6-4270-bea88be187c4@gmail.com> Date: Wed, 12 Jul 2023 09:42:18 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20230709125746.8054-1-anton@khirnov.net> From: James Almer In-Reply-To: <20230709125746.8054-1-anton@khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH] lavc: deprecate AV_CODEC_FLAG_DROPCHANGED 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 7/9/2023 9:57 AM, Anton Khirnov wrote: > This decoding flag makes decoders drop all frames after a parameter > change, but what exactly constitutes a parameter change is not well > defined and will typically depend on the exact use case. > This functionality then does not belong in libavcodec, but rather in > user code > --- > doc/APIchanges | 3 +++ > libavcodec/avcodec.c | 2 ++ > libavcodec/avcodec.h | 7 ++++--- > libavcodec/decode.c | 11 +++++++++-- > libavcodec/internal.h | 2 ++ > libavcodec/options_table.h | 2 ++ > libavcodec/version_major.h | 1 + > 7 files changed, 23 insertions(+), 5 deletions(-) > > diff --git a/doc/APIchanges b/doc/APIchanges > index 0cda51fdee..6217502492 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 > > API changes, most recent first: > > +2023-07-xx - xxxxxxxxxx - lavc 60 - avcodec.h > + Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement. > + > 2023-07-xx - xxxxxxxxxx - lavu 58.15.100 - video_hint.h > Add AVVideoHint API. > > diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c > index 8ccc610227..340abe830e 100644 > --- a/libavcodec/avcodec.c > +++ b/libavcodec/avcodec.c > @@ -456,7 +456,9 @@ av_cold int avcodec_close(AVCodecContext *avctx) > > av_bsf_free(&avci->bsf); > > +#if FF_API_DROPCHANGED > av_channel_layout_uninit(&avci->initial_ch_layout); > +#endif > > #if CONFIG_LCMS2 > ff_icc_context_uninit(&avci->icc); > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index d17bdc360d..fe41ecc3c9 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -226,11 +226,15 @@ typedef struct RcOverride{ > * Use qpel MC. > */ > #define AV_CODEC_FLAG_QPEL (1 << 4) > +#if FF_API_DROPCHANGED > /** > * Don't output frames whose parameters differ from first > * decoded frame in stream. > + * > + * @deprecated callers should implement this functionality in their own code > */ > #define AV_CODEC_FLAG_DROPCHANGED (1 << 5) > +#endif > /** > * Request the encoder to output reconstructed frames, i.e.\ frames that would > * be produced by decoding the encoded bistream. These frames may be retrieved > @@ -2713,9 +2717,6 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); > * no more output frames > * @retval AVERROR(EINVAL) codec not opened, or it is an encoder without the > * @ref AV_CODEC_FLAG_RECON_FRAME flag enabled > - * @retval AVERROR_INPUT_CHANGED current decoded frame has changed parameters with > - * respect to first decoded frame. Applicable when flag > - * AV_CODEC_FLAG_DROPCHANGED is set. > * @retval "other negative error code" legitimate decoding errors > */ > int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > index 269633ce10..40eb7679ca 100644 > --- a/libavcodec/decode.c > +++ b/libavcodec/decode.c > @@ -740,7 +740,7 @@ fail: > int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) > { > AVCodecInternal *avci = avctx->internal; > - int ret, changed; > + int ret; > > if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) > return AVERROR(EINVAL); > @@ -770,6 +770,7 @@ FF_DISABLE_DEPRECATION_WARNINGS > FF_ENABLE_DEPRECATION_WARNINGS > #endif > > +#if FF_API_DROPCHANGED > if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) { > > if (avctx->frame_num == 1) { > @@ -790,7 +791,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > } > > if (avctx->frame_num > 1) { > - changed = avci->initial_format != frame->format; > + int changed = avci->initial_format != frame->format; > > switch(avctx->codec_type) { > case AVMEDIA_TYPE_VIDEO: > @@ -815,6 +816,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > } > } > } > +#endif > return 0; > fail: > av_frame_unref(frame); > @@ -1739,6 +1741,11 @@ int ff_decode_preinit(AVCodecContext *avctx) > if (ret < 0) > return ret; > > +#if FF_API_DROPCHANGED > + if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) > + av_log(avctx, AV_LOG_WARNING, "The dropchanged flag is deprecated.\n"); > +#endif > + > return 0; > } > > diff --git a/libavcodec/internal.h b/libavcodec/internal.h > index 868dd46b48..4dce9f6fbb 100644 > --- a/libavcodec/internal.h > +++ b/libavcodec/internal.h > @@ -135,12 +135,14 @@ typedef struct AVCodecInternal { > AVFrame *buffer_frame; > int draining_done; > > +#if FF_API_DROPCHANGED > /* used when avctx flag AV_CODEC_FLAG_DROPCHANGED is set */ > int changed_frames_dropped; > int initial_format; > int initial_width, initial_height; > int initial_sample_rate; > AVChannelLayout initial_ch_layout; > +#endif > > #if CONFIG_LCMS2 > FFIccContext icc; /* used to read and write embedded ICC profiles */ > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > index f1a9729c0d..d1244bfc1a 100644 > --- a/libavcodec/options_table.h > +++ b/libavcodec/options_table.h > @@ -72,7 +72,9 @@ static const AVOption avcodec_options[] = { > {"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"}, > {"cgop", "closed GOP", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"}, > {"output_corrupt", "Output even potentially corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_OUTPUT_CORRUPT }, INT_MIN, INT_MAX, V|D, "flags"}, > +#if FF_API_DROPCHANGED > {"drop_changed", "Drop frames whose parameters differ from first decoded frame", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_DROPCHANGED }, INT_MIN, INT_MAX, A|V|D, "flags"}, Missing the deprecated AVOption flag. > +#endif > {"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D|S, "flags2"}, > {"fast", "allow non-spec-compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"}, > {"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"}, > diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h > index 2f5138d079..95c5aec0c5 100644 > --- a/libavcodec/version_major.h > +++ b/libavcodec/version_major.h > @@ -48,6 +48,7 @@ > #define FF_API_SLICE_OFFSET (LIBAVCODEC_VERSION_MAJOR < 61) > #define FF_API_SUBFRAMES (LIBAVCODEC_VERSION_MAJOR < 61) > #define FF_API_TICKS_PER_FRAME (LIBAVCODEC_VERSION_MAJOR < 61) > +#define FF_API_DROPCHANGED (LIBAVCODEC_VERSION_MAJOR < 61) > > // reminder to remove CrystalHD decoders on next major bump > #define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61) LGTM, and good idea. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".