diff options
author | wm4 <wm4@nowhere> | 2013-09-08 07:42:05 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-08 07:43:23 +0200 |
commit | 35fd083828a57eb7ae995bd081dad88a8d64f75d (patch) | |
tree | b6f377dceee9ad4f888bb44d0842a00fc4ee3d04 /demux/demux_mkv.c | |
parent | ba07000b886802909a52810568705897d600263a (diff) | |
download | mpv-35fd083828a57eb7ae995bd081dad88a8d64f75d.tar.bz2 mpv-35fd083828a57eb7ae995bd081dad88a8d64f75d.tar.xz |
demux: retrieve per-chapter metadata
Retrieve per-chapter metadata, but don't do much with it. We just make
the metadata of the _current_ chapter available as chapter-metadata
property. Returning the full chapter list with metadata would be no
problem, except that the property interface isn't really good with
structured data, so it's not available for now.
Not sure if it's worth it, but it was requested via github issue #201.
Diffstat (limited to 'demux/demux_mkv.c')
-rw-r--r-- | demux/demux_mkv.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index a391dde5a6..120bbbb93a 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -878,7 +878,8 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer) BSTR_P(name)); if (idx == selected_edition){ - demuxer_add_chapter(demuxer, name, chapter.start, chapter.end); + demuxer_add_chapter(demuxer, name, chapter.start, chapter.end, + ca->chapter_uid); if (editions[idx].edition_flag_ordered) { chapter.name = talloc_strndup(m_chapters, name.start, name.len); @@ -913,11 +914,21 @@ static int demux_mkv_read_tags(demuxer_t *demuxer) for (int i = 0; i < tags.n_tag; i++) { struct ebml_tag tag = tags.tag[i]; if (tag.targets.target_track_uid || tag.targets.target_edition_uid || - tag.targets.target_chapter_uid || tag.targets.target_attachment_uid) + tag.targets.target_attachment_uid) continue; - for (int j = 0; j < tag.n_simple_tag; j++) - demux_info_add_bstr(demuxer, tag.simple_tag[j].tag_name, tag.simple_tag[j].tag_string); + if (tag.targets.target_chapter_uid) { + for (int j = 0; j < tag.n_simple_tag; j++) { + demuxer_add_chapter_info(demuxer, tag.targets.target_chapter_uid, + tag.simple_tag[j].tag_name, + tag.simple_tag[j].tag_string); + } + } else { + for (int j = 0; j < tag.n_simple_tag; j++) { + demux_info_add_bstr(demuxer, tag.simple_tag[j].tag_name, + tag.simple_tag[j].tag_string); + } + } } talloc_free(parse_ctx.talloc_ctx); |