[MPlayer-dev-eng] [PATCH] make swscale-example compile

Alan Curry pacman at TheWorld.com
Thu Feb 16 05:41:16 CET 2006


While I've been poking around in the swscaler, I noticed this thing called
swscale-example.c which looks like a useful set of tests. It's not currently
in a compilable state, because things have changed and it hasn't kept up.
With this patch, it compiles. And it's already proven itself useful -- it
segfaulted, revealing a bug in swscale.c (patch coming in a separate message
after this one). Aside from the segfault, there are a lot of suspiciously
high numbers in the output which may be indicators of more bugs.

-------------- next part --------------
Index: swscale-example.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale-example.c,v
retrieving revision 1.7
diff -u -r1.7 swscale-example.c
--- swscale-example.c	13 Jan 2006 00:23:32 -0000	1.7
+++ swscale-example.c	16 Feb 2006 04:16:57 -0000
@@ -90,9 +90,9 @@
 		out[i]= (uint8_t*) malloc(refStride[i]*h);
 	}
 
-	srcContext= sws_getContext(w, h, IMGFMT_YV12, srcW, srcH, srcFormat, flags, NULL, NULL);
-	dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL);
-	outContext= sws_getContext(dstW, dstH, dstFormat, w, h, IMGFMT_YV12, flags, NULL, NULL);
+	srcContext= sws_getContext(w, h, IMGFMT_YV12, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
+	dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
+	outContext= sws_getContext(dstW, dstH, dstFormat, w, h, IMGFMT_YV12, flags, NULL, NULL, NULL);
 	if(srcContext==NULL ||dstContext==NULL ||outContext==NULL){
 		printf("Failed allocating swsContext\n");
 		goto end;
@@ -139,7 +139,7 @@
 	}
 }
 
-void mp_msg_c( int x, const char *format, ... ){
+void mp_msg( int x, int y, const char *format, ... ){
     va_list va;
     va_start(va, format);
     vfprintf(stderr, format, va);
@@ -192,7 +192,7 @@
 	int x, y;
 	struct SwsContext *sws;
 
-	sws= sws_getContext(W/12, H/12, IMGFMT_BGR32, W, H, IMGFMT_YV12, 2, NULL, NULL);
+	sws= sws_getContext(W/12, H/12, IMGFMT_BGR32, W, H, IMGFMT_YV12, 2, NULL, NULL, NULL);
         
 	for(y=0; y<H; y++){
 		for(x=0; x<W*4; x++){


More information about the MPlayer-dev-eng mailing list