summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authormplayer-svn <svn@mplayerhq.hu>2011-12-31 12:20:08 +0000
committerwm4 <wm4@nowhere>2012-08-03 01:43:03 +0200
commit98f15b645ff1d10a914c004d0b076916a5f1f094 (patch)
tree61cccc0937d86a1f06a01d874a9d33f52603c438 /command.c
parente97d658bdee7b1ebb1e62fcf8d79b150bd40213f (diff)
downloadmpv-98f15b645ff1d10a914c004d0b076916a5f1f094.tar.bz2
mpv-98f15b645ff1d10a914c004d0b076916a5f1f094.tar.xz
stream: add new stream control command STREAM_CTRL_GET_NUM_TITLES
This provides the total number of titles (aka tracks) of CDs / VCDs / DVDs. Additionally, add a titles property to the get_property slave command. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34474 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: ib
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 842a9359e0..dd7a1ee34c 100644
--- a/command.c
+++ b/command.c
@@ -547,6 +547,17 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
return M_PROPERTY_OK;
}
+/// Number of titles in file
+static int mp_property_titles(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ if (!mpctx->demuxer)
+ return M_PROPERTY_UNAVAILABLE;
+ if (mpctx->demuxer->num_titles == 0)
+ stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_NUM_TITLES, &mpctx->demuxer->num_titles);
+ return m_property_int_ro(prop, action, arg, mpctx->demuxer->num_titles);
+}
+
/// Number of chapters in file
static int mp_property_chapters(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
@@ -2144,6 +2155,8 @@ static const m_option_t mp_properties[] = {
M_OPT_MIN, 0, 0, NULL },
{ "chapter", mp_property_chapter, CONF_TYPE_INT,
M_OPT_MIN, 0, 0, NULL },
+ { "titles", mp_property_titles, CONF_TYPE_INT,
+ 0, 0, 0, NULL },
{ "chapters", mp_property_chapters, CONF_TYPE_INT,
0, 0, 0, NULL },
{ "angle", mp_property_angle, CONF_TYPE_INT,