diff options
-rw-r--r-- | video/img_format.c | 9 | ||||
-rw-r--r-- | video/img_format.h | 1 |
2 files changed, 10 insertions, 0 deletions
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 <libavutil/frame.h> diff --git a/video/img_format.h b/video/img_format.h index 123c8ba55e..c8f60f0414 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -244,5 +244,6 @@ char **mp_imgfmt_name_list(void); int mp_imgfmt_find(int xs, int ys, int planes, int component_bits, int flags); int mp_imgfmt_select_best(int dst1, int dst2, int src); +int mp_imgfmt_select_best_list(int *dst, int num_dst, int src); #endif /* MPLAYER_IMG_FORMAT_H */ |