[MPlayer-cvslog] CVS: main/libvo vo_png.c,1.24,1.25

Ivo van Poorten CVS syncmail at mplayerhq.hu
Mon Jan 10 16:51:58 CET 2005


CVS change done by Ivo van Poorten CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv13037/libvo

Modified Files:
	vo_png.c 
Log Message:

Implementation of vo_png suboption parser with subopt-helper and removal
of -z command line option.



Index: vo_png.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_png.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vo_png.c	19 Jul 2004 23:11:06 -0000	1.24
+++ vo_png.c	10 Jan 2005 15:51:55 -0000	1.25
@@ -17,6 +17,7 @@
 #include "config.h"
 #include "video_out.h"
 #include "video_out_internal.h"
+#include "subopt-helper.h"
 
 static vo_info_t info = 
 {
@@ -43,19 +44,11 @@
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
 {
     
-    if((z_compression >= 0) && (z_compression <= 9)) {
 	    if(z_compression == 0) {
 		    printf("PNG Warning: compression level set to 0, compression disabled!\n");
-		    printf("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n");
+		    printf("PNG Info: Use -vo png:z=<n> to set compression level from 0 to 9.\n");
 		    printf("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n");
 	    }	    
-    }
-    else {	    	    
-	    printf("PNG Warning: compression level out of range setting to 1!\n");
-	    printf("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n");
-	    printf("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n");
-	    z_compression = Z_BEST_SPEED;
-    }
     
     if(verbose)	printf("PNG Compression level %i\n", z_compression);   
 	  	
@@ -206,12 +199,23 @@
 
 static void check_events(void){}
 
+static int int_zero_to_nine(int *sh)
+{
+    if ( (*sh < 0) || (*sh > 9) )
+        return 0;
+    return 1;
+}
+
+static opt_t subopts[] = {
+    {"z",   OPT_ARG_INT, &z_compression, (opt_test_f)int_zero_to_nine},
+    {NULL}
+};
+
 static uint32_t preinit(const char *arg)
 {
-    if(arg) 
-    {
-	printf("PNG Unknown subdevice: %s\n",arg);
-	return ENOSYS;
+    z_compression = 0;
+    if (subopt_parse(arg, subopts) != 0) {
+        return -1;
     }
     return 0;
 }




More information about the MPlayer-cvslog mailing list