[FFmpeg-devel] [PATCH 4/6] libavfilter/: constify values from av_dict_get().
Chad Fraleigh
chadf at triularity.org
Tue Oct 19 00:32:16 EEST 2021
Treat values returned from av_dict_get() as const, since they are internal to AVDictionary.
Signed-off-by: Chad Fraleigh <chadf at triularity.org>
---
libavfilter/avfilter.c | 2 +-
libavfilter/f_bench.c | 2 +-
libavfilter/f_drawgraph.c | 2 +-
libavfilter/f_metadata.c | 2 +-
libavfilter/f_select.c | 4 ++--
libavfilter/vf_cover_rect.c | 2 +-
libavfilter/vf_drawtext.c | 2 +-
libavfilter/vf_scale.c | 2 +-
8 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index f325918021..c0573d53c9 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -939,7 +939,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) {
diff --git a/libavfilter/f_bench.c b/libavfilter/f_bench.c
index f7098adaf4..16ca17723b 100644
--- a/libavfilter/f_bench.c
+++ b/libavfilter/f_bench.c
@@ -69,7 +69,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
if (s->action == ACTION_START) {
av_dict_set_int(&in->metadata, START_TIME_KEY, t, 0);
} else if (s->action == ACTION_STOP) {
- AVDictionaryEntry *e = av_dict_get(in->metadata, START_TIME_KEY, NULL, 0);
+ const AVDictionaryEntry *e = av_dict_get(in->metadata, START_TIME_KEY, NULL, 0);
if (e) {
const int64_t start = strtoll(e->value, NULL, 0);
const int64_t diff = t - start;
diff --git a/libavfilter/f_drawgraph.c b/libavfilter/f_drawgraph.c
index 9996eb3b0e..7cc1efb3d7 100644
--- a/libavfilter/f_drawgraph.c
+++ b/libavfilter/f_drawgraph.c
@@ -163,7 +163,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
DrawGraphContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
AVDictionary *metadata;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
AVFrame *out = s->out;
AVFrame *clone = NULL;
int64_t in_pts, out_pts;
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index cecfe62a9c..ee87a2b37f 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -306,7 +306,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVFilterLink *outlink = ctx->outputs[0];
MetadataContext *s = ctx->priv;
AVDictionary **metadata = &frame->metadata;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
!s->key ? AV_DICT_IGNORE_SUFFIX: 0);
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 187e98a1a7..ab26676e57 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -304,8 +304,8 @@ static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
static double get_concatdec_select(AVFrame *frame, int64_t pts)
{
AVDictionary *metadata = frame->metadata;
- AVDictionaryEntry *start_time_entry = av_dict_get(metadata, "lavf.concatdec.start_time", NULL, 0);
- AVDictionaryEntry *duration_entry = av_dict_get(metadata, "lavf.concatdec.duration", NULL, 0);
+ const AVDictionaryEntry *start_time_entry = av_dict_get(metadata, "lavf.concatdec.start_time", NULL, 0);
+ const AVDictionaryEntry *duration_entry = av_dict_get(metadata, "lavf.concatdec.duration", NULL, 0);
if (start_time_entry) {
int64_t start_time = strtoll(start_time_entry->value, NULL, 10);
if (pts >= start_time) {
diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c
index 0a8c10e06d..d3a9755234 100644
--- a/libavfilter/vf_cover_rect.c
+++ b/libavfilter/vf_cover_rect.c
@@ -135,7 +135,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterContext *ctx = inlink->dst;
CoverContext *cover = ctx->priv;
- AVDictionaryEntry *ex, *ey, *ew, *eh;
+ const AVDictionaryEntry *ex, *ey, *ew, *eh;
int x = -1, y = -1, w = -1, h = -1;
char *xendptr = NULL, *yendptr = NULL, *wendptr = NULL, *hendptr = NULL;
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index b1ea58f30a..197163f426 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1032,7 +1032,7 @@ static int func_metadata(AVFilterContext *ctx, AVBPrint *bp,
char *fct, unsigned argc, char **argv, int tag)
{
DrawTextContext *s = ctx->priv;
- AVDictionaryEntry *e = av_dict_get(s->metadata, argv[0], NULL, 0);
+ const AVDictionaryEntry *e = av_dict_get(s->metadata, argv[0], NULL, 0);
if (e && e->value)
av_bprintf(bp, "%s", e->value);
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index a1902a13cf..698fbc4768 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -551,7 +551,7 @@ static int config_props(AVFilterLink *outlink)
scale->out_range == AVCOL_RANGE_JPEG, 0);
if (scale->opts) {
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) {
if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0)
return ret;
--
2.25.1
More information about the ffmpeg-devel
mailing list