James Almer: > This will be used to propagate global side data through the filterchain. > > Signed-off-by: James Almer <jamr...@gmail.com> > --- > libavfilter/buffersrc.c | 29 +++++++++++++++++++++++++++++ > libavfilter/buffersrc.h | 3 +++ > 2 files changed, 32 insertions(+) > > diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c > index 117ac0cfa2..469a77c848 100644 > --- a/libavfilter/buffersrc.c > +++ b/libavfilter/buffersrc.c > @@ -61,6 +61,8 @@ typedef struct BufferSourceContext { > enum AVSampleFormat sample_fmt; > int channels; > AVChannelLayout ch_layout; > + AVFrameSideData **side_data; > + int nb_side_data; >
Seems like this stuff is never freed. > int eof; > int64_t last_pts; > @@ -160,6 +162,18 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, > AVBufferSrcParameters *par > return AVERROR_BUG; > } > > + for (int i = 0; i < param->nb_side_data; i++) { > + int ret; > + > + av_frame_side_data_free(&s->side_data, &s->nb_side_data); in the loop? > + ret = av_frame_side_data_clone(&s->side_data, &s->nb_side_data, > + param->side_data[i], 0); > + if (ret < 0) { > + av_frame_side_data_free(&s->side_data, &s->nb_side_data); > + return ret; > + } > + } > + > return 0; > } > > @@ -523,6 +537,21 @@ static int config_props(AVFilterLink *link) > return AVERROR(EINVAL); > } > > + for (int i = 0; i < c->nb_side_data; i++) { > + const AVSideDataDescriptor *desc = > av_frame_side_data_desc(c->side_data[i]->type); > + int ret; > + > + if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL)) > + continue; > + > + ret = av_frame_side_data_clone(&link->side_data, &link->nb_side_data, > + c->side_data[i], 0); > + if (ret < 0) { > + av_frame_side_data_free(&link->side_data, &link->nb_side_data); > + return ret; > + } > + } > + > link->time_base = c->time_base; > l->frame_rate = c->frame_rate; > return 0; > diff --git a/libavfilter/buffersrc.h b/libavfilter/buffersrc.h > index 6f3344f445..2db9b8fb59 100644 > --- a/libavfilter/buffersrc.h > +++ b/libavfilter/buffersrc.h > @@ -120,6 +120,9 @@ typedef struct AVBufferSrcParameters { > */ > enum AVColorSpace color_space; > enum AVColorRange color_range; > + > + AVFrameSideData **side_data; > + int nb_side_data; > } AVBufferSrcParameters; > > /** _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".