From: Zhao Zhili <quinkblack-at-foxmail.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: Zhao Zhili <zhilizhao@tencent.com> Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/codec_internal: Add pix_fmts and supported_framerates fields to FFCodec Date: Thu, 6 Feb 2025 01:22:40 +0800 Message-ID: <tencent_B0F3736015CC29198EB98542731108439305@qq.com> (raw) From: Zhao Zhili <zhilizhao@tencent.com> These fields in AVCodec are deprecated. For most codecs, it's cumbersome to implement get_supported_config only to export pix_fmts. --- libavcodec/avcodec.c | 6 ++++++ libavcodec/codec_internal.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index e7e2c09222..f41d66d04f 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -765,11 +765,17 @@ int ff_default_get_supported_config(const AVCodecContext *avctx, const void **out_configs, int *out_num_configs) { + const FFCodec *codec2 = ffcodec(codec); + switch (config) { FF_DISABLE_DEPRECATION_WARNINGS case AV_CODEC_CONFIG_PIX_FORMAT: + if (codec2->pix_fmts) + WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec2->pix_fmts, enum AVPixelFormat, AV_PIX_FMT_NONE); WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->pix_fmts, enum AVPixelFormat, AV_PIX_FMT_NONE); case AV_CODEC_CONFIG_FRAME_RATE: + if (codec2->supported_framerates) + WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec2->supported_framerates, AVRational, {0}); WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->supported_framerates, AVRational, {0}); case AV_CODEC_CONFIG_SAMPLE_RATE: WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->supported_samplerates, int, 0); diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h index 5b2db74590..a5ca72f2b6 100644 --- a/libavcodec/codec_internal.h +++ b/libavcodec/codec_internal.h @@ -274,6 +274,15 @@ typedef struct FFCodec { unsigned flags, const void **out_configs, int *out_num_configs); + /** + * Supported pixel format + * + * Can be null. If get_supported_config is null and this field isn't + * null, it will be used by ff_default_get_supported_config. + */ + const enum AVPixelFormat *pix_fmts; + + const AVRational *supported_framerates; } FFCodec; /** -- 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".
reply other threads:[~2025-02-05 17:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=tencent_B0F3736015CC29198EB98542731108439305@qq.com \ --to=quinkblack-at-foxmail.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=zhilizhao@tencent.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git