fftools, avfilter, avformat: Simplify check for "is dictionary empty?"

Reviewed-by: epirat07@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
release/7.1
Andreas Rheinhardt 6 months ago
parent 482afe8f3f
commit f3d206d25f
  1. 4
      fftools/ffmpeg.c
  2. 4
      fftools/ffplay.c
  3. 2
      fftools/ffprobe.c
  4. 4
      libavfilter/avfilter.c
  5. 2
      libavformat/aacdec.c
  6. 8
      libavformat/http.c
  7. 2
      libavformat/mpc.c
  8. 2
      libavformat/oggenc.c
  9. 2
      libavformat/wvdec.c

@ -484,8 +484,8 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b)
int check_avoptions(AVDictionary *m)
{
const AVDictionaryEntry *t;
if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
const AVDictionaryEntry *t = av_dict_iterate(m, NULL);
if (t) {
av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key);
return AVERROR_OPTION_NOT_FOUND;
}

@ -2694,7 +2694,7 @@ static int stream_component_open(VideoState *is, int stream_index)
if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) {
goto fail;
}
if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
if ((t = av_dict_iterate(opts, NULL))) {
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
ret = AVERROR_OPTION_NOT_FOUND;
goto fail;
@ -2862,7 +2862,7 @@ static int read_thread(void *arg)
if (scan_all_pmts_set)
av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
if ((t = av_dict_iterate(format_opts, NULL))) {
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
ret = AVERROR_OPTION_NOT_FOUND;
goto fail;

@ -3951,7 +3951,7 @@ static int open_input_file(InputFile *ifile, const char *filename,
exit(1);
}
if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
if ((t = av_dict_iterate(opts, NULL))) {
av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n",
t->key, stream->index);
return AVERROR_OPTION_NOT_FOUND;

@ -941,7 +941,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
int avfilter_init_str(AVFilterContext *filter, const char *args)
{
AVDictionary *options = NULL;
AVDictionaryEntry *e;
const AVDictionaryEntry *e;
int ret = 0;
if (args && *args) {
@ -954,7 +954,7 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
if (ret < 0)
goto fail;
if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
if ((e = av_dict_iterate(options, NULL))) {
av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key);
ret = AVERROR_OPTION_NOT_FOUND;
goto fail;

@ -119,7 +119,7 @@ static int adts_aac_read_header(AVFormatContext *s)
ff_id3v1_read(s);
if ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) &&
!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
!av_dict_count(s->metadata)) {
int64_t cur = avio_tell(s->pb);
ff_ape_parse_tag(s);
avio_seek(s->pb, cur, SEEK_SET);

@ -990,7 +990,7 @@ static int parse_set_cookie(const char *set_cookie, AVDictionary **dict)
static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
{
AVDictionary *new_params = NULL;
AVDictionaryEntry *e, *cookie_entry;
const AVDictionaryEntry *e, *cookie_entry;
char *eql, *name;
// ensure the cookie is parsable
@ -998,7 +998,7 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
return -1;
// if there is no cookie value there is nothing to parse
cookie_entry = av_dict_get(new_params, "", NULL, AV_DICT_IGNORE_SUFFIX);
cookie_entry = av_dict_iterate(new_params, NULL);
if (!cookie_entry || !cookie_entry->value) {
av_dict_free(&new_params);
return -1;
@ -1300,7 +1300,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
*cookies = NULL;
while ((cookie = av_strtok(next, "\n", &saveptr)) && !ret) {
AVDictionary *cookie_params = NULL;
AVDictionaryEntry *cookie_entry, *e;
const AVDictionaryEntry *cookie_entry, *e;
next = NULL;
// store the cookie in a dict in case it is updated in the response
@ -1312,7 +1312,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
goto skip_cookie;
// if the cookie has no value, skip it
cookie_entry = av_dict_get(cookie_params, "", NULL, AV_DICT_IGNORE_SUFFIX);
cookie_entry = av_dict_iterate(cookie_params, NULL);
if (!cookie_entry || !cookie_entry->value)
goto skip_cookie;

@ -112,7 +112,7 @@ static int mpc_read_header(AVFormatContext *s)
if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {
int64_t pos = avio_tell(s->pb);
ff_ape_parse_tag(s);
if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
if (av_dict_count(s->metadata) == 0)
ff_id3v1_read(s);
avio_seek(s->pb, pos, SEEK_SET);
}

@ -432,7 +432,7 @@ static int ogg_build_vp8_headers(AVFormatContext *s, AVStream *st,
bytestream_put_be32(&p, st->time_base.num);
/* optional second packet: VorbisComment */
if (av_dict_get(st->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
if (av_dict_count(st->metadata)) {
p = ogg_write_vorbiscomment(7, bitexact, &oggstream->header_len[1], &st->metadata, 0, NULL, 0);
if (!p)
return AVERROR(ENOMEM);

@ -268,7 +268,7 @@ static int wv_read_header(AVFormatContext *s)
if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {
int64_t cur = avio_tell(s->pb);
wc->apetag_start = ff_ape_parse_tag(s);
if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
if (av_dict_count(s->metadata) == 0)
ff_id3v1_read(s);
avio_seek(s->pb, cur, SEEK_SET);
}

Loading…
Cancel
Save