diff libmpcodecs/vf_scale.c @ 19870:1e5cf11e8b1f

Use PIX_FMT_* instead of IMGFMT_* when calling sws_getContext()
author lucabe
date Sun, 17 Sep 2006 15:02:13 +0000
parents 46fa785e9026
children 0b262e00bc99
line wrap: on
line diff
--- a/libmpcodecs/vf_scale.c	Sun Sep 17 14:59:55 2006 +0000
+++ b/libmpcodecs/vf_scale.c	Sun Sep 17 15:02:13 2006 +0000
@@ -10,6 +10,7 @@
 #include "img_format.h"
 #include "mp_image.h"
 #include "vf.h"
+#include "fmt-conversion.h"
 
 #include "libvo/fastmemcpy.h"
 #include "libswscale/swscale.h"
@@ -116,11 +117,14 @@
     int int_sws_flags=0;
     int round_w=0, round_h=0;
     SwsFilter *srcFilter, *dstFilter;
+    enum PixelFormat dfmt, sfmt;
     
     if(!best){
 	mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n");
 	return 0;
     }
+    sfmt = imgfmt2pixfmt(outfmt);
+    dfmt = imgfmt2pixfmt(best);
     
     vo_flags=vf->next->query_format(vf->next,best);
     
@@ -222,15 +226,15 @@
     int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT;
     int_sws_flags|= vf->priv->accurate_rnd * SWS_ACCURATE_RND;
     vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced,
-	    outfmt,
+	    sfmt,
 		  vf->priv->w, vf->priv->h >> vf->priv->interlaced,
-	    best,
+	    dfmt,
 	    int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
     if(vf->priv->interlaced){
         vf->priv->ctx2=sws_getContext(width, height >> 1,
-	    outfmt,
+	    sfmt,
 		  vf->priv->w, vf->priv->h >> 1,
-	    best,
+	    dfmt,
 	    int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param);
     }
     if(!vf->priv->ctx){
@@ -559,9 +563,13 @@
 {
 	int flags;
 	SwsFilter *dstFilterParam, *srcFilterParam;
+	enum PixelFormat dfmt, sfmt;
+
+	dfmt = imgfmt2pixfmt(dstFormat);
+	sfmt = imgfmt2pixfmt(srcFormat);
 	sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam);
 
-	return sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL);
+	return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL);
 }
 
 /// An example of presets usage