ff_id3v2_read_dict(pb, metadata, ID3v2_DEFAULT_MAGIC, extra_meta);
for (meta = *extra_meta; meta; meta = meta->next) {
if (!strcmp(meta->tag, "PRIV")) {
- ID3v2ExtraMetaPRIV *priv = meta->data;
+ ID3v2ExtraMetaPRIV *priv = &meta->data.priv;
if (priv->datasize == 8 && !strcmp(priv->owner, id3_priv_owner_ts)) {
/* 33-bit MPEG timestamp */
int64_t ts = AV_RB64(priv->data);
av_log(s, AV_LOG_ERROR, "Invalid HLS ID3 audio timestamp %"PRId64"\n", ts);
}
} else if (!strcmp(meta->tag, "APIC") && apic)
- *apic = meta->data;
+ *apic = &meta->data.apic;
}
}
av_freep(&geob->file_name);
av_freep(&geob->description);
av_freep(&geob->data);
- av_free(geob);
}
/**
if (taglen < 1)
return;
- geob_data = av_mallocz(sizeof(ID3v2ExtraMetaGEOB));
- if (!geob_data) {
- av_log(s, AV_LOG_ERROR, "Failed to alloc %"SIZE_SPECIFIER" bytes\n",
- sizeof(ID3v2ExtraMetaGEOB));
- return;
- }
-
new_extra = av_mallocz(sizeof(ID3v2ExtraMeta));
if (!new_extra) {
av_log(s, AV_LOG_ERROR, "Failed to alloc %"SIZE_SPECIFIER" bytes\n",
sizeof(ID3v2ExtraMeta));
- goto fail;
+ return;
}
+ geob_data = &new_extra->data.geob;
+
/* read encoding type byte */
encoding = avio_r8(pb);
taglen--;
/* add data to the list */
new_extra->tag = "GEOB";
- new_extra->data = geob_data;
new_extra->next = *extra_meta;
*extra_meta = new_extra;
ID3v2ExtraMetaAPIC *apic = obj;
av_buffer_unref(&apic->buf);
av_freep(&apic->description);
- av_freep(&apic);
}
static void rstrip_spaces(char *buf)
goto fail;
new_extra = av_mallocz(sizeof(*new_extra));
- apic = av_mallocz(sizeof(*apic));
- if (!new_extra || !apic)
+ if (!new_extra)
goto fail;
+ apic = &new_extra->data.apic;
+
enc = avio_r8(pb);
taglen--;
memset(apic->buf->data + taglen, 0, AV_INPUT_BUFFER_PADDING_SIZE);
new_extra->tag = "APIC";
- new_extra->data = apic;
new_extra->next = *extra_meta;
*extra_meta = new_extra;
ID3v2ExtraMetaCHAP *chap = obj;
av_freep(&chap->element_id);
av_dict_free(&chap->meta);
- av_freep(&chap);
}
static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, const char *ttag, ID3v2ExtraMeta **extra_meta, int isv34)
ID3v2ExtraMetaCHAP *chap = NULL;
new_extra = av_mallocz(sizeof(*new_extra));
- chap = av_mallocz(sizeof(*chap));
+ if (!new_extra)
+ return;
- if (!new_extra || !chap)
- goto fail;
+ chap = &new_extra->data.chap;
if (decode_str(s, pb, 0, &chap->element_id, &len) < 0)
goto fail;
ff_metadata_conv(&chap->meta, NULL, ff_id3v2_4_metadata_conv);
new_extra->tag = "CHAP";
- new_extra->data = chap;
new_extra->next = *extra_meta;
*extra_meta = new_extra;
return;
fail:
- if (chap)
- free_chapter(chap);
+ free_chapter(chap);
av_freep(&new_extra);
}
ID3v2ExtraMetaPRIV *priv = obj;
av_freep(&priv->owner);
av_freep(&priv->data);
- av_freep(&priv);
}
static void read_priv(AVFormatContext *s, AVIOContext *pb, int taglen,
ID3v2ExtraMetaPRIV *priv;
meta = av_mallocz(sizeof(*meta));
- priv = av_mallocz(sizeof(*priv));
+ if (!meta)
+ return;
- if (!meta || !priv)
- goto fail;
+ priv = &meta->data.priv;
if (decode_str(s, pb, ID3v2_ENCODING_ISO8859, &priv->owner, &taglen) < 0)
goto fail;
goto fail;
meta->tag = "PRIV";
- meta->data = priv;
meta->next = *extra_meta;
*extra_meta = meta;
return;
fail:
- if (priv)
- free_priv(priv);
+ free_priv(priv);
av_freep(&meta);
}
while (current) {
if ((extra_func = get_extra_meta_func(current->tag, 1)))
- extra_func->free(current->data);
+ extra_func->free(¤t->data);
next = current->next;
av_freep(¤t);
current = next;
if (strcmp(cur->tag, "APIC"))
continue;
- apic = cur->data;
+ apic = &cur->data.apic;
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
if (strcmp(cur->tag, "CHAP"))
continue;
- chap = cur->data;
+ chap = &cur->data.chap;
if ((ret = av_dynarray_add_nofree(&chapters, &num_chapters, chap)) < 0)
goto end;
for (cur = *extra_meta; cur; cur = cur->next) {
if (!strcmp(cur->tag, "PRIV")) {
- ID3v2ExtraMetaPRIV *priv = cur->data;
+ ID3v2ExtraMetaPRIV *priv = &cur->data.priv;
AVBPrint bprint;
char *escaped, *key;
int i, ret;