From a7dddbacc6cc8cafb5aaf0cf7d8e36d2a759a6e9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 3 Jan 2015 17:23:01 +0100 Subject: video: batch query_format calls There are currently 568 pixel formats (actually fewer, but the namespace is this big), and for each format elaborate synchronization was done to call it synchronously on the VO. This is completely unnecessary, and we can do with just a single call. --- player/playloop.c | 4 +++- player/video.c | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'player') diff --git a/player/playloop.c b/player/playloop.c index 1a0f8fbdd5..fc55b9bf05 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -848,8 +848,10 @@ void handle_force_window(struct MPContext *mpctx, bool reconfig) MP_INFO(mpctx, "Creating non-video VO window.\n"); // Pick whatever works int config_format = 0; + uint8_t fmts[IMGFMT_END - IMGFMT_START] = {0}; + vo_query_formats(vo, fmts); for (int fmt = IMGFMT_START; fmt < IMGFMT_END; fmt++) { - if (vo_query_format(vo, fmt)) { + if (fmts[fmt - IMGFMT_START]) { config_format = fmt; break; } diff --git a/player/video.c b/player/video.c index d2210b691d..21b8e58f3a 100644 --- a/player/video.c +++ b/player/video.c @@ -88,8 +88,7 @@ void update_fps(struct MPContext *mpctx) static void set_allowed_vo_formats(struct vf_chain *c, struct vo *vo) { - for (int fmt = IMGFMT_START; fmt < IMGFMT_END; fmt++) - c->allowed_output_formats[fmt - IMGFMT_START] = vo_query_format(vo, fmt); + vo_query_formats(vo, c->allowed_output_formats); } static int try_filter(struct MPContext *mpctx, struct mp_image_params params, -- cgit v1.2.3