summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-09-26 21:17:01 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-09-26 21:17:01 +0000
commit20e4a74eb52887f3a549e3642868d5973612c9d1 (patch)
treeef4e41b0afdd2335daa2c7f4e9b3692d2c55eb01 /command.c
parente628297bbd96f82ea63d236ebb84fdf5429e6a42 (diff)
downloadmpv-20e4a74eb52887f3a549e3642868d5973612c9d1.tar.bz2
mpv-20e4a74eb52887f3a549e3642868d5973612c9d1.tar.xz
slave command to get the number of chapters; patch by Kevin DeKorte - kdekorte gmail com
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27667 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'command.c')
-rw-r--r--command.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/command.c b/command.c
index e5b17abafe..ebf40c9a45 100644
--- a/command.c
+++ b/command.c
@@ -447,6 +447,17 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
return M_PROPERTY_OK;
}
+/// Number of chapters in file
+static int mp_property_chapters(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ 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);
+}
+
/// Current dvd angle (RW)
static int mp_property_angle(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
@@ -1983,6 +1994,8 @@ static const m_option_t mp_properties[] = {
M_OPT_MIN, 0, 0, NULL },
{ "chapter", mp_property_chapter, CONF_TYPE_INT,
M_OPT_MIN, 1, 0, NULL },
+ { "chapters", mp_property_chapters, CONF_TYPE_INT,
+ 0, 0, 0, NULL },
{ "angle", mp_property_angle, CONF_TYPE_INT,
CONF_RANGE, -2, 10, NULL },
{ "metadata", mp_property_metadata, CONF_TYPE_STRING_LIST,