1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/internal: Replace AVFilterPad.needs_writable by flags

It will be useful in the future when more flags are added.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-16 00:07:41 +02:00
parent f60c3ca136
commit 1e35744a4c
27 changed files with 41 additions and 36 deletions

View File

@ -757,9 +757,9 @@ static const AVFilterPad inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.config_props = config_input, .config_props = config_input,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -383,9 +383,9 @@ static const AVFilterPad avfilter_af_channelmap_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = channelmap_filter_frame, .filter_frame = channelmap_filter_frame,
.config_props = channelmap_config_input, .config_props = channelmap_config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -939,10 +939,10 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
static const AVFilterPad firequalizer_inputs[] = { static const AVFilterPad firequalizer_inputs[] = {
{ {
.name = "default", .name = "default",
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.config_props = config_input, .config_props = config_input,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -950,7 +950,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
if (!(filter_frame = dst->filter_frame)) if (!(filter_frame = dst->filter_frame))
filter_frame = default_filter_frame; filter_frame = default_filter_frame;
if (dst->needs_writable) { if (dst->flags & AVFILTERPAD_FLAG_NEEDS_WRITABLE) {
ret = ff_inlink_make_frame_writable(link, &frame); ret = ff_inlink_make_frame_writable(link, &frame);
if (ret < 0) if (ret < 0)
goto fail; goto fail;

View File

@ -269,8 +269,8 @@ static const AVFilterPad areverse_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -60,6 +60,19 @@ struct AVFilterPad {
*/ */
enum AVMediaType type; enum AVMediaType type;
/**
* The filter expects writable frames from its input link,
* duplicating data buffers if needed.
*
* input pads only.
*/
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0)
/**
* A combination of AVFILTERPAD_FLAG_* flags.
*/
int flags;
/** /**
* Callback functions to get a video/audio buffers. If NULL, * Callback functions to get a video/audio buffers. If NULL,
* the filter system will use ff_default_get_video_buffer() for video * the filter system will use ff_default_get_video_buffer() for video
@ -110,14 +123,6 @@ struct AVFilterPad {
* and another value on error. * and another value on error.
*/ */
int (*config_props)(AVFilterLink *link); int (*config_props)(AVFilterLink *link);
/**
* The filter expects writable frames from its input link,
* duplicating data buffers if needed.
*
* input pads only.
*/
int needs_writable;
}; };
struct AVFilterGraphInternal { struct AVFilterGraphInternal {

View File

@ -367,7 +367,7 @@ static const AVFilterPad chromakey_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },
@ -420,7 +420,7 @@ static const AVFilterPad chromahold_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },

View File

@ -300,9 +300,9 @@ static const AVFilterPad codecview_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -358,7 +358,7 @@ static const AVFilterPad colorcontrast_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },

View File

@ -303,7 +303,7 @@ static const AVFilterPad colorcorrect_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },

View File

@ -259,7 +259,7 @@ static const AVFilterPad colorize_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },

View File

@ -176,8 +176,8 @@ static const AVFilterPad colorkey_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -324,9 +324,9 @@ static const AVFilterPad inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -1130,9 +1130,9 @@ static const AVFilterPad oscilloscope_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = oscilloscope_filter_frame, .filter_frame = oscilloscope_filter_frame,
.config_props = oscilloscope_config_input, .config_props = oscilloscope_config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -131,8 +131,8 @@ static const AVFilterPad despill_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -384,9 +384,9 @@ static const AVFilterPad drawbox_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.config_props = config_input, .config_props = config_input,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };
@ -468,9 +468,9 @@ static const AVFilterPad drawgrid_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.config_props = config_input, .config_props = config_input,
.filter_frame = drawgrid_filter_frame, .filter_frame = drawgrid_filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -1615,9 +1615,9 @@ static const AVFilterPad avfilter_vf_drawtext_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -235,9 +235,9 @@ static const AVFilterPad elbg_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.config_props = config_input, .config_props = config_input,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -99,7 +99,7 @@ static const AVFilterPad exposure_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },

View File

@ -551,9 +551,9 @@ static const AVFilterPad avfilter_vf_fade_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.config_props = config_input, .config_props = config_input,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -705,9 +705,9 @@ static const AVFilterPad fillborders_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.config_props = config_input, .config_props = config_input,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -172,9 +172,9 @@ static const AVFilterPad lumakey_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -294,9 +294,9 @@ static const AVFilterPad maskfun_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -267,7 +267,7 @@ static const AVFilterPad monochrome_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },

View File

@ -198,9 +198,9 @@ static const AVFilterPad ass_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -228,9 +228,9 @@ static const AVFilterPad inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
.needs_writable = 1,
}, },
{ NULL } { NULL }
}; };

View File

@ -340,7 +340,7 @@ static const AVFilterPad vibrance_inputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.needs_writable = 1, .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE,
.filter_frame = filter_frame, .filter_frame = filter_frame,
.config_props = config_input, .config_props = config_input,
}, },