forked from FFmpeg/FFmpeg
fftools/ffmpeg: return an error from assert_avoptions() instead of aborting
Rename it to check_avoptions().
This commit is contained in:
parent
eda1fac27a
commit
2f155b18a1
5 changed files with 17 additions and 6 deletions
|
@ -457,13 +457,15 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b)
|
|||
}
|
||||
}
|
||||
|
||||
void assert_avoptions(AVDictionary *m)
|
||||
int check_avoptions(AVDictionary *m)
|
||||
{
|
||||
const AVDictionaryEntry *t;
|
||||
if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key);
|
||||
exit_program(1);
|
||||
return AVERROR_OPTION_NOT_FOUND;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void update_benchmark(const char *fmt, ...)
|
||||
|
|
|
@ -704,7 +704,7 @@ void term_exit(void);
|
|||
void show_usage(void);
|
||||
|
||||
void remove_avoptions(AVDictionary **a, AVDictionary *b);
|
||||
void assert_avoptions(AVDictionary *m);
|
||||
int check_avoptions(AVDictionary *m);
|
||||
|
||||
int assert_file_overwrite(const char *filename);
|
||||
char *file_read(const char *filename);
|
||||
|
|
|
@ -1119,7 +1119,10 @@ int dec_open(InputStream *ist)
|
|||
av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
assert_avoptions(ist->decoder_opts);
|
||||
|
||||
ret = check_avoptions(ist->decoder_opts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = dec_thread_start(ist);
|
||||
if (ret < 0) {
|
||||
|
|
|
@ -1511,7 +1511,10 @@ int ifile_open(const OptionsContext *o, const char *filename)
|
|||
if (scan_all_pmts_set)
|
||||
av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
|
||||
remove_avoptions(&o->g->format_opts, o->g->codec_opts);
|
||||
assert_avoptions(o->g->format_opts);
|
||||
|
||||
ret = check_avoptions(o->g->format_opts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* apply forced codec ids */
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
|
|
|
@ -407,7 +407,10 @@ int enc_open(OutputStream *ost, AVFrame *frame)
|
|||
ost->sq_idx_encode, ost->enc_ctx->frame_size);
|
||||
}
|
||||
|
||||
assert_avoptions(ost->encoder_opts);
|
||||
ret = check_avoptions(ost->encoder_opts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000 &&
|
||||
ost->enc_ctx->codec_id != AV_CODEC_ID_CODEC2 /* don't complain about 700 bit/s modes */)
|
||||
av_log(ost, AV_LOG_WARNING, "The bitrate parameter is set too low."
|
||||
|
|
Loading…
Add table
Reference in a new issue