#include <math.h>\r
\r
#include "openjpeg.h"\r
-#include "getopt.h"\r
+#include "opj_getopt.h"\r
#include "convert.h"\r
#include "dirent.h"\r
#include "org_openJpeg_OpenJPEGJavaDecoder.h"\r
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {\r
/* parse the command line */\r
int totlen;\r
- option_t long_option[]={\r
+ opj_option_t long_option[]={\r
{"ImgDir",REQ_ARG, NULL ,'y'},\r
{"OutFor",REQ_ARG, NULL ,'O'},\r
};\r
reset_options_reading();\r
\r
while (1) {\r
- int c = getopt_long(argc, argv,optlist,long_option,totlen);\r
+ int c = opj_getopt_long(argc, argv,optlist,long_option,totlen);\r
if (c == -1)\r
break;\r
switch (c) {\r
case 'i': /* input file */\r
{\r
- char *infile = optarg;\r
+ char *infile = opj_optarg;\r
parameters->decod_format = get_file_format(infile);\r
switch(parameters->decod_format) {\r
case J2K_CFMT:\r
\r
case 'o': /* output file */\r
{\r
- char *outfile = optarg;\r
+ char *outfile = opj_optarg;\r
parameters->cod_format = get_file_format(outfile);\r
switch(parameters->cod_format) {\r
case PGX_DFMT:\r
case 'O': /* output format */\r
{\r
char outformat[50];\r
- char *of = optarg;\r
+ char *of = opj_optarg;\r
sprintf(outformat,".%s",of);\r
img_fol->set_out_format = 1;\r
parameters->cod_format = get_file_format(outformat);\r
\r
case 'r': /* reduce option */\r
{\r
- sscanf(optarg, "%d", ¶meters->cp_reduce);\r
+ sscanf(opj_optarg, "%d", ¶meters->cp_reduce);\r
}\r
break;\r
\r
\r
case 'l': /* layering option */\r
{\r
- sscanf(optarg, "%d", ¶meters->cp_layer);\r
+ sscanf(opj_optarg, "%d", ¶meters->cp_layer);\r
}\r
break;\r
\r
\r
case 'y': /* Image Directory path */\r
{\r
- img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);\r
- strcpy(img_fol->imgdirpath,optarg);\r
+ img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);\r
+ strcpy(img_fol->imgdirpath,opj_optarg);\r
img_fol->set_imgdir=1;\r
}\r
break;\r
{\r
char *token = NULL;\r
\r
- token = strtok(optarg, ",");\r
+ token = strtok(opj_optarg, ",");\r
while(token != NULL) {\r
\r
/* search expected number of components */\r
/* ----------------------------------------------------- */\r
\r
default:\r
- fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);\r
+ fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);\r
break;\r
}\r
}\r