feat/api #46

Open
Gregor Weiss wants to merge 56 commits from feat/api into main
Showing only changes of commit e0bc0d8839 - Show all commits

View file

@ -303,13 +303,12 @@ typedef struct
*
* @retval -1 Error
* @retval 0 OK
*/
/*================================================================================================*/
static error_t
parse_opt(int key,
char *arg,
struct argp_state *state)
{
*/
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
@ -317,44 +316,56 @@ parse_opt(int key,
//uint64_t multiplier;
//uint16_t buffI;
/*
uint8_t i;
//uint8_t length, shift;
*/
/*-----------------------*\
! DEFINE REAL VARIABLES: !
\*-----------------------*/
/*
float bitrate;
*/
/*-----------------------*\
! DEFINE REAL VARIABLES: !
\*-----------------------*/
/*
char *end;
*/
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
/*
cli_arguments *arguments;
bwc_codec *codec;
bwc_stream *stream;
*/
/*-----------------------*\
! DEFINE ASSERTIONS: !
\*-----------------------*/
/*
assert(state);
*/
/*--------------------------------------------------------*\
! Save frequently used variables/structures to temporary !
! variables to make the code more readable. !
\*--------------------------------------------------------*/
/*
arguments = state->input;
codec = arguments->codec;
stream = arguments->stream;
*/
/*--------------------------------------------------------*\
! Parse the cli arguments according to the supplied opt. !
\*--------------------------------------------------------*/
/*
switch(key)
{
case 'c':
@ -487,6 +498,7 @@ parse_opt(int key,
}
case 'D':
{
*/
/* remove_deliminator(arg, end, '/');
for(buff_LL = strtoll(arg, &end, 10), i = 0; arg != end && i < 4;
@ -521,6 +533,7 @@ parse_opt(int key,
argp_error(state, "The codeblock argument expects either a "
"single global or 4 directional values\n");
}*/
/*
break;
}
case 'n':
@ -587,6 +600,7 @@ parse_opt(int key,
break;
case ARGP_KEY_END:
*/
/*if(!((arguments->analysis != NULL) && (arguments->comp == NULL)
&& (arguments->decomp == NULL)
&& (arguments->header == NULL)
@ -609,6 +623,7 @@ parse_opt(int key,
argp_error(state, "The User supplied options do not fit the "
"supported use cases.\n");
}*/
/*
break;
default:
@ -616,9 +631,10 @@ parse_opt(int key,
}
return EXIT_SUCCESS;
}
*/
// initialize the argp struct. Which will be used to parse and use the args.
static struct argp argp = {options, parse_opt, 0, doc};
//static struct argp argp = {options, parse_opt, 0, doc};
/*================================================================================================*/
/**
@ -697,27 +713,27 @@ int main(int argc, char *argv[])
/*--------------------------------------------------------*\
! Initialize the arguments structure. !
\*--------------------------------------------------------*/
arguments.stream = calloc(1, sizeof(bwc_stream));
arguments.codec = calloc(1, sizeof(bwc_codec));
if((arguments.stream == NULL) ||
(arguments.codec == NULL))
{
//arguments.stream = calloc(1, sizeof(bwc_stream));
//arguments.codec = calloc(1, sizeof(bwc_codec));
//if((arguments.stream == NULL) ||
//(arguments.codec == NULL))
//{
// memory allocation error
fprintf(stderr, MEMERROR);
return EXIT_FAILURE;
}
//fprintf(stderr, MEMERROR);
//return EXIT_FAILURE;
//}
/*--------------------------------------------------------*\
! Parse the cli arguments. !
\*--------------------------------------------------------*/
argp_parse(&argp, argc, argv, 0, 0, &arguments);
if(arguments.mode == cli_err)
{
return EXIT_FAILURE;
}
//argp_parse(&argp, argc, argv, 0, 0, &arguments);
//if(arguments.mode == cli_err)
//{
//return EXIT_FAILURE;
//}
for(i = 0; i < 10; ++i)
printf("bitrate %d:\t%f\n",i,arguments.bitrate[i]);
//for(i = 0; i < 10; ++i)
//printf("bitrate %d:\t%f\n",i,arguments.bitrate[i]);