[FFmpeg-devel] [PATCH 4/6] libavfilter/: constify values from av_dict_get().
Chad Fraleigh
chadf at triularity.org
Tue Oct 19 01:27:19 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 7362bcdab5..9277aeea38 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -938,7 +938,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 b6fcb3b75e..d34dc52a6b 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 47e7d1fef8..fe7e294bf1 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 01c9f2abbb..f094b2b593 100644
--- a/libavfilter/vf_cover_rect.c
+++ b/libavfilter/vf_cover_rect.c
@@ -124,7 +124,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 2a88692cbd..14e6430368 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 44f85cb019..73bb3c0738 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -549,7 +549,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