History

avfilter/avfilter: add a side_data field to AVFilterLink

This will be used to propagate global side data through the filterchain.

James Almer committed 2 years ago

Commit ef1cb1c1 parent 91d96dc4 files · +25 −3Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavfilter/avfilter.c +17 −1
  3. libavfilter/avfilter.h +3 −0
  4. libavfilter/version.h +2 −2
doc/APIchanges+3−0
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 · 1 unmodified line
22
33 API changes, most recent first:
44
5+2025-01-25 - xxxxxxxxxx - lavfi 10.7.100 - avfilter.h
6+ Add AVFilterLink.side_data and AVFilterLink.nb_side_data
7+
58 2025-01-05 - xxxxxxxxxx - lavc 59.55.100 - frame.h
69 Add AV_FRAME_SIDE_DATA_FLAG_NEW_REF.
710
libavfilter/avfilter.c+17−1
@@ -206,6 +206,7 @@ static void link_free(AVFilterLink **link) · 205 unmodified lines
206206 ff_framequeue_free(&li->fifo);
207207 ff_frame_pool_uninit(&li->frame_pool);
208208 av_channel_layout_uninit(&(*link)->ch_layout);
209+ av_frame_side_data_free(&(*link)->side_data, &(*link)->nb_side_data);
209210
210211 av_buffer_unref(&li->l.hw_frames_ctx);
211212
@@ -376,7 +377,22 @@ int ff_filter_config_links(AVFilterContext *filter) · 164 unmodified lines
376377 "callbacks on all outputs\n");
377378 return AVERROR(EINVAL);
378379 }
379− } else if ((ret = config_link(link)) < 0) {
380+ }
381+
382+ /* Copy side data before link->srcpad->config_props() is called, so the filter
383+ * may remove it for the next filter in the chain */
384+ if (inlink && inlink->nb_side_data && !link->nb_side_data) {
385+ for (i = 0; i < inlink->nb_side_data; i++) {
386+ ret = av_frame_side_data_clone(&link->side_data, &link->nb_side_data,
387+ inlink->side_data[i], 0);
388+ if (ret < 0) {
389+ av_frame_side_data_free(&link->side_data, &link->nb_side_data);
390+ return ret;
391+ }
392+ }
393+ }
394+
395+ if (config_link && (ret = config_link(link)) < 0) {
380396 av_log(link->src, AV_LOG_ERROR,
381397 "Failed to configure output pad on %s\n",
382398 link->src->name);
libavfilter/avfilter.h+3−0
@@ -413,6 +413,9 @@ struct AVFilterLink { · 412 unmodified lines
413413 */
414414 AVRational time_base;
415415
416+ AVFrameSideData **side_data;
417+ int nb_side_data;
418+
416419 /*****************************************************************
417420 * All fields below this line are not part of the public API. They
418421 * may not be used outside of libavfilter and can be changed and
libavfilter/version.h+2−2
@@ -31,8 +31,8 @@ · 30 unmodified lines
3131
3232 #include "version_major.h"
3333
34−#define LIBAVFILTER_VERSION_MINOR 6
35−#define LIBAVFILTER_VERSION_MICRO 101
34+#define LIBAVFILTER_VERSION_MINOR 7
35+#define LIBAVFILTER_VERSION_MICRO 100
3636
3737
3838 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t