Skip to content

Commit 8b5f830

Browse files
committed
libavformat: Add format context parameter to ff_id3v2_read_dict
The format context (when not NULL) is used to store chapter information, which was not previously supported by ff_id3v2_read_dict. This fixes https://trac.ffmpeg.org/ticket/6558
1 parent 4efb165 commit 8b5f830

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

libavformat/hls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ static void parse_id3(AVFormatContext *s, AVIOContext *pb,
909909
static const char id3_priv_owner_ts[] = "com.apple.streaming.transportStreamTimestamp";
910910
ID3v2ExtraMeta *meta;
911911

912-
ff_id3v2_read_dict(pb, metadata, ID3v2_DEFAULT_MAGIC, extra_meta);
912+
ff_id3v2_read_dict(NULL, pb, metadata, ID3v2_DEFAULT_MAGIC, extra_meta);
913913
for (meta = *extra_meta; meta; meta = meta->next) {
914914
if (!strcmp(meta->tag, "PRIV")) {
915915
ID3v2ExtraMetaPRIV *priv = meta->data;

libavformat/id3v2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,10 +1097,10 @@ static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata,
10971097
merge_date(metadata);
10981098
}
10991099

1100-
void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata,
1100+
void ff_id3v2_read_dict(AVFormatContext *s, AVIOContext *pb, AVDictionary **metadata,
11011101
const char *magic, ID3v2ExtraMeta **extra_meta)
11021102
{
1103-
id3v2_read_internal(pb, metadata, NULL, magic, extra_meta, 0);
1103+
id3v2_read_internal(pb, metadata, s, magic, extra_meta, 0);
11041104
}
11051105

11061106
void ff_id3v2_read(AVFormatContext *s, const char *magic,

libavformat/id3v2.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,15 @@ int ff_id3v2_tag_len(const uint8_t *buf);
9797
/**
9898
* Read an ID3v2 tag into specified dictionary and retrieve supported extra metadata.
9999
*
100-
* Chapters are not currently read by this variant.
100+
* Chapters are not currently only read by this variant when s is not NULL.
101101
*
102102
* @param metadata Parsed metadata is stored here
103103
* @param extra_meta If not NULL, extra metadata is parsed into a list of
104104
* ID3v2ExtraMeta structs and *extra_meta points to the head of the list
105+
* @param s If not NULL, chapter information is stored in the provided context
105106
*/
106-
void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata, const char *magic, ID3v2ExtraMeta **extra_meta);
107+
void ff_id3v2_read_dict(AVFormatContext *s, AVIOContext *pb, AVDictionary **metadata,
108+
const char *magic, ID3v2ExtraMeta **extra_meta);
107109

108110
/**
109111
* Read an ID3v2 tag, including supported extra metadata and chapters.

libavformat/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
588588

589589
/* e.g. AVFMT_NOFILE formats will not have a AVIOContext */
590590
if (s->pb)
591-
ff_id3v2_read_dict(s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
591+
ff_id3v2_read_dict(s, s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
592592

593593

594594
if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header)

0 commit comments

Comments
 (0)