From 6ab9a83398dcfdc2d72a831a4f71b3be0be18d2a Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 25 Jul 2010 09:06:37 +0000 Subject: slave mode: Add stream_time_pos property Patch by Paul Huwe [reicow yahoo com] with some modifications by me. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31794 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/slave.txt | 1 + command.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt index 683289e4a6..73deb5e3a2 100644 --- a/DOCS/tech/slave.txt +++ b/DOCS/tech/slave.txt @@ -514,6 +514,7 @@ stream_pos pos 0 X X position in stream stream_start pos 0 X start pos in stream stream_end pos 0 X end pos in stream stream_length pos 0 X (end - start) +stream_time_pos time 0 X present position in stream (in seconds) chapter int 0 X X X select chapter chapters int X number of chapters angle int 0 X X X select angle diff --git a/command.c b/command.c index 3a9c3aa179..e7cde6d6f3 100644 --- a/command.c +++ b/command.c @@ -371,6 +371,17 @@ static int mp_property_stream_length(m_option_t *prop, int action, return M_PROPERTY_NOT_IMPLEMENTED; } +/// Current stream position in seconds (RO) +static int mp_property_stream_time_pos(m_option_t *prop, int action, + void *arg, MPContext *mpctx) +{ + if (!mpctx->demuxer || mpctx->demuxer->stream_pts == MP_NOPTS_VALUE) + return M_PROPERTY_UNAVAILABLE; + + return m_property_time_ro(prop, action, arg, mpctx->demuxer->stream_pts); +} + + /// Media length in seconds (RO) static int mp_property_length(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -2129,6 +2140,8 @@ static const m_option_t mp_properties[] = { M_OPT_MIN, 0, 0, NULL }, { "stream_length", mp_property_stream_length, CONF_TYPE_POSITION, M_OPT_MIN, 0, 0, NULL }, + { "stream_time_pos", mp_property_stream_time_pos, CONF_TYPE_TIME, + M_OPT_MIN, 0, 0, NULL }, { "length", mp_property_length, CONF_TYPE_TIME, M_OPT_MIN, 0, 0, NULL }, { "percent_pos", mp_property_percent_pos, CONF_TYPE_INT, -- cgit v1.2.3