From e3f5043233336d8b4b0731c6a8b42a8fda5535ac Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 23 Oct 2011 04:51:44 +0200 Subject: core, demux: fix --identify chapter output with ordered chapters Information about individual chapters was printed during demuxer opening phase, and total chapter count (ID_CHAPTERS) was printed according to mpctx->demuxer->num_chapters. When playing a file with ordered chapters, this meant that chapter information about every source file was printed individually (even though only the chapters from the first file would be used for playback) and the total chapter count could be wrong. Remove the printing of chapter information from the demuxer layer and print the chapter information and count actually used for playback in core print_file_properties(). Also somewhat simplify the internal chapters API and remove possible inconsistencies. --- command.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'command.c') diff --git a/command.c b/command.c index 4b1dc9c8e2..bdb9343187 100644 --- a/command.c +++ b/command.c @@ -527,13 +527,13 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg, double next_pts = 0; queue_seek(mpctx, MPSEEK_NONE, 0, 0); - chapter = seek_chapter(mpctx, chapter, &next_pts, &chapter_name); + chapter = seek_chapter(mpctx, chapter, &next_pts); if (chapter >= 0) { if (next_pts > -1.0) queue_seek(mpctx, MPSEEK_ABSOLUTE, next_pts, 0); - if (chapter_name) - set_osd_tmsg(OSD_MSG_TEXT, 1, opts->osd_duration, - "Chapter: (%d) %s", chapter + 1, chapter_name); + chapter_name = chapter_display_name(mpctx, chapter); + set_osd_tmsg(OSD_MSG_TEXT, 1, opts->osd_duration, + "Chapter: %s", chapter_name); } else if (step_all > 0) queue_seek(mpctx, MPSEEK_RELATIVE, 1000000000, 0); else @@ -549,10 +549,8 @@ static int mp_property_chapters(m_option_t *prop, int action, void *arg, { if (!mpctx->demuxer) return M_PROPERTY_UNAVAILABLE; - if (mpctx->demuxer->num_chapters == 0) - stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_NUM_CHAPTERS, - &mpctx->demuxer->num_chapters); - return m_property_int_ro(prop, action, arg, mpctx->demuxer->num_chapters); + int count = get_chapter_count(mpctx); + return m_property_int_ro(prop, action, arg, count); } /// Current dvd angle (RW) -- cgit v1.2.3