From dd1b848d92034be5aea1388c844a4aea9b53bd35 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 3 Nov 2011 15:47:50 +0200 Subject: cleanup: vf_scale.c, vf.c: replace numbers by flag macro names --- libmpcodecs/vf.c | 25 +++++++++++++------------ libmpcodecs/vf_scale.c | 4 +++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index b379967711..8bd8145042 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -404,7 +404,8 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt, // we have to change width... check if we CAN co it: int flags = vf->query_format(vf, outfmt); // should not fail - if (!(flags & 3)) + if (!(flags & (VFCAP_CSP_SUPPORTED | + VFCAP_CSP_SUPPORTED_BY_HW))) mp_msg(MSGT_DECVIDEO, MSGL_WARN, "??? vf_get_image{vf->query_format(outfmt)} " "failed!\n"); @@ -583,14 +584,14 @@ unsigned int vf_match_csp(vf_instance_t **vfp, const unsigned int *list, if ((p = list)) while (*p) { ret = vf->query_format(vf, *p); - mp_msg(MSGT_VFILTER, MSGL_V, "[%s] query(%s) -> %d\n", - vf->info->name, vo_format_name(*p), ret & 3); - if (ret & 2) { + mp_msg(MSGT_VFILTER, MSGL_V, "[%s] query(%s) -> %x\n", + vf->info->name, vo_format_name(*p), ret); + if (ret & VFCAP_CSP_SUPPORTED_BY_HW) { best = *p; break; - } // no conversion -> bingo! - if (ret & 1 && !best) - best = *p; // best with conversion + } + if (ret & VFCAP_CSP_SUPPORTED && !best) + best = *p; ++p; } if (best) @@ -609,14 +610,14 @@ unsigned int vf_match_csp(vf_instance_t **vfp, const unsigned int *list, if ((p = list)) while (*p) { ret = vf->query_format(vf, *p); - mp_msg(MSGT_VFILTER, MSGL_V, "[%s] query(%s) -> %d\n", - vf->info->name, vo_format_name(*p), ret & 3); - if (ret & 2) { // no conversion -> bingo! + mp_msg(MSGT_VFILTER, MSGL_V, "[%s] query(%s) -> %x\n", + vf->info->name, vo_format_name(*p), ret); + if (ret & VFCAP_CSP_SUPPORTED_BY_HW) { best = *p; break; } - if (ret & 1 && !best) - best = *p; // best with conversion + if (ret & VFCAP_CSP_SUPPORTED && !best) + best = *p; ++p; } if (best) diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 8cd0a37c33..a088d1926e 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -36,6 +36,8 @@ #include "vf_scale.h" #include "libvo/csputils.h" +// VOFLAG_SWSCALE +#include "libvo/video_out.h" #include "m_option.h" #include "m_struct.h" @@ -207,7 +209,7 @@ static int config(struct vf_instance *vf, // - no other sw/hw up/down scaling avail. // - we're after postproc // - user didn't set w:h - if(!(vo_flags&VFCAP_POSTPROC) && (flags&4) && + if(!(vo_flags&VFCAP_POSTPROC) && (flags&VOFLAG_SWSCALE) && vf->priv->w<0 && vf->priv->h<0){ // -zoom int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1; if(d_width