[FFmpeg-devel] [PATCH 73/87] avformat/avformat: Constify AVFormatContext.*_codec pointers
James Almer
jamrial at gmail.com
Mon Apr 19 17:10:10 EEST 2021
From: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
This also allows to exclusively use pointers to const AVCodec in
fftools/ffmpeg_opt.c.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
doc/APIchanges | 3 +++
fftools/ffmpeg_opt.c | 4 ++--
libavformat/avformat.h | 8 ++++----
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index e9fa7ddf64..2522978952 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -17,6 +17,9 @@ API changes, most recent first:
2021-04-17 - xxxxxxxxxx - lavu 56.73.100 - frame.h detection_bbox.h
Add AV_FRAME_DATA_DETECTION_BBOXES
+2021-04-14 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h
+ Constified AVFormatContext.*_codec.
+
2021-04-14 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h
Constified the pointers to AVInputFormats and AVOutputFormats
in AVFormatContext, avformat_alloc_output_context2(),
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 9e26de5a94..e66141f3ab 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -737,11 +737,11 @@ static int opt_recording_timestamp(void *optctx, const char *opt, const char *ar
return 0;
}
-static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
+static const AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
{
const AVCodecDescriptor *desc;
const char *codec_string = encoder ? "encoder" : "decoder";
- AVCodec *codec;
+ const AVCodec *codec;
codec = encoder ?
avcodec_find_encoder_by_name(name) :
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3834c9869f..23bdaa207b 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1598,7 +1598,7 @@ typedef struct AVFormatContext {
* the same codec_id.
* Demuxing: Set by user
*/
- AVCodec *video_codec;
+ const AVCodec *video_codec;
/**
* Forced audio codec.
@@ -1606,7 +1606,7 @@ typedef struct AVFormatContext {
* the same codec_id.
* Demuxing: Set by user
*/
- AVCodec *audio_codec;
+ const AVCodec *audio_codec;
/**
* Forced subtitle codec.
@@ -1614,7 +1614,7 @@ typedef struct AVFormatContext {
* the same codec_id.
* Demuxing: Set by user
*/
- AVCodec *subtitle_codec;
+ const AVCodec *subtitle_codec;
/**
* Forced data codec.
@@ -1622,7 +1622,7 @@ typedef struct AVFormatContext {
* the same codec_id.
* Demuxing: Set by user
*/
- AVCodec *data_codec;
+ const AVCodec *data_codec;
/**
* Number of bytes to be written as padding in a metadata header.
--
2.31.1
More information about the ffmpeg-devel
mailing list