| 186 | } |
| 187 | |
| 188 | int opt_default(const char *opt, const char *arg){ |
| 189 | int type; |
| 190 | int ret= 0; |
| 191 | const AVOption *o= NULL; |
| 192 | int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0}; |
| 193 | |
| 194 | for(type=0; type<AVMEDIA_TYPE_NB && ret>= 0; type++){ |
| 195 | const AVOption *o2 = av_find_opt(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]); |
| 196 | if(o2) |
| 197 | ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o); |
| 198 | } |
| 199 | if(!o) |
| 200 | ret = av_set_string3(avformat_opts, opt, arg, 1, &o); |
| 201 | if(!o && sws_opts) |
| 202 | ret = av_set_string3(sws_opts, opt, arg, 1, &o); |
| 203 | if(!o){ |
| 204 | if(opt[0] == 'a') |
| 205 | ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o); |
| 206 | else if(opt[0] == 'v') |
| 207 | ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o); |
| 208 | else if(opt[0] == 's') |
| 209 | ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, &o); |
| 210 | } |
| 211 | if (o && ret < 0) { |
| 212 | fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt); |
| 213 | exit(1); |
| 214 | } |
| 215 | if (!o) { |
| 216 | fprintf(stderr, "Unrecognized option '%s'\n", opt); |
| 217 | exit(1); |
| 218 | } |
| 219 | |
| 220 | // 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)); |
| 221 | |
| 222 | //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 |
| 223 | opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); |
| 224 | opt_names[opt_name_count++]= o->name; |
| 225 | |
| 226 | if(avcodec_opts[0]->debug || avformat_opts->debug) |
| 227 | av_log_set_level(AV_LOG_DEBUG); |
| 228 | return 0; |
| 229 | } |
| 230 | |
| 231 | int opt_loglevel(const char *opt, const char *arg) |
| 232 | { |
no test coverage detected