[MPlayer-dev-eng] [PATCH] Substitution of -z command line option for vo_png suboption.
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Jan 3 10:45:47 CET 2005
Hi,
> Here's a patch that removes the -z command line option and adds a suboption
> 'z=<0-9>' to vo_png using the recently committed suboption parser. I also
> updated the manual page to reflect this change.
>
> Any comments or objections? (Felix? Diego? :-) )
Looks mostly good to me...
> @@ -46,16 +47,10 @@
> if((z_compression >= 0) && (z_compression <= 9)) {
This doesn't make sense anymore, it will always evaluat to true...
> 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 +201,22 @@
>
> 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;
> + if (subopt_parse(arg, subopts) != 0) {
> + return ENOSYS;
Please set the default values before calling subopt_parse, just to be
sure (e.g. z_compression = 0;).
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list