[MPlayer-cvslog] r27667 - in trunk: DOCS/tech/slave.txt command.c mplayer.c
nicodvb
subversion at mplayerhq.hu
Fri Sep 26 23:17:01 CEST 2008
Author: nicodvb
Date: Fri Sep 26 23:17:01 2008
New Revision: 27667
Log:
slave command to get the number of chapters; patch by Kevin DeKorte - kdekorte gmail com
Modified:
trunk/DOCS/tech/slave.txt
trunk/command.c
trunk/mplayer.c
Modified: trunk/DOCS/tech/slave.txt
==============================================================================
--- trunk/DOCS/tech/slave.txt (original)
+++ trunk/DOCS/tech/slave.txt Fri Sep 26 23:17:01 2008
@@ -478,6 +478,7 @@ stream_start pos 0
stream_end pos 0 X end pos in stream
stream_length pos 0 X (end - start)
chapter int 0 X X X select chapter
+chapters int X number of chapters
angle int 0 X X X select angle
length time X length of file in seconds
percent_pos int 0 100 X X X position in percent
Modified: trunk/command.c
==============================================================================
--- trunk/command.c (original)
+++ trunk/command.c Fri Sep 26 23:17:01 2008
@@ -447,6 +447,17 @@ static int mp_property_chapter(m_option_
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,
Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c (original)
+++ trunk/mplayer.c Fri Sep 26 23:17:01 2008
@@ -3531,6 +3531,11 @@ if (mpctx->global_sub_size) {
}
mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_LENGTH=%.2lf\n", demuxer_get_time_length(mpctx->demuxer));
mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_SEEKABLE=%d\n", mpctx->stream->seek ? 1 : 0);
+ if (mpctx->demuxer) {
+ if (mpctx->demuxer->num_chapters == 0)
+ stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_NUM_CHAPTERS, &mpctx->demuxer->num_chapters);
+ mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_CHAPTERS=%d\n", mpctx->demuxer->num_chapters);
+ }
if(!mpctx->sh_video) goto main; // audio-only
More information about the MPlayer-cvslog
mailing list