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 ESMTPS id D15D54C0E8 for ; Wed, 5 Feb 2025 17:25:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6959B68B5DB; Wed, 5 Feb 2025 19:25:23 +0200 (EET) Received: from out203-205-221-190.mail.qq.com (out203-205-221-190.mail.qq.com [203.205.221.190]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0B4FF680CF5 for ; Wed, 5 Feb 2025 19:25:15 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1738776313; bh=YxQ3cHik765fHR7CDcp8W58dlvzE9pRN2J7NIe8rCI8=; h=From:Subject:Date:References:To:In-Reply-To; b=E2gvwWWZTQdfO7bjKHcEaq70DcAQQe1/16xh1HoGO9A9YhfrzwmihSl76BOSbY6D4 djPUXDvxLcrqkb5NV5Tn95QoQyjO1203diMLVOMWydcdGtX76KZCSEb44V5EuNK9b/ XlBoaUzn0FtztAfemUazNO5fnC0svOoKE5HrLuRI= Received: from smtpclient.apple ([240e:3b7:3277:36f0:544a:7de:c82a:2aa2]) by newxmesmtplogicsvrszgpua8-1.qq.com (NewEsmtp) with SMTP id 64C04EB1; Thu, 06 Feb 2025 01:25:12 +0800 X-QQ-mid: xmsmtpt1738776312te4srxqxx Message-ID: X-QQ-XMAILINFO: OakVxA/3u/8Rx8aU+2w2LMHwBeK1hF2iqm4dOYcIqaCNHxYksP31s+ItUINdf6 iOOtrGOkGmLnIzkocm7gi4f7sGqQMM3qC7IBHTaonif62aBQfVMbmg6ZKE87yTKa1prZEB3jYrZA rM/S54qL/DLtWKulV2L3pOUqAS1lcczwdWPdbjS8CtjVxrdQNnLR2e8t0Ki5t60L7BVJ4d+xgZHE NThzSxWXAyWhgkcEMzdQsxbCbgorgTYPDucAhqsy1teblgYTuPkInbty1icbsyntRtx4Gy33WJk4 HsGXQ0I7IdlTsd+RWuhPf0USTOvucZzq/7q2mlAp1/+EqMMuNLCUe26mcbSSZD2JYLo8Ad7LkAcz cbwMzTSSI+n8X53b9yw0iX4MDlszGMJGPsRkykMmjxmQhgmvXViWvzVSWVRhcEehYEYeolQfou2/ PAJX6olofG8P+PZUNvqBoIM1KPLfTLOBljBBSM7v9SP5RrQrdD8F9HjIfPJAoNlbj2R8fH6+pAjm VoPUKnWppiklkAUdKvAJmtrOvg7SwIh7cqw4EGCtEefzjKug6VzMmbsEjuzJN/03ok8sN5Tl1RS2 i3OJXEdgzdqUa3IaeJX7NyM6w4AX0LvBc45grdjXUkTgScXSk1WUYrKcpxCsi69oi+UFM9E/62JK TPPUpVFftvHGSLTcutzcLgbT+DS0J2oP6jGHtqwgoaIY1oXcAgfgpaKY95sMojgwaVBOn9a3pE4W w+Qc6/mIULUlB7TyEBoygd6JELO6Iqrt/HvNlfBGV4rCtKjHAsQnDtVZT1wViGllIvPuwYy7w9/n U98lasz8Ujd56GbpDK0T+APPT0eJvFij15YDIFFoi/lTvdeSdoEZb+ofFAfVd89AVPFjiouUxMGV CPI9P0RTSwGxdpHPgq+hUHFEFftG92+BRE8D4Cp+4e4U5WDcJ3HHqEYZLRsuVLCOnsEAjy6u3E55 SMAGLggQ3ngyIgKo2e/D8YZGYlA+qYAEtey0rZPCid7vecUH8AegXo+rLiEmEVjVWID/yksP8H1P hfAaztlUT++u7LDKhnuWvyVkspf+fgmnnrXaeaRxj0SfWt2ulXGQu12Wa7Hoc= X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Zhao Zhili Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3818.100.11.1.3\)) Date: Thu, 6 Feb 2025 01:25:01 +0800 References: To: FFmpeg development discussions and patches In-Reply-To: X-OQ-MSGID: <6399DE79-5887-4319-BF79-05ECBEFD7CE2@foxmail.com> X-Mailer: Apple Mail (2.3818.100.11.1.3) X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] avcodec/libx264: Fix deprecation warnings on pix_fmts 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: I prefer another version which doesn't drop const modifier. https://ffmpeg.org/pipermail/ffmpeg-devel/2025-February/339331.html > On Feb 6, 2025, at 00:07, Zhao Zhili wrote: > > From: Zhao Zhili > > --- > libavcodec/allcodecs.c | 6 ++--- > libavcodec/libx264.c | 53 +++++++++++++++++++++++++++++++++++++----- > 2 files changed, 50 insertions(+), 9 deletions(-) > > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index 4e1b1c9b45..d2ec4c3045 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -811,9 +811,9 @@ extern const FFCodec ff_libvvenc_encoder; > /* preferred over libwebp */ > extern const FFCodec ff_libwebp_anim_encoder; > extern const FFCodec ff_libwebp_encoder; > -extern const FFCodec ff_libx262_encoder; > -extern const FFCodec ff_libx264_encoder; > -extern const FFCodec ff_libx264rgb_encoder; > +extern FFCodec ff_libx262_encoder; > +extern FFCodec ff_libx264_encoder; > +extern FFCodec ff_libx264rgb_encoder; > extern FFCodec ff_libx265_encoder; > extern const FFCodec ff_libxeve_encoder; > extern const FFCodec ff_libxevd_decoder; > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 409f45fc7d..c4bc7c48f5 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -1607,6 +1607,12 @@ static const FFCodecDefault x264_defaults[] = { > { NULL }, > }; > > +static int X264_get_supported_config(const AVCodecContext *avctx, > + const AVCodec *codec, > + enum AVCodecConfig config, > + unsigned flags, const void **out, > + int *out_num); > + > #if CONFIG_LIBX264_ENCODER > static const AVClass x264_class = { > .class_name = "libx264", > @@ -1615,7 +1621,7 @@ static const AVClass x264_class = { > .version = LIBAVUTIL_VERSION_INT, > }; > > -const FFCodec ff_libx264_encoder = { > +FFCodec ff_libx264_encoder = { > .p.name = "libx264", > CODEC_LONG_NAME("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), > .p.type = AVMEDIA_TYPE_VIDEO, > @@ -1633,13 +1639,13 @@ const FFCodec ff_libx264_encoder = { > .flush = X264_flush, > .close = X264_close, > .defaults = x264_defaults, > - .p.pix_fmts = pix_fmts_all, > .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG, > .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS > #if X264_BUILD < 158 > | FF_CODEC_CAP_NOT_INIT_THREADSAFE > #endif > , > + .get_supported_config = X264_get_supported_config, > }; > #endif > > @@ -1651,7 +1657,7 @@ static const AVClass rgbclass = { > .version = LIBAVUTIL_VERSION_INT, > }; > > -const FFCodec ff_libx264rgb_encoder = { > +FFCodec ff_libx264rgb_encoder = { > .p.name = "libx264rgb", > CODEC_LONG_NAME("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB"), > .p.type = AVMEDIA_TYPE_VIDEO, > @@ -1659,7 +1665,6 @@ const FFCodec ff_libx264rgb_encoder = { > .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | > AV_CODEC_CAP_OTHER_THREADS | > AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, > - .p.pix_fmts = pix_fmts_8bit_rgb, > .p.priv_class = &rgbclass, > .p.wrapper_name = "libx264", > .priv_data_size = sizeof(X264Context), > @@ -1672,6 +1677,7 @@ const FFCodec ff_libx264rgb_encoder = { > | FF_CODEC_CAP_NOT_INIT_THREADSAFE > #endif > , > + .get_supported_config = X264_get_supported_config, > }; > #endif > > @@ -1683,7 +1689,7 @@ static const AVClass X262_class = { > .version = LIBAVUTIL_VERSION_INT, > }; > > -const FFCodec ff_libx262_encoder = { > +FFCodec ff_libx262_encoder = { > .p.name = "libx262", > CODEC_LONG_NAME("libx262 MPEG2VIDEO"), > .p.type = AVMEDIA_TYPE_VIDEO, > @@ -1691,7 +1697,6 @@ const FFCodec ff_libx262_encoder = { > .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | > AV_CODEC_CAP_OTHER_THREADS | > AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, > - .p.pix_fmts = pix_fmts_8bit, > .color_ranges = AVCOL_RANGE_MPEG, > .p.priv_class = &X262_class, > .p.wrapper_name = "libx264", > @@ -1702,5 +1707,41 @@ const FFCodec ff_libx262_encoder = { > .defaults = x264_defaults, > .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | > FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS, > + .get_supported_config = X264_get_supported_config, > }; > #endif > + > +static int X264_get_supported_config(const AVCodecContext *avctx, > + const AVCodec *codec, > + enum AVCodecConfig config, > + unsigned flags, const void **out, > + int *out_num) > +{ > + if (config == AV_CODEC_CONFIG_PIX_FORMAT) { > +#if CONFIG_LIBX264_ENCODER > + if (codec == &ff_libx264_encoder.p) { > + *out = pix_fmts_all; > + *out_num = FF_ARRAY_ELEMS(pix_fmts_all) - 1; > + return 0; > + } > +#endif > + > +#if CONFIG_LIBX264RGB_ENCODER > + if (codec == &ff_libx264rgb_encoder.p) { > + *out = pix_fmts_8bit_rgb; > + *out_num = FF_ARRAY_ELEMS(pix_fmts_8bit_rgb) - 1; > + return 0; > + } > +#endif > +#if CONFIG_LIBX262_ENCODER > + if (codec == &ff_libx262_encoder.p) { > + *out = pix_fmts_8bit; > + *out_num = FF_ARRAY_ELEMS(pix_fmts_8bit) - 1; > + } > +#endif > + return AVERROR(EINVAL); > + } > + > + return ff_default_get_supported_config(avctx, codec, config, flags, out, > + out_num); > +} > -- > 2.46.0 > > _______________________________________________ > 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". _______________________________________________ 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".