|
|
|
@ -201,15 +201,15 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, |
|
|
|
|
printf("\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void show_help_children(const AVClass *class, int flags) |
|
|
|
|
void show_help_children(const AVClass *clazz, int flags) |
|
|
|
|
{ |
|
|
|
|
const AVClass *child = NULL; |
|
|
|
|
if (class->option) { |
|
|
|
|
av_opt_show2(&class, NULL, flags, 0); |
|
|
|
|
if (clazz->option) { |
|
|
|
|
av_opt_show2(&clazz, NULL, flags, 0); |
|
|
|
|
printf("\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
while (child = av_opt_child_class_next(class, child)) |
|
|
|
|
while (child = av_opt_child_class_next(clazz, child)) |
|
|
|
|
show_help_children(child, flags); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -300,12 +300,12 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, |
|
|
|
|
int *dstcount; |
|
|
|
|
|
|
|
|
|
if (po->flags & OPT_SPEC) { |
|
|
|
|
SpecifierOpt **so = dst; |
|
|
|
|
char *p = strchr(opt, ':'); |
|
|
|
|
SpecifierOpt **so = (SpecifierOpt **) dst; |
|
|
|
|
char *p = strchr((char*) opt, ':'); |
|
|
|
|
char *str; |
|
|
|
|
|
|
|
|
|
dstcount = (int *)(so + 1); |
|
|
|
|
*so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1); |
|
|
|
|
*so = (SpecifierOpt *) (grow_array(*so, sizeof(**so), dstcount, *dstcount + 1)); |
|
|
|
|
str = av_strdup(p ? p + 1 : ""); |
|
|
|
|
if (!str) |
|
|
|
|
return AVERROR(ENOMEM); |
|
|
|
@ -472,7 +472,7 @@ static void dump_argument(const char *a) |
|
|
|
|
{ |
|
|
|
|
const unsigned char *p; |
|
|
|
|
|
|
|
|
|
for (p = a; *p; p++) |
|
|
|
|
for (p = (const unsigned char *) a; *p; p++) |
|
|
|
|
if (!((*p >= '+' && *p <= ':') || (*p >= '@' && *p <= 'Z') || |
|
|
|
|
*p == '_' || (*p >= 'a' && *p <= 'z'))) |
|
|
|
|
break; |
|
|
|
@ -481,7 +481,7 @@ static void dump_argument(const char *a) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
fputc('"', report_file); |
|
|
|
|
for (p = a; *p; p++) { |
|
|
|
|
for (p = (const unsigned char *) a; *p; p++) { |
|
|
|
|
if (*p == '\\' || *p == '"' || *p == '$' || *p == '`') |
|
|
|
|
fprintf(report_file, "\\%c", *p); |
|
|
|
|
else if (*p < ' ' || *p > '~') |
|
|
|
@ -663,7 +663,8 @@ static void finish_group(OptionParseContext *octx, int group_idx, |
|
|
|
|
OptionGroupList *l = &octx->groups[group_idx]; |
|
|
|
|
OptionGroup *g; |
|
|
|
|
|
|
|
|
|
GROW_ARRAY(l->groups, l->nb_groups); |
|
|
|
|
// GROW_ARRAY(l->groups, l->nb_groups);
|
|
|
|
|
l->groups = (OptionGroup *) grow_array(l->groups, sizeof(*l->groups), &l->nb_groups, l->nb_groups + 1); |
|
|
|
|
g = &l->groups[l->nb_groups - 1]; |
|
|
|
|
|
|
|
|
|
*g = octx->cur_group; |
|
|
|
@ -694,7 +695,8 @@ static void add_opt(OptionParseContext *octx, const OptionDef *opt, |
|
|
|
|
int global = !(opt->flags & (OPT_PERFILE | OPT_SPEC | OPT_OFFSET)); |
|
|
|
|
OptionGroup *g = global ? &octx->global_opts : &octx->cur_group; |
|
|
|
|
|
|
|
|
|
GROW_ARRAY(g->opts, g->nb_opts); |
|
|
|
|
// GROW_ARRAY(g->opts, g->nb_opts);
|
|
|
|
|
g->opts = (Option *) grow_array(g->opts, sizeof(*g->opts), &g->nb_opts, g->nb_opts + 1); |
|
|
|
|
g->opts[g->nb_opts - 1].opt = opt; |
|
|
|
|
g->opts[g->nb_opts - 1].key = key; |
|
|
|
|
g->opts[g->nb_opts - 1].val = val; |
|
|
|
@ -709,7 +711,7 @@ static void init_parse_context(OptionParseContext *octx, |
|
|
|
|
memset(octx, 0, sizeof(*octx)); |
|
|
|
|
|
|
|
|
|
octx->nb_groups = nb_groups; |
|
|
|
|
octx->groups = av_mallocz_array(octx->nb_groups, sizeof(*octx->groups)); |
|
|
|
|
octx->groups = (OptionGroupList *) av_mallocz_array(octx->nb_groups, sizeof(*octx->groups)); |
|
|
|
|
if (!octx->groups) |
|
|
|
|
exit_program(1); |
|
|
|
|
|
|
|
|
@ -945,14 +947,14 @@ end: |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void expand_filename_template(AVBPrint *bp, const char *template, |
|
|
|
|
static void expand_filename_template(AVBPrint *bp, const char *templates, |
|
|
|
|
struct tm *tm) |
|
|
|
|
{ |
|
|
|
|
int c; |
|
|
|
|
|
|
|
|
|
while ((c = *(template++))) { |
|
|
|
|
while ((c = *(templates++))) { |
|
|
|
|
if (c == '%') { |
|
|
|
|
if (!(c = *(template++))) |
|
|
|
|
if (!(c = *(templates++))) |
|
|
|
|
break; |
|
|
|
|
switch (c) { |
|
|
|
|
case 'p': |
|
|
|
@ -1017,8 +1019,8 @@ static int init_report(const char *env) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
av_bprint_init(&filename, 0, AV_BPRINT_SIZE_AUTOMATIC); |
|
|
|
|
expand_filename_template(&filename, |
|
|
|
|
av_x_if_null(filename_template, "%p-%t.log"), tm); |
|
|
|
|
expand_filename_template(&filename, (const char *)(filename_template ? filename_template : "%p-%t.log") |
|
|
|
|
/*av_x_if_null(filename_template, "%p-%t.log")*/, tm); |
|
|
|
|
av_free(filename_template); |
|
|
|
|
if (!av_bprint_is_complete(&filename)) { |
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "Out of memory building report file name\n"); |
|
|
|
@ -1066,8 +1068,8 @@ int opt_max_alloc(void *optctx, const char *opt, const char *arg) |
|
|
|
|
int opt_timelimit(void *optctx, const char *opt, const char *arg) |
|
|
|
|
{ |
|
|
|
|
#if HAVE_SETRLIMIT |
|
|
|
|
int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); |
|
|
|
|
struct rlimit rl = { lim, lim + 1 }; |
|
|
|
|
int lim = (int) parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); |
|
|
|
|
struct rlimit rl = {(__kernel_ulong_t) lim, (__kernel_ulong_t) (lim + 1)}; |
|
|
|
|
if (setrlimit(RLIMIT_CPU, &rl)) |
|
|
|
|
perror("setrlimit"); |
|
|
|
|
#else |
|
|
|
@ -1502,8 +1504,8 @@ static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev, |
|
|
|
|
|
|
|
|
|
static int compare_codec_desc(const void *a, const void *b) |
|
|
|
|
{ |
|
|
|
|
const AVCodecDescriptor * const *da = a; |
|
|
|
|
const AVCodecDescriptor * const *db = b; |
|
|
|
|
const AVCodecDescriptor * const *da = (const AVCodecDescriptor *const*)a; |
|
|
|
|
const AVCodecDescriptor * const *db = (const AVCodecDescriptor *const*)b; |
|
|
|
|
|
|
|
|
|
return (*da)->type != (*db)->type ? FFDIFFSIGN((*da)->type, (*db)->type) : |
|
|
|
|
strcmp((*da)->name, (*db)->name); |
|
|
|
@ -1517,7 +1519,7 @@ static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs) |
|
|
|
|
|
|
|
|
|
while ((desc = avcodec_descriptor_next(desc))) |
|
|
|
|
nb_codecs++; |
|
|
|
|
if (!(codecs = av_calloc(nb_codecs, sizeof(*codecs)))) { |
|
|
|
|
if (!(codecs = (const AVCodecDescriptor **) av_calloc(nb_codecs, sizeof(*codecs)))) { |
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "Out of memory\n"); |
|
|
|
|
exit_program(1); |
|
|
|
|
} |
|
|
|
@ -1802,7 +1804,7 @@ int show_sample_fmts(void *optctx, const char *opt, const char *arg) |
|
|
|
|
int i; |
|
|
|
|
char fmt_str[128]; |
|
|
|
|
for (i = -1; i < AV_SAMPLE_FMT_NB; i++) |
|
|
|
|
printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i)); |
|
|
|
|
// printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));//TODO
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2137,7 +2139,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, |
|
|
|
|
|
|
|
|
|
if (!s->nb_streams) |
|
|
|
|
return NULL; |
|
|
|
|
opts = av_mallocz_array(s->nb_streams, sizeof(*opts)); |
|
|
|
|
opts = (AVDictionary **) av_mallocz_array(s->nb_streams, sizeof(*opts)); |
|
|
|
|
if (!opts) { |
|
|
|
|
av_log(NULL, AV_LOG_ERROR, |
|
|
|
|
"Could not alloc memory for stream options.\n"); |
|
|
|
@ -2156,7 +2158,7 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) |
|
|
|
|
exit_program(1); |
|
|
|
|
} |
|
|
|
|
if (*size < new_size) { |
|
|
|
|
uint8_t *tmp = av_realloc_array(array, new_size, elem_size); |
|
|
|
|
uint8_t *tmp = (uint8_t *) av_realloc_array(array, new_size, elem_size); |
|
|
|
|
if (!tmp) { |
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); |
|
|
|
|
exit_program(1); |