From 35fd083828a57eb7ae995bd081dad88a8d64f75d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 8 Sep 2013 07:42:05 +0200 Subject: 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. --- demux/demux_mkv.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'demux/demux_mkv.c') 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); -- cgit v1.2.3