[FFmpeg-devel] [PATCH 5/6] libavformat/: constify values from av_dict_get().
Chad Fraleigh
chadf at triularity.org
Tue Oct 19 00:32:29 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>
---
libavformat/aiffenc.c | 2 +-
libavformat/apetag.c | 2 +-
libavformat/asfenc.c | 8 +++----
libavformat/au.c | 2 +-
libavformat/avidec.c | 2 +-
libavformat/avienc.c | 2 +-
libavformat/avio.c | 4 ++--
libavformat/cafenc.c | 2 +-
libavformat/dashenc.c | 6 ++---
libavformat/dvenc.c | 2 +-
libavformat/ffmetaenc.c | 2 +-
libavformat/fifo.c | 2 +-
libavformat/flacdec.c | 2 +-
libavformat/flacenc.c | 4 ++--
libavformat/flvdec.c | 2 +-
libavformat/flvenc.c | 2 +-
libavformat/gxfenc.c | 2 +-
libavformat/hls.c | 4 ++--
libavformat/http.c | 8 +++----
libavformat/id3v2.c | 6 ++---
libavformat/id3v2enc.c | 8 +++----
libavformat/matroskadec.c | 2 +-
libavformat/metadata.c | 2 +-
libavformat/mov.c | 6 ++---
libavformat/movenc.c | 44 ++++++++++++++++++-------------------
libavformat/mp3enc.c | 6 ++---
libavformat/mpegtsenc.c | 6 ++---
libavformat/mux.c | 2 +-
libavformat/mxfenc.c | 14 ++++++------
libavformat/nutenc.c | 6 ++---
libavformat/riffenc.c | 2 +-
libavformat/rmenc.c | 2 +-
libavformat/sapenc.c | 2 +-
libavformat/sdp.c | 2 +-
libavformat/segment.c | 4 ++--
libavformat/smjpegenc.c | 2 +-
libavformat/soxenc.c | 2 +-
libavformat/ttmlenc.c | 2 +-
libavformat/utils.c | 4 ++--
libavformat/vorbiscomment.c | 6 ++---
libavformat/wavenc.c | 4 ++--
libavformat/webmdashenc.c | 28 +++++++++++------------
libavformat/wtvenc.c | 4 ++--
43 files changed, 113 insertions(+), 113 deletions(-)
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 24bc17400e..1f8e0dd670 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -82,7 +82,7 @@ static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff)
static void put_meta(AVFormatContext *s, const char *key, uint32_t id)
{
- AVDictionaryEntry *tag;
+ const AVDictionaryEntry *tag;
AVIOContext *pb = s->pb;
if (tag = av_dict_get(s->metadata, key, NULL, 0)) {
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 6f82fbe202..d94356f5a0 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -174,7 +174,7 @@ static int string_is_ascii(const uint8_t *str)
int ff_ape_write_tag(AVFormatContext *s)
{
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
int size, ret, count = 0;
AVIOContext *dyn_bc;
uint8_t *dyn_buf;
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index a0510df7dc..8632877117 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -355,7 +355,7 @@ static int asf_write_markers(AVFormatContext *s)
for (unsigned i = 0; i < s->nb_chapters; i++) {
AVChapter *c = s->chapters[i];
- AVDictionaryEntry *t = av_dict_get(c->metadata, "title", NULL, 0);
+ const AVDictionaryEntry *t = av_dict_get(c->metadata, "title", NULL, 0);
int64_t pres_time = av_rescale_q(c->start, c->time_base, scale);
uint64_t offset;
int32_t send_time = get_send_time(asf, pres_time, &offset);
@@ -389,7 +389,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
{
ASFContext *asf = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *tags[5];
+ const AVDictionaryEntry *tags[5];
int header_size, extra_size, extra_size2, wav_extra_size;
int has_title, has_aspect_ratio = 0;
int metadata_count;
@@ -420,7 +420,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
for (unsigned n = 0; n < s->nb_streams; n++) {
AVStream *const st = s->streams[n];
AVCodecParameters *const par = st->codecpar;
- AVDictionaryEntry *entry;
+ const AVDictionaryEntry *entry;
avpriv_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */
@@ -599,7 +599,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
end_header(pb, hpos);
}
if (metadata_count) {
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
hpos = put_header(pb, &ff_asf_extended_content_header);
avio_wl16(pb, metadata_count);
while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
diff --git a/libavformat/au.c b/libavformat/au.c
index 9bd408f65c..a408e55e36 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -258,7 +258,7 @@ static int au_get_annotations(AVFormatContext *s, AVBPrint *annotations)
};
int cnt = 0;
AVDictionary *m = s->metadata;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
for (int i = 0; i < FF_ARRAY_ELEMS(keys); i++) {
t = av_dict_get(m, keys[i], NULL, 0);
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index b09a715d86..8bf0d3a1fe 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -491,7 +491,7 @@ static int avi_read_header(AVFormatContext *s)
uint64_t list_end = 0;
int64_t pos;
int ret;
- AVDictionaryEntry *dict_entry;
+ const AVDictionaryEntry *dict_entry;
avi->stream_index = -1;
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 3b11841cd3..0d01a45d0a 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -263,7 +263,7 @@ static int avi_write_header(AVFormatContext *s)
AVCodecParameters *video_par;
AVStream *video_st = NULL;
int64_t list1, list2, strh, strf;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int padding;
if (s->nb_streams > AVI_MAX_STREAM_COUNT) {
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 4846bbd8c6..2e45c5b5d1 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -167,7 +167,7 @@ int ffurl_connect(URLContext *uc, AVDictionary **options)
{
int err;
AVDictionary *tmp_opts = NULL;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
if (!options)
options = &tmp_opts;
@@ -309,7 +309,7 @@ int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags,
URLContext *parent)
{
AVDictionary *tmp_opts = NULL;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
int ret = ffurl_alloc(puc, filename, flags, int_cb);
if (ret < 0)
return ret;
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 412b3230e3..8a06e5a46b 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -106,7 +106,7 @@ static int caf_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
AVCodecParameters *par = s->streams[0]->codecpar;
CAFContext *caf = s->priv_data;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, par->codec_id);
int64_t chunk_size = 0;
int frame_size = par->frame_size;
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 06bbf36c95..a8ba8ec2ac 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -794,7 +794,7 @@ static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_ind
{
DASHContext *c = s->priv_data;
AdaptationSet *as = &c->as[as_index];
- AVDictionaryEntry *lang, *role;
+ const AVDictionaryEntry *lang, *role;
int i;
avio_printf(out, "\t\t<AdaptationSet id=\"%d\" contentType=\"%s\" startWithSAP=\"1\" segmentAlignment=\"true\" bitstreamSwitching=\"true\"",
@@ -1138,7 +1138,7 @@ static int write_manifest(AVFormatContext *s, int final)
const char *proto = avio_find_protocol_name(s->url);
int use_rename = proto && !strcmp(proto, "file");
static unsigned int warned_non_file = 0;
- AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
+ const AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
AVDictionary *opts = NULL;
if (!use_rename && !warned_non_file++)
@@ -1366,7 +1366,7 @@ static int write_manifest(AVFormatContext *s, int final)
static int dict_copy_entry(AVDictionary **dst, const AVDictionary *src, const char *key)
{
- AVDictionaryEntry *entry = av_dict_get(src, key, NULL, 0);
+ const AVDictionaryEntry *entry = av_dict_get(src, key, NULL, 0);
if (entry)
av_dict_set(dst, key, entry->value, AV_DICT_DONT_OVERWRITE);
return 0;
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 9a853ba7ce..7061be656d 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -384,7 +384,7 @@ static int dv_write_header(AVFormatContext *s)
{
AVRational rate;
DVMuxContext *dvc = s->priv_data;
- AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
+ const AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
if (!dv_init_mux(s)) {
av_log(s, AV_LOG_ERROR, "Can't initialize DV format!\n"
diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c
index edd66e1a04..1d72b43b86 100644
--- a/libavformat/ffmetaenc.c
+++ b/libavformat/ffmetaenc.c
@@ -40,7 +40,7 @@ static void write_escape_str(AVIOContext *s, const uint8_t *str)
static void write_tags(AVIOContext *s, AVDictionary *m)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
write_escape_str(s, t->key);
avio_w8(s, '=');
diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index 51d7fa5b94..e9d73cb4d4 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -147,7 +147,7 @@ static int fifo_thread_write_header(FifoThreadContext *ctx)
// Check for options unrecognized by underlying muxer
if (format_options) {
- AVDictionaryEntry *entry = NULL;
+ const AVDictionaryEntry *entry = NULL;
while ((entry = av_dict_get(format_options, "", entry, AV_DICT_IGNORE_SUFFIX)))
av_log(avf2, AV_LOG_ERROR, "Unknown option '%s'\n", entry->key);
ret = AVERROR(EINVAL);
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 04d3cadf1c..826ccbe303 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -173,7 +173,7 @@ static int flac_read_header(AVFormatContext *s)
}
/* process supported blocks other than STREAMINFO */
if (metadata_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
- AVDictionaryEntry *chmask;
+ const AVDictionaryEntry *chmask;
ret = ff_vorbis_comment(s, &s->metadata, buffer, metadata_size, 1);
if (ret < 0) {
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 44c9341493..70e120e291 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -83,7 +83,7 @@ static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt)
AVIOContext *pb = s->pb;
const AVPixFmtDescriptor *pixdesc;
const CodecMime *mime = ff_id3v2_mime_tags;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
const char *mimetype = NULL, *desc = "";
const AVStream *st = s->streams[pkt->stream_index];
int i, mimelen, desclen, type = 0, blocklen;
@@ -241,7 +241,7 @@ static int flac_init(struct AVFormatContext *s)
if (par->channel_layout &&
!(par->channel_layout & ~0x3ffffULL) &&
!ff_flac_is_native_layout(par->channel_layout)) {
- AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
+ const AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0);
if (chmask) {
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 44a7e5f93c..d9567f4e21 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -1267,7 +1267,7 @@ retry_duration:
}
if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC ||
st->codecpar->codec_id == AV_CODEC_ID_H264)) {
- AVDictionaryEntry *t;
+ const AVDictionaryEntry *t;
if (st->codecpar->extradata) {
if ((ret = flv_queue_extradata(flv, s->pb, stream_type, size)) < 0)
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 3f24c7e192..78f4433ee9 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -278,7 +278,7 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
int write_duration_filesize = !(flv->flags & FLV_NO_DURATION_FILESIZE);
int metadata_count = 0;
int64_t metadata_count_pos;
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
/* write meta_tag */
avio_w8(pb, FLV_TAG_TYPE_META); // tag type META
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 8cc3bd456e..1053126b32 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -689,7 +689,7 @@ static int gxf_write_header(AVFormatContext *s)
uint8_t tracks[255] = {0};
int i, media_info = 0;
int ret;
- AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
+ const AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) {
av_log(s, AV_LOG_ERROR, "gxf muxer does not support streamed output, patch welcome\n");
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 9fd4ad9f32..4a9fc55fa8 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1063,8 +1063,8 @@ static void parse_id3(AVFormatContext *s, AVIOContext *pb,
static int id3_has_changed_values(struct playlist *pls, AVDictionary *metadata,
ID3v2ExtraMetaAPIC *apic)
{
- AVDictionaryEntry *entry = NULL;
- AVDictionaryEntry *oldentry;
+ const AVDictionaryEntry *entry = NULL;
+ const AVDictionaryEntry *oldentry;
/* check that no keys have changed values */
while ((entry = av_dict_get(metadata, "", entry, AV_DICT_IGNORE_SUFFIX))) {
oldentry = av_dict_get(pls->id3_initial, entry->key, NULL, AV_DICT_MATCH_CASE);
diff --git a/libavformat/http.c b/libavformat/http.c
index 476b9a8456..a1372b585a 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -883,7 +883,7 @@ static int parse_set_cookie(const char *set_cookie, AVDictionary **dict)
static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
{
AVDictionary *new_params = NULL;
- AVDictionaryEntry *e, *cookie_entry;
+ const AVDictionaryEntry *e, *cookie_entry;
char *eql, *name;
// ensure the cookie is parsable
@@ -901,7 +901,7 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
if ((e = av_dict_get(new_params, "expires", NULL, 0)) && e->value) {
struct tm new_tm = {0};
if (!parse_set_cookie_expiry_time(e->value, &new_tm)) {
- AVDictionaryEntry *e2;
+ const AVDictionaryEntry *e2;
// if the cookie has already expired ignore it
if (av_timegm(&new_tm) < av_gettime() / 1000000) {
@@ -944,7 +944,7 @@ static int parse_cookie(HTTPContext *s, const char *p, AVDictionary **cookies)
static int cookie_string(AVDictionary *dict, char **cookies)
{
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
int len = 1;
// determine how much memory is needed for the cookies string
@@ -1141,7 +1141,7 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
*cookies = NULL;
while ((cookie = av_strtok(next, "\n", &saveptr)) && !ret) {
AVDictionary *cookie_params = NULL;
- AVDictionaryEntry *cookie_entry, *e;
+ const AVDictionaryEntry *cookie_entry, *e;
next = NULL;
// store the cookie in a dict in case it is updated in the response
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index ff27c062e5..cc4f103614 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -535,9 +535,9 @@ static int is_number(const char *str)
return !*str;
}
-static AVDictionaryEntry *get_date_tag(AVDictionary *m, const char *tag)
+static const AVDictionaryEntry *get_date_tag(AVDictionary *m, const char *tag)
{
- AVDictionaryEntry *t;
+ const AVDictionaryEntry *t;
if ((t = av_dict_get(m, tag, NULL, AV_DICT_MATCH_CASE)) &&
strlen(t->value) == 4 && is_number(t->value))
return t;
@@ -546,7 +546,7 @@ static AVDictionaryEntry *get_date_tag(AVDictionary *m, const char *tag)
static void merge_date(AVDictionary **m)
{
- AVDictionaryEntry *t;
+ const AVDictionaryEntry *t;
char date[17] = { 0 }; // YYYY-MM-DD hh:mm
if (!(t = get_date_tag(*m, "TYER")) &&
diff --git a/libavformat/id3v2enc.c b/libavformat/id3v2enc.c
index 5d821ea4db..fbfc5ff82b 100644
--- a/libavformat/id3v2enc.c
+++ b/libavformat/id3v2enc.c
@@ -149,7 +149,7 @@ static int id3v2_put_priv(ID3v2EncContext *id3, AVIOContext *avioc, const char *
return len + ID3v2_HEADER_SIZE;
}
-static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictionaryEntry *t,
+static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, const AVDictionaryEntry *t,
const char table[][4], enum ID3v2Encoding enc)
{
uint32_t tag;
@@ -166,7 +166,7 @@ static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictio
static void id3v2_3_metadata_split_date(AVDictionary **pm)
{
- AVDictionaryEntry *mtag = NULL;
+ const AVDictionaryEntry *mtag = NULL;
AVDictionary *dst = NULL;
const char *key, *value;
char year[5] = {0}, day_month[5] = {0};
@@ -219,7 +219,7 @@ void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version,
static int write_metadata(AVIOContext *pb, AVDictionary **metadata,
ID3v2EncContext *id3, int enc)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int ret;
ff_metadata_conv(metadata, ff_id3v2_34_metadata_conv, NULL);
@@ -351,7 +351,7 @@ int ff_id3v2_write_metadata(AVFormatContext *s, ID3v2EncContext *id3)
int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
{
AVStream *st = s->streams[pkt->stream_index];
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
AVIOContext *dyn_buf;
uint8_t *buf;
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 500c83ac3a..8979d10973 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2051,7 +2051,7 @@ static int matroska_parse_flac(AVFormatContext *s,
/* check for the channel mask */
if (block_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
AVDictionary *dict = NULL;
- AVDictionaryEntry *chmask;
+ const AVDictionaryEntry *chmask;
ff_vorbis_comment(s, &dict, p, block_size, 0);
chmask = av_dict_get(dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0);
diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index b9b6de7972..e2fe4332b1 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -29,7 +29,7 @@ void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv,
/* TODO: use binary search to look up the two conversion tables
if the tables are getting big enough that it would matter speed wise */
const AVMetadataConv *sc, *dc;
- AVDictionaryEntry *mtag = NULL;
+ const AVDictionaryEntry *mtag = NULL;
AVDictionary *dst = NULL;
const char *key;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index d0b8b2595b..22168f0f4e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2155,7 +2155,7 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
int bits_per_sample, flags;
uint16_t version = avio_rb16(pb);
uint32_t id = 0;
- AVDictionaryEntry *compatible_brands = av_dict_get(c->fc->metadata, "compatible_brands", NULL, AV_DICT_MATCH_CASE);
+ const AVDictionaryEntry *compatible_brands = av_dict_get(c->fc->metadata, "compatible_brands", NULL, AV_DICT_MATCH_CASE);
avio_rb16(pb); /* revision level */
id = avio_rl32(pb); /* vendor */
@@ -7451,7 +7451,7 @@ static void export_orphan_timecode(AVFormatContext *s)
if (st->codecpar->codec_tag == MKTAG('t','m','c','d') &&
!tmcd_is_referenced(s, i + 1)) {
- AVDictionaryEntry *tcr = av_dict_get(st->metadata, "timecode", NULL, 0);
+ const AVDictionaryEntry *tcr = av_dict_get(st->metadata, "timecode", NULL, 0);
if (tcr) {
av_dict_set(&s->metadata, "timecode", tcr->value, 0);
break;
@@ -7614,7 +7614,7 @@ static int mov_read_header(AVFormatContext *s)
AVStream *st = s->streams[i];
MOVStreamContext *sc = st->priv_data;
if (sc->timecode_track > 0) {
- AVDictionaryEntry *tcr;
+ const AVDictionaryEntry *tcr;
int tmcd_st_id = -1;
for (j = 0; j < s->nb_streams; j++)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1a2f24c410..bc9e77a44c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2088,7 +2088,7 @@ static int mov_write_mdcv_tag(AVIOContext *pb, MOVTrack *track)
static void find_compressor(char * compressor_name, int len, MOVTrack *track)
{
- AVDictionaryEntry *encoder;
+ const AVDictionaryEntry *encoder;
int xdcam_res = (track->par->width == 1280 && track->par->height == 720)
|| (track->par->width == 1440 && track->par->height == 1080)
|| (track->par->width == 1920 && track->par->height == 1080);
@@ -2347,7 +2347,7 @@ static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track)
#if 1
int frame_duration;
int nb_frames;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
if (!track->st->avg_frame_rate.num || !track->st->avg_frame_rate.den) {
av_log(NULL, AV_LOG_ERROR, "avg_frame_rate not set for tmcd track.\n");
@@ -2840,7 +2840,7 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
// hdlr.name is used by some players to identify the content title
// of the track. So if an alternate handler description is
// specified, use it.
- AVDictionaryEntry *t;
+ const AVDictionaryEntry *t;
t = av_dict_get(track->st->metadata, "handler_name", NULL, 0);
if (t && utf8len(t->value))
descr = t->value;
@@ -3312,7 +3312,7 @@ static int mov_write_track_metadata(AVIOContext *pb, AVStream *st,
const char *tag, const char *str)
{
int64_t pos = avio_tell(pb);
- AVDictionaryEntry *t = av_dict_get(st->metadata, str, NULL, 0);
+ const AVDictionaryEntry *t = av_dict_get(st->metadata, str, NULL, 0);
if (!t || !utf8len(t->value))
return 0;
@@ -3565,11 +3565,11 @@ static int mov_write_string_tag(AVIOContext *pb, const char *name,
return size;
}
-static AVDictionaryEntry *get_metadata_lang(AVFormatContext *s,
+static const AVDictionaryEntry *get_metadata_lang(AVFormatContext *s,
const char *tag, int *lang)
{
int l, len, len2;
- AVDictionaryEntry *t, *t2 = NULL;
+ const AVDictionaryEntry *t, *t2 = NULL;
char tag2[16];
*lang = 0;
@@ -3595,7 +3595,7 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
int long_style)
{
int lang;
- AVDictionaryEntry *t = get_metadata_lang(s, tag, &lang);
+ const AVDictionaryEntry *t = get_metadata_lang(s, tag, &lang);
if (!t)
return 0;
return mov_write_string_tag(pb, name, t->value, lang, long_style);
@@ -3604,7 +3604,7 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
/* iTunes bpm number */
static int mov_write_tmpo_tag(AVIOContext *pb, AVFormatContext *s)
{
- AVDictionaryEntry *t = av_dict_get(s->metadata, "tmpo", NULL, 0);
+ const AVDictionaryEntry *t = av_dict_get(s->metadata, "tmpo", NULL, 0);
int size = 0, tmpo = t ? atoi(t->value) : 0;
if (tmpo) {
size = 26;
@@ -3626,7 +3626,7 @@ static int mov_write_loci_tag(AVFormatContext *s, AVIOContext *pb)
int64_t pos = avio_tell(pb);
double latitude, longitude, altitude;
int32_t latitude_fix, longitude_fix, altitude_fix;
- AVDictionaryEntry *t = get_metadata_lang(s, "location", &lang);
+ const AVDictionaryEntry *t = get_metadata_lang(s, "location", &lang);
const char *ptr, *place = "";
char *end;
static const char *astronomical_body = "earth";
@@ -3674,7 +3674,7 @@ static int mov_write_loci_tag(AVFormatContext *s, AVIOContext *pb)
static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s, int disc)
{
- AVDictionaryEntry *t = av_dict_get(s->metadata,
+ const AVDictionaryEntry *t = av_dict_get(s->metadata,
disc ? "disc" : "track",
NULL, 0);
int size = 0, track = t ? atoi(t->value) : 0;
@@ -3702,7 +3702,7 @@ static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb,
const char *name, const char *tag,
int len)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
uint8_t num;
int size = 24 + len;
@@ -3811,7 +3811,7 @@ static int mov_write_mdta_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int64_t pos = avio_tell(pb);
int64_t curpos, entry_pos;
int count = 0;
@@ -3840,7 +3840,7 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_mdta_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int64_t pos = avio_tell(pb);
int count = 1; /* keys are 1-index based */
@@ -3885,7 +3885,7 @@ static int mov_write_raw_metadata_tag(AVFormatContext *s, AVIOContext *pb,
const char *name, const char *key)
{
int len;
- AVDictionaryEntry *t;
+ const AVDictionaryEntry *t;
if (!(t = av_dict_get(s->metadata, key, NULL, 0)))
return 0;
@@ -3923,7 +3923,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
const char *tag, const char *str)
{
int64_t pos = avio_tell(pb);
- AVDictionaryEntry *t = av_dict_get(s->metadata, str, NULL, 0);
+ const AVDictionaryEntry *t = av_dict_get(s->metadata, str, NULL, 0);
if (!t || !utf8len(t->value))
return 0;
avio_wb32(pb, 0); /* size */
@@ -3954,7 +3954,7 @@ static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
for (i = 0; i < nb_chapters; i++) {
AVChapter *c = s->chapters[i];
- AVDictionaryEntry *t;
+ const AVDictionaryEntry *t;
avio_wb64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000}));
if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
@@ -4040,7 +4040,7 @@ static void mov_write_psp_udta_tag(AVIOContext *pb,
static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
{
- AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
+ const AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
int64_t pos, pos2;
if (title) {
@@ -4277,7 +4277,7 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
char track_name_buf[32] = { 0 };
AVStream *st = track->st;
- AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
+ const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
if (track->par->codec_type == AVMEDIA_TYPE_VIDEO && !is_cover_image(st)) {
type = "video";
@@ -6266,7 +6266,7 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
for (i = 0; i < s->nb_chapters; i++) {
AVChapter *c = s->chapters[i];
- AVDictionaryEntry *t;
+ const AVDictionaryEntry *t;
int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,mov->movie_timescale});
pkt->pts = pkt->dts = av_rescale_q(c->start, c->time_base, (AVRational){1,mov->movie_timescale});
@@ -6630,13 +6630,13 @@ static int mov_init(AVFormatContext *s)
if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4)
|| mov->write_tmcd == 1) {
- AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode",
+ const AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode",
NULL, 0);
/* +1 tmcd track for each video stream with a timecode */
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
- AVDictionaryEntry *t = global_tcr;
+ const AVDictionaryEntry *t = global_tcr;
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
(t || (t=av_dict_get(st->metadata, "timecode", NULL, 0)))) {
AVTimecode tc;
@@ -6696,7 +6696,7 @@ static int mov_init(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
AVStream *st= s->streams[i];
MOVTrack *track= &mov->tracks[i];
- AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
+ const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
track->st = st;
track->par = st->codecpar;
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index c8328b8b9d..79c4b8ef9e 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -40,7 +40,7 @@
static int id3v1_set_string(AVFormatContext *s, const char *key,
uint8_t *buf, int buf_size)
{
- AVDictionaryEntry *tag;
+ const AVDictionaryEntry *tag;
if ((tag = av_dict_get(s->metadata, key, NULL, 0)))
av_strlcpy(buf, tag->value, buf_size);
return !!tag;
@@ -49,7 +49,7 @@ static int id3v1_set_string(AVFormatContext *s, const char *key,
// refer to: http://id3.org/ID3v1
static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
{
- AVDictionaryEntry *tag;
+ const AVDictionaryEntry *tag;
int i, count = 0;
memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */
@@ -144,7 +144,7 @@ static int mp3_write_xing(AVFormatContext *s)
{
MP3Context *mp3 = s->priv_data;
AVCodecParameters *par = s->streams[mp3->audio_stream_idx]->codecpar;
- AVDictionaryEntry *enc = av_dict_get(s->streams[mp3->audio_stream_idx]->metadata, "encoder", NULL, 0);
+ const AVDictionaryEntry *enc = av_dict_get(s->streams[mp3->audio_stream_idx]->metadata, "encoder", NULL, 0);
AVIOContext *dyn_ctx;
int32_t header;
MPADecodeHeader mpah;
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 98dac17994..b9d34d1584 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -515,7 +515,7 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
MpegTSWriteStream *ts_st = st->priv_data;
- AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
+ const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
const char default_language[] = "und";
const char *language = lang && strlen(lang->value) >= 3 ? lang->value : default_language;
enum AVCodecID codec_id = st->codecpar->codec_id;
@@ -965,7 +965,7 @@ static MpegTSService *mpegts_add_service(AVFormatContext *s, int sid,
{
MpegTSWrite *ts = s->priv_data;
MpegTSService *service;
- AVDictionaryEntry *title, *provider;
+ const AVDictionaryEntry *title, *provider;
char default_service_name[32];
const char *service_name;
const char *provider_name;
@@ -1067,7 +1067,7 @@ static void select_pcr_streams(AVFormatContext *s)
static int mpegts_init(AVFormatContext *s)
{
MpegTSWrite *ts = s->priv_data;
- AVDictionaryEntry *provider;
+ const AVDictionaryEntry *provider;
const char *provider_name;
int i, j;
int ret;
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 2053a5636e..28e0f5639a 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -227,7 +227,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
FFFormatContext *const si = ffformatcontext(s);
AVDictionary *tmp = NULL;
const AVOutputFormat *of = s->oformat;
- AVDictionaryEntry *e;
+ const AVDictionaryEntry *e;
int ret = 0;
if (options)
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 56facbe4b7..846956142f 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -759,9 +759,9 @@ static void mxf_write_identification(AVFormatContext *s)
{
MXFContext *mxf = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *com_entry = av_dict_get(s->metadata, "company_name", NULL, 0);
- AVDictionaryEntry *product_entry = av_dict_get(s->metadata, "product_name", NULL, 0);
- AVDictionaryEntry *version_entry = av_dict_get(s->metadata, "product_version", NULL, 0);
+ const AVDictionaryEntry *com_entry = av_dict_get(s->metadata, "company_name", NULL, 0);
+ const AVDictionaryEntry *product_entry = av_dict_get(s->metadata, "product_name", NULL, 0);
+ const AVDictionaryEntry *version_entry = av_dict_get(s->metadata, "product_version", NULL, 0);
const char *company = com_entry ? com_entry->value : "FFmpeg";
const char *product = product_entry ? product_entry->value : s->oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer";
const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : PLATFORM_IDENT;
@@ -1540,7 +1540,7 @@ static int mxf_write_tagged_value(AVFormatContext *s, const char* name, const ch
static int mxf_write_user_comments(AVFormatContext *s, const AVDictionary *m)
{
MXFContext *mxf = s->priv_data;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
int count = 0;
while ((t = av_dict_get(m, "comment_", t, AV_DICT_IGNORE_SUFFIX))) {
@@ -1680,7 +1680,7 @@ static int mxf_write_essence_container_data(AVFormatContext *s)
static int mxf_write_header_metadata_sets(AVFormatContext *s)
{
MXFContext *mxf = s->priv_data;
- AVDictionaryEntry *entry = NULL;
+ const AVDictionaryEntry *entry = NULL;
AVStream *st = NULL;
int i;
MXFPackage packages[3] = {{0}};
@@ -2479,7 +2479,7 @@ static void mxf_gen_umid(AVFormatContext *s)
static int mxf_init_timecode(AVFormatContext *s, AVStream *st, AVRational tbc)
{
MXFContext *mxf = s->priv_data;
- AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
+ const AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
if (!ff_mxf_get_content_package_rate(tbc)) {
if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
@@ -2655,7 +2655,7 @@ static int mxf_write_header(AVFormatContext *s)
if (ret < 0)
return ret;
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
- AVDictionaryEntry *e = av_dict_get(st->metadata, "data_type", NULL, 0);
+ const AVDictionaryEntry *e = av_dict_get(st->metadata, "data_type", NULL, 0);
if (e && !strcmp(e->value, "vbi_vanc_smpte_436M")) {
sc->index = INDEX_S436M;
} else {
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 7977980935..54727f21bc 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -494,7 +494,7 @@ static int add_info(AVIOContext *bc, const char *type, const char *value)
static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
{
AVFormatContext *s = nut->avf;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *dyn_bc;
uint8_t *dyn_buf = NULL;
int count = 0, dyn_size;
@@ -522,7 +522,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
AVFormatContext *s= nut->avf;
AVStream* st = s->streams[stream_id];
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *dyn_bc;
uint8_t *dyn_buf=NULL;
int count=0, dyn_size, i;
@@ -565,7 +565,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
{
AVIOContext *dyn_bc;
uint8_t *dyn_buf = NULL;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVChapter *ch = nut->avf->chapters[id];
int ret, dyn_size, count = 0;
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index ffccfa3d48..be66c7bdce 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -337,7 +337,7 @@ void ff_riff_write_info(AVFormatContext *s)
AVIOContext *pb = s->pb;
int i;
int64_t list_pos;
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index 1b2b0ecf38..d0b76b7a54 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -76,7 +76,7 @@ static int rv10_write_header(AVFormatContext *ctx,
int nb_packets, packet_total_size, packet_max_size, size, packet_avg_size, i;
int bit_rate, v, duration, flags;
int data_offset;
- AVDictionaryEntry *tag;
+ const AVDictionaryEntry *tag;
ffio_wfourcc(s, ".RMF");
avio_wb32(s,18); /* header size */
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index 9319ee6f80..0c0e17d986 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -76,7 +76,7 @@ static int sap_write_header(AVFormatContext *s)
struct sockaddr_storage localaddr;
socklen_t addrlen = sizeof(localaddr);
int udp_fd;
- AVDictionaryEntry* title = av_dict_get(s->metadata, "title", NULL, 0);
+ const AVDictionaryEntry* title = av_dict_get(s->metadata, "title", NULL, 0);
if (!ff_network_init())
return AVERROR(EIO);
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 1200e553f9..2d8f61f9b8 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -757,7 +757,7 @@ void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx,
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
{
- AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
+ const AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
struct sdp_session_level s = { 0 };
int i, j, port, ttl, is_multicast, index = 0;
char dst[32], dst_type[5];
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 2b024fd373..b11a183322 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -349,7 +349,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
int ret = 0;
AVTimecode tc;
AVRational rate;
- AVDictionaryEntry *tcr;
+ const AVDictionaryEntry *tcr;
char buf[AV_TIMECODE_STR_SIZE];
int i;
int err;
@@ -435,7 +435,7 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
char st_buf[AV_TIMECODE_STR_SIZE];
AVTimecode st_tc;
AVRational st_rate = s->streams[i]->avg_frame_rate;
- AVDictionaryEntry *st_tcr = av_dict_get(s->streams[i]->metadata, "timecode", NULL, 0);
+ const AVDictionaryEntry *st_tcr = av_dict_get(s->streams[i]->metadata, "timecode", NULL, 0);
if (st_tcr) {
if ((av_timecode_init_from_string(&st_tc, st_rate, st_tcr->value, s) < 0)) {
av_log(s, AV_LOG_WARNING, "Could not increment stream %d timecode, error occurred during timecode creation.\n", i);
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index ac5576fa76..56d00c1d1b 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -34,7 +34,7 @@ typedef struct SMJPEGMuxContext {
static int smjpeg_write_header(AVFormatContext *s)
{
- AVDictionaryEntry *t = NULL;
+ const AVDictionaryEntry *t = NULL;
AVIOContext *pb = s->pb;
int n, tag;
diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c
index e24501bacd..9b934f9f6e 100644
--- a/libavformat/soxenc.c
+++ b/libavformat/soxenc.c
@@ -46,7 +46,7 @@ static int sox_write_header(AVFormatContext *s)
SoXContext *sox = s->priv_data;
AVIOContext *pb = s->pb;
AVCodecParameters *par = s->streams[0]->codecpar;
- AVDictionaryEntry *comment;
+ const AVDictionaryEntry *comment;
size_t comment_len = 0, comment_size;
comment = av_dict_get(s->metadata, "comment", NULL, 0);
diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c
index 896fc81958..21aa8e4ed5 100644
--- a/libavformat/ttmlenc.c
+++ b/libavformat/ttmlenc.c
@@ -135,7 +135,7 @@ static int ttml_write_header(AVFormatContext *ctx)
AVStream *st = ctx->streams[0];
AVIOContext *pb = ctx->pb;
- AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,
+ const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,
0);
const char *printed_lang = (lang && lang->value) ? lang->value : "";
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 509c0ecdce..5aaee9abb0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1434,7 +1434,7 @@ static int match_stream_specifier(AVFormatContext *s, AVStream *st,
return AVERROR(EINVAL);
return match && (stream_id == st->id);
} else if (*spec == 'm' && *(spec + 1) == ':') {
- AVDictionaryEntry *tag;
+ const AVDictionaryEntry *tag;
char *key, *val;
int ret;
@@ -1809,7 +1809,7 @@ int ff_is_http_proto(const char *filename) {
int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds)
{
- AVDictionaryEntry *entry;
+ const AVDictionaryEntry *entry;
int64_t parsed_timestamp;
int ret;
if ((entry = av_dict_get(s->metadata, "creation_time", NULL, 0))) {
diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index 13ee065a44..0340465f57 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -45,7 +45,7 @@ int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string
len += strlen(vendor_string);
if (chapters && nb_chapters) {
for (int i = 0; i < nb_chapters; i++) {
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
len += 4 + 12 + 1 + 10;
while ((tag = av_dict_get(chapters[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
int64_t len1 = !strcmp(tag->key, "title") ? 4 : strlen(tag->key);
@@ -54,7 +54,7 @@ int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string
}
}
if (m) {
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
len += 4 +strlen(tag->key) + 1 + strlen(tag->value);
}
@@ -77,7 +77,7 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
}
if (m) {
int count = av_dict_count(m) + cm_count;
- AVDictionaryEntry *tag = NULL;
+ const AVDictionaryEntry *tag = NULL;
avio_wl32(pb, count);
while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
int64_t len1 = strlen(tag->key);
diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index 2317700be1..c1189aa3ac 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -88,7 +88,7 @@ typedef struct WAVMuxContext {
#if CONFIG_WAV_MUXER
static inline void bwf_write_bext_string(AVFormatContext *s, const char *key, int maxlen)
{
- AVDictionaryEntry *tag;
+ const AVDictionaryEntry *tag;
size_t len = 0;
if (tag = av_dict_get(s->metadata, key, NULL, 0)) {
@@ -102,7 +102,7 @@ static inline void bwf_write_bext_string(AVFormatContext *s, const char *key, in
static void bwf_write_bext_chunk(AVFormatContext *s)
{
- AVDictionaryEntry *tmp_tag;
+ const AVDictionaryEntry *tmp_tag;
uint64_t time_reference = 0;
int64_t bext = ff_start_tag(s->pb, "bext");
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index cf69bd35b1..0dfc75c33d 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -68,7 +68,7 @@ static double get_duration(AVFormatContext *s)
int i = 0;
double max = 0.0;
for (i = 0; i < s->nb_streams; i++) {
- AVDictionaryEntry *duration = av_dict_get(s->streams[i]->metadata,
+ const AVDictionaryEntry *duration = av_dict_get(s->streams[i]->metadata,
DURATION, NULL, 0);
if (!duration || atof(duration->value) < 0) continue;
if (atof(duration->value) > max) max = atof(duration->value);
@@ -127,11 +127,11 @@ static void write_footer(AVFormatContext *s)
static int subsegment_alignment(AVFormatContext *s, const AdaptationSet *as)
{
int i;
- AVDictionaryEntry *gold = av_dict_get(s->streams[as->streams[0]]->metadata,
+ const AVDictionaryEntry *gold = av_dict_get(s->streams[as->streams[0]]->metadata,
CUE_TIMESTAMPS, NULL, 0);
if (!gold) return 0;
for (i = 1; i < as->nb_streams; i++) {
- AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata,
+ const AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata,
CUE_TIMESTAMPS, NULL, 0);
if (!ts || !av_strstart(ts->value, gold->value, NULL)) return 0;
}
@@ -142,13 +142,13 @@ static int bitstream_switching(AVFormatContext *s, const AdaptationSet *as)
{
int i;
const AVStream *gold_st = s->streams[as->streams[0]];
- AVDictionaryEntry *gold_track_num = av_dict_get(gold_st->metadata,
+ const AVDictionaryEntry *gold_track_num = av_dict_get(gold_st->metadata,
TRACK_NUMBER, NULL, 0);
AVCodecParameters *gold_par = gold_st->codecpar;
if (!gold_track_num) return 0;
for (i = 1; i < as->nb_streams; i++) {
const AVStream *st = s->streams[as->streams[i]];
- AVDictionaryEntry *track_num = av_dict_get(st->metadata,
+ const AVDictionaryEntry *track_num = av_dict_get(st->metadata,
TRACK_NUMBER, NULL, 0);
AVCodecParameters *par = st->codecpar;
if (!track_num ||
@@ -174,7 +174,7 @@ static int write_representation(AVFormatContext *s, AVStream *st, char *id,
WebMDashMuxContext *w = s->priv_data;
AVIOContext *pb = s->pb;
const AVCodecParameters *par = st->codecpar;
- AVDictionaryEntry *bandwidth = av_dict_get(st->metadata, BANDWIDTH, NULL, 0);
+ const AVDictionaryEntry *bandwidth = av_dict_get(st->metadata, BANDWIDTH, NULL, 0);
const char *bandwidth_str;
avio_printf(pb, "<Representation id=\"%s\"", id);
if (bandwidth) {
@@ -202,10 +202,10 @@ static int write_representation(AVFormatContext *s, AVStream *st, char *id,
avio_printf(pb, " startsWithSAP=\"1\"");
avio_printf(pb, ">");
} else {
- AVDictionaryEntry *irange = av_dict_get(st->metadata, INITIALIZATION_RANGE, NULL, 0);
- AVDictionaryEntry *cues_start = av_dict_get(st->metadata, CUES_START, NULL, 0);
- AVDictionaryEntry *cues_end = av_dict_get(st->metadata, CUES_END, NULL, 0);
- AVDictionaryEntry *filename = av_dict_get(st->metadata, FILENAME, NULL, 0);
+ const AVDictionaryEntry *irange = av_dict_get(st->metadata, INITIALIZATION_RANGE, NULL, 0);
+ const AVDictionaryEntry *cues_start = av_dict_get(st->metadata, CUES_START, NULL, 0);
+ const AVDictionaryEntry *cues_end = av_dict_get(st->metadata, CUES_END, NULL, 0);
+ const AVDictionaryEntry *filename = av_dict_get(st->metadata, FILENAME, NULL, 0);
if (!irange || !cues_start || !cues_end || !filename)
return AVERROR(EINVAL);
@@ -304,7 +304,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
AdaptationSet *as = &w->as[as_index];
const AVStream *st = s->streams[as->streams[0]];
AVCodecParameters *par = st->codecpar;
- AVDictionaryEntry *lang;
+ const AVDictionaryEntry *lang;
AVIOContext *pb = s->pb;
int i;
static const char boolean[2][6] = { "false", "true" };
@@ -344,7 +344,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
boolean[w->is_live || subsegment_alignment(s, as)]);
for (i = 0; i < as->nb_streams; i++) {
- AVDictionaryEntry *kf = av_dict_get(s->streams[as->streams[i]]->metadata,
+ const AVDictionaryEntry *kf = av_dict_get(s->streams[as->streams[i]]->metadata,
CLUSTER_KEYFRAME, NULL, 0);
if (!w->is_live && (!kf || !strncmp(kf->value, "0", 1))) subsegmentStartsWithSAP = 0;
}
@@ -352,7 +352,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
avio_printf(pb, ">\n");
if (w->is_live) {
- AVDictionaryEntry *filename =
+ const AVDictionaryEntry *filename =
av_dict_get(st->metadata, FILENAME, NULL, 0);
char *underscore_pos, *period_pos;
int ret;
@@ -380,7 +380,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index)
AVStream *st = s->streams[as->streams[i]];
int ret;
if (w->is_live) {
- AVDictionaryEntry *filename =
+ const AVDictionaryEntry *filename =
av_dict_get(st->metadata, FILENAME, NULL, 0);
if (!filename)
return AVERROR(EINVAL);
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 9c67a6d3e8..e35c9909c0 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -670,7 +670,7 @@ static void write_table_entries_attrib(AVFormatContext *s)
{
WtvContext *wctx = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *tag = 0;
+ const AVDictionaryEntry *tag = 0;
ff_standardize_creation_time(s);
//FIXME: translate special tags (e.g. WM/Bitrate) to binary representation
@@ -698,7 +698,7 @@ static void write_table_redirector_legacy_attrib(AVFormatContext *s)
{
WtvContext *wctx = s->priv_data;
AVIOContext *pb = s->pb;
- AVDictionaryEntry *tag = 0;
+ const AVDictionaryEntry *tag = 0;
int64_t pos = 0;
//FIXME: translate special tags to binary representation
--
2.25.1
More information about the ffmpeg-devel
mailing list