vf_format: simplify frame type checking after addition of DoVi option

We only wish to touch actual video frames, which should have an
allocated image attached to them, so just check the frame type
early, and exit by passing through such non-video frames to further
filters in the chain without attempting to process them.

Fixes a crash in case of non-video (EOF/NONE) frames being passed
onto the filter when the dovi option was set to false since
05ccc51d53 .
This commit is contained in:
Jan Ekström 2022-02-06 00:58:59 +02:00
parent 240340d60a
commit 8c4cb84f9e
1 changed files with 5 additions and 1 deletions

View File

@ -145,7 +145,10 @@ static void vf_format_process(struct mp_filter *f)
struct mp_frame frame = mp_pin_out_read(priv->conv->f->pins[1]);
struct mp_image *img = frame.data;
if (!priv->opts->convert && frame.type == MP_FRAME_VIDEO) {
if (frame.type != MP_FRAME_VIDEO)
goto write_out;
if (!priv->opts->convert) {
set_params(priv->opts, &img->params, false);
mp_image_params_guess_csp(&img->params);
}
@ -153,6 +156,7 @@ static void vf_format_process(struct mp_filter *f)
if (!priv->opts->dovi)
av_buffer_unref(&img->dovi);
write_out:
mp_pin_in_write(f->ppins[1], frame);
}
}