diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-25 05:02:39 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-02 08:20:10 +0100 |
commit | 988deae6da70e3c24d8e75d75e300e49981599b7 (patch) | |
tree | 3df96584ffa6bab6affaa61132ec83d2dff53068 /fftools/cmdutils.c | |
parent | c17915fd64f7e5d138820681c58c84b047336f13 (diff) |
fftools: Switch to const AVCodec * where possible
The obstacle to do so was in filter_codec_opts: It uses searches
the AVCodec for options via the AV_OPT_SEARCH_FAKE_OBJ method, which
requires using a void * that points to a pointer to a const AVClass.
When using const AVCodec *, one can not simply use a pointer that points
to the AVCodec's pointer to its AVClass, as said pointer is const, too.
This is fixed by using a temporary pointer to the AVClass.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'fftools/cmdutils.c')
-rw-r--r-- | fftools/cmdutils.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index fe253d10a4..8cfca22564 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -2101,7 +2101,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec) } AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, - AVFormatContext *s, AVStream *st, AVCodec *codec) + AVFormatContext *s, AVStream *st, const AVCodec *codec) { AVDictionary *ret = NULL; AVDictionaryEntry *t = NULL; @@ -2130,6 +2130,7 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, } while (t = av_dict_get(opts, "", t, AV_DICT_IGNORE_SUFFIX)) { + const AVClass *priv_class; char *p = strchr(t->key, ':'); /* check stream specification in opt name */ @@ -2142,8 +2143,8 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, if (av_opt_find(&cc, t->key, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ) || !codec || - (codec->priv_class && - av_opt_find(&codec->priv_class, t->key, NULL, flags, + ((priv_class = codec->priv_class) && + av_opt_find(&priv_class, t->key, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ))) av_dict_set(&ret, t->key, t->value, 0); else if (t->key[0] == prefix && |