From 2115e2306e8d7b5dcae452aa2dff37287ba4de48 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 16 Jan 2018 11:37:21 +0100 Subject: video: add utility function to pick conversion image format from a list --- video/img_format.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'video/img_format.c') diff --git a/video/img_format.c b/video/img_format.c index 12822b176f..131ff4cb11 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -486,6 +486,15 @@ int mp_imgfmt_select_best(int dst1, int dst2, int src) return pixfmt2imgfmt(avcodec_find_best_pix_fmt_of_list(dstlist, srcpxf, 1, 0)); } +// Same as mp_imgfmt_select_best(), but with a list of dst formats. +int mp_imgfmt_select_best_list(int *dst, int num_dst, int src) +{ + int best = 0; + for (int n = 0; n < num_dst; n++) + best = best ? mp_imgfmt_select_best(best, dst[n], src) : dst[n]; + return best; +} + #if 0 #include -- cgit v1.2.3