Mercurial > mplayer.hg
diff command.c @ 34386:206264c532f5
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.
| author | ib |
|---|---|
| date | Sat, 31 Dec 2011 12:20:08 +0000 |
| parents | f05c75392897 |
| children | 26eddbd6353a |
line wrap: on
line diff
--- a/command.c Thu Dec 29 19:42:58 2011 +0000 +++ b/command.c Sat Dec 31 12:20:08 2011 +0000 @@ -515,6 +515,17 @@ 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) @@ -2142,6 +2153,8 @@ 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,
