PR #21072 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21072 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21072.patch
Should fix issue ffmpeg/ffmpeg#21071 >From e977f97b75681984fbd8e93e37687ad6d989131c Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Mon, 1 Dec 2025 11:07:43 -0300 Subject: [PATCH] avfilter/f_select: also handle global side data in filter links Should fix issue #21071 Signed-off-by: James Almer <[email protected]> --- libavfilter/f_sidedata.c | 45 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/libavfilter/f_sidedata.c b/libavfilter/f_sidedata.c index b88a8cbd02..dc7da5a19a 100644 --- a/libavfilter/f_sidedata.c +++ b/libavfilter/f_sidedata.c @@ -96,6 +96,31 @@ static av_cold int init(AVFilterContext *ctx) return 0; } +static int config_props(AVFilterLink *outlink) +{ + AVFilterContext *ctx = outlink->src; + SideDataContext *s = ctx->priv; + const AVFrameSideData *sd = NULL; + + if (s->type != -1) + sd = av_frame_side_data_get(outlink->side_data, outlink->nb_side_data, s->type); + + switch (s->mode) { + case SIDEDATA_SELECT: + break; + case SIDEDATA_DELETE: + if (s->type == -1) + av_frame_side_data_free(&outlink->side_data, &outlink->nb_side_data); + else if (sd) + av_frame_side_data_remove(&outlink->side_data, &outlink->nb_side_data, s->type); + break; + default: + av_assert0(0); + }; + + return 0; +} + static int filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; @@ -143,6 +168,14 @@ static const AVFilterPad ainputs[] = { }, }; +static const AVFilterPad aoutputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .config_props = config_props, + }, +}; + const FFFilter ff_af_asidedata = { .p.name = "asidedata", .p.description = NULL_IF_CONFIG_SMALL("Manipulate audio frame side data."), @@ -152,7 +185,7 @@ const FFFilter ff_af_asidedata = { .priv_size = sizeof(SideDataContext), .init = init, FILTER_INPUTS(ainputs), - FILTER_OUTPUTS(ff_audio_default_filterpad), + FILTER_OUTPUTS(aoutputs), }; #endif /* CONFIG_ASIDEDATA_FILTER */ @@ -169,6 +202,14 @@ static const AVFilterPad inputs[] = { }, }; +static const AVFilterPad outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_props, + }, +}; + const FFFilter ff_vf_sidedata = { .p.name = "sidedata", .p.description = NULL_IF_CONFIG_SMALL("Manipulate video frame side data."), @@ -178,6 +219,6 @@ const FFFilter ff_vf_sidedata = { .priv_size = sizeof(SideDataContext), .init = init, FILTER_INPUTS(inputs), - FILTER_OUTPUTS(ff_video_default_filterpad), + FILTER_OUTPUTS(outputs), }; #endif /* CONFIG_SIDEDATA_FILTER */ -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
