summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-10-23 04:51:44 +0200
committerUoti Urpala <uau@mplayer2.org>2011-10-25 22:09:33 +0300
commite3f5043233336d8b4b0731c6a8b42a8fda5535ac (patch)
tree2a1c05f2b117da2276f57ddf8b0409504c536689 /command.c
parentc0b7851f23b561aa708a78f00961652603a18013 (diff)
downloadmpv-e3f5043233336d8b4b0731c6a8b42a8fda5535ac.tar.bz2
mpv-e3f5043233336d8b4b0731c6a8b42a8fda5535ac.tar.xz
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.
Diffstat (limited to 'command.c')
-rw-r--r--command.c14
1 files changed, 6 insertions, 8 deletions
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)