Unified · Split
| @@ -140,9 +140,11 @@ static av_cold void uninit(AVFilterContext *ctx) · 139 unmodified lines | ||
| 140 | 140 | AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \ |
| 141 | 141 | AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16, |
| 142 | 142 | |
| 143 | −static int query_formats(AVFilterContext *ctx) | |
| 143 | +static int query_formats(const AVFilterContext *ctx, | |
| 144 | + AVFilterFormatsConfig **cfg_in, | |
| 145 | + AVFilterFormatsConfig **cfg_out) | |
| 144 | 146 | { |
| 145 | − LUT2Context *s = ctx->priv; | |
| 147 | + const LUT2Context *s = ctx->priv; | |
| 146 | 148 | static const enum AVPixelFormat all_pix_fmts[] = { |
| 147 | 149 | BIT8_FMTS |
| 148 | 150 | BIT9_FMTS |
| @@ -178,9 +180,9 @@ static int query_formats(AVFilterContext *ctx) · 29 unmodified lines | ||
| 178 | 180 | int ret; |
| 179 | 181 | |
| 180 | 182 | if (s->tlut2 || !s->odepth) |
| 181 | − return ff_set_common_formats_from_list(ctx, all_pix_fmts); | |
| 183 | + return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, all_pix_fmts); | |
| 182 | 184 | |
| 183 | − ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &ctx->inputs[0]->outcfg.formats); | |
| 185 | + ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &cfg_in[0]->formats); | |
| 184 | 186 | if (ret < 0) |
| 185 | 187 | return ret; |
| 186 | 188 | |
| @@ -191,11 +193,10 @@ static int query_formats(AVFilterContext *ctx) · 4 unmodified lines | ||
| 191 | 193 | case 12: pix_fmts = bit12_pix_fmts; break; |
| 192 | 194 | case 14: pix_fmts = bit14_pix_fmts; break; |
| 193 | 195 | case 16: pix_fmts = bit16_pix_fmts; break; |
| 194 | − default: av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", s->odepth); | |
| 195 | − return AVERROR(EINVAL); | |
| 196 | + default: av_assert0(0); | |
| 196 | 197 | } |
| 197 | 198 | |
| 198 | − return ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->outputs[0]->incfg.formats); | |
| 199 | + return ff_formats_ref(ff_make_format_list(pix_fmts), &cfg_out[0]->formats); | |
| 199 | 200 | } |
| 200 | 201 | |
| 201 | 202 | static int config_inputx(AVFilterLink *inlink) |
| @@ -573,7 +574,7 @@ const AVFilter ff_vf_lut2 = { · 371 unmodified lines | ||
| 573 | 574 | .activate = activate, |
| 574 | 575 | FILTER_INPUTS(inputs), |
| 575 | 576 | FILTER_OUTPUTS(outputs), |
| 576 | − FILTER_QUERY_FUNC(query_formats), | |
| 577 | + FILTER_QUERY_FUNC2(query_formats), | |
| 577 | 578 | .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | |
| 578 | 579 | AVFILTER_FLAG_SLICE_THREADS, |
| 579 | 580 | .process_command = process_command, |
| @@ -587,6 +588,12 @@ static av_cold int init(AVFilterContext *ctx) · 7 unmodified lines | ||
| 587 | 588 | |
| 588 | 589 | s->tlut2 = !strcmp(ctx->filter->name, "tlut2"); |
| 589 | 590 | |
| 591 | + if (!(s->odepth == 0 || s->odepth == 8 || s->odepth == 9 || s->odepth == 10 || | |
| 592 | + s->odepth == 12 || s->odepth == 14 || s->odepth == 16)) { | |
| 593 | + av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", s->odepth); | |
| 594 | + return AVERROR(EINVAL); | |
| 595 | + } | |
| 596 | + | |
| 590 | 597 | return 0; |
| 591 | 598 | } |
| 592 | 599 | |
| @@ -663,7 +670,7 @@ const AVFilter ff_vf_tlut2 = { · 70 unmodified lines | ||
| 663 | 670 | .uninit = uninit, |
| 664 | 671 | FILTER_INPUTS(tlut2_inputs), |
| 665 | 672 | FILTER_OUTPUTS(tlut2_outputs), |
| 666 | − FILTER_QUERY_FUNC(query_formats), | |
| 673 | + FILTER_QUERY_FUNC2(query_formats), | |
| 667 | 674 | .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | |
| 668 | 675 | AVFILTER_FLAG_SLICE_THREADS, |
| 669 | 676 | .process_command = process_command, |