aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-25 07:45:51 +0100
committerJames Almer <jamrial@gmail.com>2021-04-27 10:43:14 -0300
commit626535f6a169e2d821b969e0ea77125ba7482113 (patch)
treebfab6bbc7157ec5163ed8ae3bf3978f74f4fdd3e /libavcodec
parent14fa0a4efbc989619860ed8ec0fd33dcdae558b0 (diff)
downloadffmpeg-626535f6a169e2d821b969e0ea77125ba7482113.tar.gz
avcodec/codec, allcodecs: Constify the AVCodec API
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/allcodecs.c18
-rw-r--r--libavcodec/codec.h8
2 files changed, 13 insertions, 13 deletions
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 92b5d120f3..c33d5a5261 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -873,7 +873,7 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
}
}
-static AVCodec *find_codec(enum AVCodecID id, int (*x)(const AVCodec *))
+static const AVCodec *find_codec(enum AVCodecID id, int (*x)(const AVCodec *))
{
const AVCodec *p, *experimental = NULL;
void *i = 0;
@@ -887,24 +887,24 @@ static AVCodec *find_codec(enum AVCodecID id, int (*x)(const AVCodec *))
if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) {
experimental = p;
} else
- return (AVCodec*)p;
+ return p;
}
}
- return (AVCodec*)experimental;
+ return experimental;
}
-AVCodec *avcodec_find_encoder(enum AVCodecID id)
+const AVCodec *avcodec_find_encoder(enum AVCodecID id)
{
return find_codec(id, av_codec_is_encoder);
}
-AVCodec *avcodec_find_decoder(enum AVCodecID id)
+const AVCodec *avcodec_find_decoder(enum AVCodecID id)
{
return find_codec(id, av_codec_is_decoder);
}
-static AVCodec *find_codec_by_name(const char *name, int (*x)(const AVCodec *))
+static const AVCodec *find_codec_by_name(const char *name, int (*x)(const AVCodec *))
{
void *i = 0;
const AVCodec *p;
@@ -916,18 +916,18 @@ static AVCodec *find_codec_by_name(const char *name, int (*x)(const AVCodec *))
if (!x(p))
continue;
if (strcmp(name, p->name) == 0)
- return (AVCodec*)p;
+ return p;
}
return NULL;
}
-AVCodec *avcodec_find_encoder_by_name(const char *name)
+const AVCodec *avcodec_find_encoder_by_name(const char *name)
{
return find_codec_by_name(name, av_codec_is_encoder);
}
-AVCodec *avcodec_find_decoder_by_name(const char *name)
+const AVCodec *avcodec_find_decoder_by_name(const char *name)
{
return find_codec_by_name(name, av_codec_is_decoder);
}
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index c95078491d..c8653e3b31 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -367,7 +367,7 @@ const AVCodec *av_codec_iterate(void **opaque);
* @param id AVCodecID of the requested decoder
* @return A decoder if one was found, NULL otherwise.
*/
-AVCodec *avcodec_find_decoder(enum AVCodecID id);
+const AVCodec *avcodec_find_decoder(enum AVCodecID id);
/**
* Find a registered decoder with the specified name.
@@ -375,7 +375,7 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id);
* @param name name of the requested decoder
* @return A decoder if one was found, NULL otherwise.
*/
-AVCodec *avcodec_find_decoder_by_name(const char *name);
+const AVCodec *avcodec_find_decoder_by_name(const char *name);
/**
* Find a registered encoder with a matching codec ID.
@@ -383,7 +383,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name);
* @param id AVCodecID of the requested encoder
* @return An encoder if one was found, NULL otherwise.
*/
-AVCodec *avcodec_find_encoder(enum AVCodecID id);
+const AVCodec *avcodec_find_encoder(enum AVCodecID id);
/**
* Find a registered encoder with the specified name.
@@ -391,7 +391,7 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id);
* @param name name of the requested encoder
* @return An encoder if one was found, NULL otherwise.
*/
-AVCodec *avcodec_find_encoder_by_name(const char *name);
+const AVCodec *avcodec_find_encoder_by_name(const char *name);
/**
* @return a non-zero number if codec is an encoder, zero otherwise
*/