# HG changeset patch # User ivo # Date 1105372315 0 # Node ID 4a6f25e88dbbc9bf1fce8336d97b9f1a76d39f8a # Parent b9cbdef31a898b4a6e2bf3e5d3ad53ebcc297075 Implementation of vo_png suboption parser with subopt-helper and removal of -z command line option. diff -r b9cbdef31a89 -r 4a6f25e88dbb DOCS/man/en/mplayer.1 --- a/DOCS/man/en/mplayer.1 Mon Jan 10 15:43:28 2005 +0000 +++ b/DOCS/man/en/mplayer.1 Mon Jan 10 15:51:55 2005 +0000 @@ -2272,11 +2272,6 @@ displays) this option tells MPlayer which screen to display movie on. . .TP -.B \-z <0\-9> (\-vo png only) -Specifies the compression level of the png video output driver. -0 is no compression, 9 is the maximum compression. -. -.TP .B \-zrbw (\-vo zr only) Display in black and white. For optimal performance, this can be combined with '\-lavdopts gray'. @@ -2977,10 +2972,17 @@ .PD 1 . .TP -.B png (also see \-z) +.B png\ \ Output each frame into a PNG file in the current directory. Each file takes the frame number padded with leading zeros as name. 24bpp RGB and BGR formats are supported. +.PD 0 +.RSs +.IPs z=<0-9> +Specifies the compression level. +0 is no compression, 9 is maximum compression. +.RE +.PD 1 . .TP .B tga\ \ \ \ diff -r b9cbdef31a89 -r 4a6f25e88dbb cfg-mplayer.h --- a/cfg-mplayer.h Mon Jan 10 15:43:28 2005 +0000 +++ b/cfg-mplayer.h Mon Jan 10 15:51:55 2005 +0000 @@ -189,7 +189,7 @@ // -vo png only: #ifdef HAVE_PNG - {"z", &z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL}, + {"z", "-z is replaced by -vo png:z=<0-9>\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, #endif // -vo jpeg only: #ifdef HAVE_JPEG diff -r b9cbdef31a89 -r 4a6f25e88dbb libvo/vo_png.c --- a/libvo/vo_png.c Mon Jan 10 15:43:28 2005 +0000 +++ b/libvo/vo_png.c Mon Jan 10 15:51:55 2005 +0000 @@ -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 switch to set compression level from 0 to 9.\n"); + printf("PNG Info: Use -vo png:z= 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 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; }