|
|
|
@ -308,147 +308,7 @@ int opt_default(const char *opt, const char *arg) |
|
|
|
|
fprintf(stderr, "Unrecognized option '%s'\n", opt); |
|
|
|
|
return AVERROR_OPTION_NOT_FOUND; |
|
|
|
|
} |
|
|
|
|
#if 0 |
|
|
|
|
<<<<<<< HEAD |
|
|
|
|
int opt_default(const char *opt, const char *arg){ |
|
|
|
|
int type; |
|
|
|
|
int ret= 0; |
|
|
|
|
const AVOption *o= NULL; |
|
|
|
|
int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0}; |
|
|
|
|
AVCodec *p = NULL; |
|
|
|
|
AVOutputFormat *oformat = NULL; |
|
|
|
|
AVInputFormat *iformat = NULL; |
|
|
|
|
|
|
|
|
|
while ((p = av_codec_next(p))) { |
|
|
|
|
const AVClass *c = p->priv_class; |
|
|
|
|
if (c && av_find_opt(&c, opt, NULL, 0, 0)) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (p) |
|
|
|
|
goto out; |
|
|
|
|
while ((oformat = av_oformat_next(oformat))) { |
|
|
|
|
const AVClass *c = oformat->priv_class; |
|
|
|
|
if (c && av_find_opt(&c, opt, NULL, 0, 0)) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (oformat) |
|
|
|
|
goto out; |
|
|
|
|
while ((iformat = av_iformat_next(iformat))) { |
|
|
|
|
const AVClass *c = iformat->priv_class; |
|
|
|
|
if (c && av_find_opt(&c, opt, NULL, 0, 0)) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (iformat) |
|
|
|
|
goto out; |
|
|
|
|
|
|
|
|
|
for(type=0; *avcodec_opts && type<AVMEDIA_TYPE_NB && ret>= 0; type++){ |
|
|
|
|
const AVOption *o2 = av_opt_find(avcodec_opts[0], opt, NULL, opt_types[type], 0); |
|
|
|
|
if(o2) |
|
|
|
|
ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o); |
|
|
|
|
} |
|
|
|
|
if(!o && avformat_opts) |
|
|
|
|
ret = av_set_string3(avformat_opts, opt, arg, 1, &o); |
|
|
|
|
if(!o && sws_opts) |
|
|
|
|
ret = av_set_string3(sws_opts, opt, arg, 1, &o); |
|
|
|
|
if(!o){ |
|
|
|
|
if (opt[0] == 'a' && avcodec_opts[AVMEDIA_TYPE_AUDIO]) |
|
|
|
|
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o); |
|
|
|
|
else if(opt[0] == 'v' && avcodec_opts[AVMEDIA_TYPE_VIDEO]) |
|
|
|
|
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o); |
|
|
|
|
else if(opt[0] == 's' && avcodec_opts[AVMEDIA_TYPE_SUBTITLE]) |
|
|
|
|
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, &o); |
|
|
|
|
if (ret >= 0) |
|
|
|
|
opt += 1; |
|
|
|
|
} |
|
|
|
|
if (o && ret < 0) { |
|
|
|
|
fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
if (!o) { |
|
|
|
|
fprintf(stderr, "Unrecognized option '%s'\n", opt); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
out: |
|
|
|
|
if ((ret = opt_default2(opt, arg)) < 0) |
|
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avcodec_opts, opt, NULL), (int)av_get_int(avcodec_opts, opt, NULL));
|
|
|
|
|
|
|
|
|
|
opt_values= av_realloc(opt_values, sizeof(void*)*(opt_name_count+1)); |
|
|
|
|
opt_values[opt_name_count] = av_strdup(arg); |
|
|
|
|
opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); |
|
|
|
|
opt_names[opt_name_count++] = av_strdup(opt); |
|
|
|
|
|
|
|
|
|
if ((*avcodec_opts && avcodec_opts[0]->debug) || (avformat_opts && avformat_opts->debug)) |
|
|
|
|
av_log_set_level(AV_LOG_DEBUG); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
||||||| merged common ancestors |
|
|
|
|
int opt_default(const char *opt, const char *arg){ |
|
|
|
|
int type; |
|
|
|
|
int ret= 0; |
|
|
|
|
const AVOption *o= NULL; |
|
|
|
|
int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0}; |
|
|
|
|
|
|
|
|
|
for(type=0; *avcodec_opts && type<AVMEDIA_TYPE_NB && ret>= 0; type++){ |
|
|
|
|
const AVOption *o2 = av_opt_find(avcodec_opts[0], opt, NULL, opt_types[type], 0); |
|
|
|
|
if(o2) |
|
|
|
|
ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o); |
|
|
|
|
} |
|
|
|
|
if(!o && avformat_opts) |
|
|
|
|
ret = av_set_string3(avformat_opts, opt, arg, 1, &o); |
|
|
|
|
if(!o && sws_opts) |
|
|
|
|
ret = av_set_string3(sws_opts, opt, arg, 1, &o); |
|
|
|
|
if(!o){ |
|
|
|
|
if (opt[0] == 'a' && avcodec_opts[AVMEDIA_TYPE_AUDIO]) |
|
|
|
|
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o); |
|
|
|
|
else if(opt[0] == 'v' && avcodec_opts[AVMEDIA_TYPE_VIDEO]) |
|
|
|
|
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o); |
|
|
|
|
else if(opt[0] == 's' && avcodec_opts[AVMEDIA_TYPE_SUBTITLE]) |
|
|
|
|
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, &o); |
|
|
|
|
} |
|
|
|
|
if (o && ret < 0) { |
|
|
|
|
fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
if (!o) { |
|
|
|
|
AVCodec *p = NULL; |
|
|
|
|
AVOutputFormat *oformat = NULL; |
|
|
|
|
while ((p=av_codec_next(p))){ |
|
|
|
|
const AVClass *c = p->priv_class; |
|
|
|
|
if(c && av_opt_find(&c, opt, NULL, 0, 0)) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (!p) { |
|
|
|
|
while ((oformat = av_oformat_next(oformat))) { |
|
|
|
|
const AVClass *c = oformat->priv_class; |
|
|
|
|
if (c && av_opt_find(&c, opt, NULL, 0, 0)) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ((ret = opt_default2(opt, arg)) < 0) |
|
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avcodec_opts, opt, NULL), (int)av_get_int(avcodec_opts, opt, NULL));
|
|
|
|
|
|
|
|
|
|
//FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this
|
|
|
|
|
opt_values= av_realloc(opt_values, sizeof(void*)*(opt_name_count+1)); |
|
|
|
|
opt_values[opt_name_count]= o ? NULL : av_strdup(arg); |
|
|
|
|
opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); |
|
|
|
|
opt_names[opt_name_count++]= o ? o->name : av_strdup(opt); |
|
|
|
|
|
|
|
|
|
if ((*avcodec_opts && avcodec_opts[0]->debug) || (avformat_opts && avformat_opts->debug)) |
|
|
|
|
av_log_set_level(AV_LOG_DEBUG); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
======= |
|
|
|
|
>>>>>>> qatar/master |
|
|
|
|
#endif |
|
|
|
|
int opt_loglevel(const char *opt, const char *arg) |
|
|
|
|
{ |
|
|
|
|
const struct { const char *name; int level; } log_levels[] = { |
|
|
|
|