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

avfilter/vf_waveform: add input option

For finer control of selected formats for filtering.
This commit is contained in:
Paul B Mahol 2023-05-14 00:10:57 +02:00
parent fb8efa9793
commit 28a73506df
2 changed files with 11 additions and 1 deletions

View File

@ -24950,6 +24950,12 @@ Set sample aspect ration to 1/1.
Set sample aspect ratio to match input size of video
@end table
Default is @samp{none}.
@item input
Set input formats for filter to pick from.
Can be @samp{all}, for selecting from all available formats,
or @samp{first}, for selecting first available format.
Default is @samp{first}.
@end table
@section weave, doubleweave

View File

@ -120,6 +120,7 @@ typedef struct WaveformContext {
float ftint[2];
int tint[2];
int fitmode;
int input;
int (*waveform_slice)(AVFilterContext *ctx, void *arg,
int jobnr, int nb_jobs);
@ -196,6 +197,9 @@ static const AVOption waveform_options[] = {
{ "fm", "set fit mode", OFFSET(fitmode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_FITMODES-1, FLAGS, "fitmode" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_NONE}, 0, 0, FLAGS, "fitmode" },
{ "size", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_SIZE}, 0, 0, FLAGS, "fitmode" },
{ "input", "set input formats selection", OFFSET(input), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "input" },
{ "all", "try to select from all available formats", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "input" },
{ "first", "pick first available format", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "input" },
{ NULL }
};
@ -356,7 +360,7 @@ static int query_formats(AVFilterContext *ctx)
depth2 = desc2->comp[0].depth;
if (ncomp != ncomp2 || depth != depth2)
return AVERROR(EAGAIN);
for (i = 1; i < avff->nb_formats; i++) {
for (i = 1; i < avff->nb_formats && !s->input; i++) {
desc = av_pix_fmt_desc_get(avff->formats[i]);
if (rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB) ||
depth != desc->comp[0].depth)