This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 39661f92954c93f2f259df4ab8fcffd83e7aefd5 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Fri Jan 30 01:01:45 2026 +0100 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Fri Jan 30 15:20:08 2026 +0100 fftools/ffmpeg_{filter,mux_init}: Improve type-safety Reviewed-by: Niklas Haas <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]> --- fftools/ffmpeg.h | 5 ++++- fftools/ffmpeg_filter.c | 15 +++++++++------ fftools/ffmpeg_mux_init.c | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 7720dd9c59..3e66534d48 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -347,7 +347,10 @@ typedef struct OutputFilterOptions { int sample_rate; AVChannelLayout ch_layout; - const int *formats; + union { + const enum AVPixelFormat *pix_fmts; + const enum AVSampleFormat *sample_fmts; + }; const int *sample_rates; const AVChannelLayout *ch_layouts; const AVRational *frame_rates; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 4387c992da..765b65d0ec 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -223,7 +223,10 @@ typedef struct OutputFilterPriv { // those are only set if no format is specified and the encoder gives us multiple options // They point directly to the relevant lists of the encoder. - const int *formats; + union { + const enum AVPixelFormat *pix_fmts; + const enum AVSampleFormat *sample_fmts; + }; const AVChannelLayout *ch_layouts; const int *sample_rates; const enum AVColorSpace *color_spaces; @@ -399,10 +402,10 @@ static void choose_ ## name (OutputFilterPriv *ofp, AVBPrint *bprint) \ av_bprint_chars(bprint, ':', 1); \ } -DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, formats, +DEF_CHOOSE_FORMAT(pix_fmts, enum AVPixelFormat, format, pix_fmts, AV_PIX_FMT_NONE, "%s", av_get_pix_fmt_name) -DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats, +DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, sample_fmts, AV_SAMPLE_FMT_NONE, "%s", av_get_sample_fmt_name) DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0, @@ -859,7 +862,7 @@ int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc, if (opts->format != AV_PIX_FMT_NONE) { ofp->format = opts->format; } else - ofp->formats = opts->formats; + ofp->pix_fmts = opts->pix_fmts; if (opts->color_space != AVCOL_SPC_UNSPECIFIED) ofp->color_space = opts->color_space; @@ -898,7 +901,7 @@ int ofilter_bind_enc(OutputFilter *ofilter, unsigned sched_idx_enc, if (opts->format != AV_SAMPLE_FMT_NONE) { ofp->format = opts->format; } else { - ofp->formats = opts->formats; + ofp->sample_fmts = opts->sample_fmts; } if (opts->sample_rate) { ofp->sample_rate = opts->sample_rate; @@ -1702,7 +1705,7 @@ static int configure_output_video_filter(FilterGraphPriv *fgp, AVFilterGraph *gr } av_assert0(!(ofp->flags & OFILTER_FLAG_DISABLE_CONVERT) || - ofp->format != AV_PIX_FMT_NONE || !ofp->formats); + ofp->format != AV_PIX_FMT_NONE || !ofp->pix_fmts); av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED); choose_pix_fmts(ofp, &bprint); choose_color_spaces(ofp, &bprint); diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 0569f62836..4cb8f91d6e 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -949,7 +949,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, if (!keep_pix_fmt) { ret = avcodec_get_supported_config(enc_ctx, NULL, AV_CODEC_CONFIG_PIX_FORMAT, 0, - (const void **) &opts.formats, NULL); + (const void **) &opts.pix_fmts, NULL); if (ret < 0) return ret; } @@ -978,7 +978,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, } else { ret = avcodec_get_supported_config(enc_ctx, NULL, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, - (const void **) &opts.formats, NULL); + (const void **) &opts.sample_fmts, NULL); if (ret < 0) return ret; ret = avcodec_get_supported_config(enc_ctx, NULL, _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
