History

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

Andreas Rheinhardt committed 2 years ago

Commit f3d206d1 parent 482afe89 files · +15 −15Browse files

Unified · Split

9 files
  1. fftools/ffmpeg.c +2 −2
  2. fftools/ffplay.c +2 −2
  3. fftools/ffprobe.c +1 −1
  4. libavfilter/avfilter.c +2 −2
  5. libavformat/aacdec.c +1 −1
  6. libavformat/http.c +4 −4
  7. libavformat/mpc.c +1 −1
  8. libavformat/oggenc.c +1 −1
  9. libavformat/wvdec.c +1 −1
fftools/ffmpeg.c+2−2
@@ -484,8 +484,8 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b) · 483 unmodified lines
484484
485485 int check_avoptions(AVDictionary *m)
486486 {
487− const AVDictionaryEntry *t;
488− if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
487+ const AVDictionaryEntry *t = av_dict_iterate(m, NULL);
488+ if (t) {
489489 av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key);
490490 return AVERROR_OPTION_NOT_FOUND;
491491 }
fftools/ffplay.c+2−2
@@ -2694,7 +2694,7 @@ static int stream_component_open(VideoState *is, int stream_index) · 2693 unmodified lines
26942694 if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) {
26952695 goto fail;
26962696 }
2697− if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
2697+ if ((t = av_dict_iterate(opts, NULL))) {
26982698 av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
26992699 ret = AVERROR_OPTION_NOT_FOUND;
27002700 goto fail;
@@ -2862,7 +2862,7 @@ static int read_thread(void *arg) · 161 unmodified lines
28622862 if (scan_all_pmts_set)
28632863 av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
28642864
2865− if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
2865+ if ((t = av_dict_iterate(format_opts, NULL))) {
28662866 av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
28672867 ret = AVERROR_OPTION_NOT_FOUND;
28682868 goto fail;
fftools/ffprobe.c+1−1
@@ -3951,7 +3951,7 @@ static int open_input_file(InputFile *ifile, const char *filename, · 3950 unmodified lines
39513951 exit(1);
39523952 }
39533953
3954− if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
3954+ if ((t = av_dict_iterate(opts, NULL))) {
39553955 av_log(NULL, AV_LOG_ERROR, "Option %s for input stream %d not found\n",
39563956 t->key, stream->index);
39573957 return AVERROR_OPTION_NOT_FOUND;
libavfilter/avfilter.c+2−2
@@ -941,7 +941,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) · 940 unmodified lines
941941 int avfilter_init_str(AVFilterContext *filter, const char *args)
942942 {
943943 AVDictionary *options = NULL;
944− AVDictionaryEntry *e;
944+ const AVDictionaryEntry *e;
945945 int ret = 0;
946946
947947 if (args && *args) {
@@ -954,7 +954,7 @@ int avfilter_init_str(AVFilterContext *filter, const char *args) · 6 unmodified lines
954954 if (ret < 0)
955955 goto fail;
956956
957− if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
957+ if ((e = av_dict_iterate(options, NULL))) {
958958 av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key);
959959 ret = AVERROR_OPTION_NOT_FOUND;
960960 goto fail;
libavformat/aacdec.c+1−1
@@ -119,7 +119,7 @@ static int adts_aac_read_header(AVFormatContext *s) · 118 unmodified lines
119119
120120 ff_id3v1_read(s);
121121 if ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) &&
122− !av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
122+ !av_dict_count(s->metadata)) {
123123 int64_t cur = avio_tell(s->pb);
124124 ff_ape_parse_tag(s);
125125 avio_seek(s->pb, cur, SEEK_SET);
libavformat/http.c+4−4
@@ -990,7 +990,7 @@ static int parse_set_cookie(const char *set_cookie, AVDictionary **dict) · 989 unmodified lines
990990 static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
991991 {
992992 AVDictionary *new_params = NULL;
993− AVDictionaryEntry *e, *cookie_entry;
993+ const AVDictionaryEntry *e, *cookie_entry;
994994 char *eql, *name;
995995
996996 // ensure the cookie is parsable
@@ -998,7 +998,7 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies) · 1 unmodified line
998998 return -1;
999999
10001000 // if there is no cookie value there is nothing to parse
1001− cookie_entry = av_dict_get(new_params, "", NULL, AV_DICT_IGNORE_SUFFIX);
1001+ cookie_entry = av_dict_iterate(new_params, NULL);
10021002 if (!cookie_entry || !cookie_entry->value) {
10031003 av_dict_free(&new_params);
10041004 return -1;
@@ -1300,7 +1300,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path, · 295 unmodified lines
13001300 *cookies = NULL;
13011301 while ((cookie = av_strtok(next, "\n", &saveptr)) && !ret) {
13021302 AVDictionary *cookie_params = NULL;
1303− AVDictionaryEntry *cookie_entry, *e;
1303+ const AVDictionaryEntry *cookie_entry, *e;
13041304
13051305 next = NULL;
13061306 // 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, · 5 unmodified lines
13121312 goto skip_cookie;
13131313
13141314 // if the cookie has no value, skip it
1315− cookie_entry = av_dict_get(cookie_params, "", NULL, AV_DICT_IGNORE_SUFFIX);
1315+ cookie_entry = av_dict_iterate(cookie_params, NULL);
13161316 if (!cookie_entry || !cookie_entry->value)
13171317 goto skip_cookie;
13181318
libavformat/mpc.c+1−1
@@ -112,7 +112,7 @@ static int mpc_read_header(AVFormatContext *s) · 111 unmodified lines
112112 if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {
113113 int64_t pos = avio_tell(s->pb);
114114 ff_ape_parse_tag(s);
115− if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
115+ if (av_dict_count(s->metadata) == 0)
116116 ff_id3v1_read(s);
117117 avio_seek(s->pb, pos, SEEK_SET);
118118 }
libavformat/oggenc.c+1−1
@@ -432,7 +432,7 @@ static int ogg_build_vp8_headers(AVFormatContext *s, AVStream *st, · 431 unmodified lines
432432 bytestream_put_be32(&p, st->time_base.num);
433433
434434 /* optional second packet: VorbisComment */
435− if (av_dict_get(st->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
435+ if (av_dict_count(st->metadata)) {
436436 p = ogg_write_vorbiscomment(7, bitexact, &oggstream->header_len[1], &st->metadata, 0, NULL, 0);
437437 if (!p)
438438 return AVERROR(ENOMEM);
libavformat/wvdec.c+1−1
@@ -268,7 +268,7 @@ static int wv_read_header(AVFormatContext *s) · 267 unmodified lines
268268 if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {
269269 int64_t cur = avio_tell(s->pb);
270270 wc->apetag_start = ff_ape_parse_tag(s);
271− if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
271+ if (av_dict_count(s->metadata) == 0)
272272 ff_id3v1_read(s);
273273 avio_seek(s->pb, cur, SEEK_SET);
274274 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t