summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-05-18 11:38:06 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-05-18 11:38:06 +0000
commit2b1bb59996062819fe27549199332c0b845002d4 (patch)
treefd46f2e485a875e7faebb022fb8b1c872912c318
parent1994533f941b8c66708782006070d8aa1fc29ba8 (diff)
downloadmpv-2b1bb59996062819fe27549199332c0b845002d4.tar.bz2
mpv-2b1bb59996062819fe27549199332c0b845002d4.tar.xz
new get_time_pos slave mode commando
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15505 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/tech/slave.txt3
-rw-r--r--help/help_mp-en.h1
-rw-r--r--input/input.c1
-rw-r--r--input/input.h1
-rw-r--r--mplayer.c9
5 files changed, 15 insertions, 0 deletions
diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt
index 09a96e83d5..06274f5e2e 100644
--- a/DOCS/tech/slave.txt
+++ b/DOCS/tech/slave.txt
@@ -132,6 +132,9 @@ vobsub_lang
get_percent_pos
Print out the current position in the file, as integer percentage [0-100).
+get_time_pos
+ Print out the current position in the file in seconds, as float.
+
get_time_length
Print out the length of the current file in seconds.
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index a8ea0a1555..8b15f4f81f 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -172,6 +172,7 @@ static char help_text[]=
#define MSGTR_AnsLength "ANS_LENGTH=%ld\n"
#define MSGTR_AnsVoFullscreen "ANS_VO_FULLSCREEN=%ld\n"
#define MSGTR_AnsPercentPos "ANS_PERCENT_POSITION=%ld\n"
+#define MSGTR_AnsTimePos "ANS_TIME_POSITION=%.1f\n"
#define MSGTR_DvdnavNullEvent "DVDNAV Event NULL?!\n"
#define MSGTR_DvdnavHighlightEventBroken "DVDNAV Event: Highlight event broken\n"
#define MSGTR_DvdnavEvent "DVDNAV Event: %s\n"
diff --git a/input/input.c b/input/input.c
index 8cdf552432..3a9456566d 100644
--- a/input/input.c
+++ b/input/input.c
@@ -81,6 +81,7 @@ static mp_cmd_t mp_cmds[] = {
{ MP_CMD_SUB_SELECT, "sub_select", 0, { { MP_CMD_ARG_INT,{-2} }, {-1,{0}} } },
{ MP_CMD_SUB_LOG, "sub_log", 0, { {-1,{0}} } },
{ MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } },
+ { MP_CMD_GET_TIME_POS, "get_time_pos", 0, { {-1,{0}} } },
{ MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } },
{ MP_CMD_SWITCH_AUDIO, "switch_audio", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } },
#ifdef USE_TV
diff --git a/input/input.h b/input/input.h
index de0a64962f..72f3ff07f6 100644
--- a/input/input.h
+++ b/input/input.h
@@ -64,6 +64,7 @@
#define MP_CMD_RUN 60
#define MP_CMD_SUB_LOG 61
#define MP_CMD_SWITCH_AUDIO 62
+#define MP_CMD_GET_TIME_POS 63
#define MP_CMD_GUI_EVENTS 5000
#define MP_CMD_GUI_LOADFILE 5001
diff --git a/mplayer.c b/mplayer.c
index bb99bc4937..cbaf8b2e11 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3503,6 +3503,15 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
case MP_CMD_GET_PERCENT_POS : {
mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_AnsPercentPos, demuxer_get_percent_pos(demuxer));
} break;
+ case MP_CMD_GET_TIME_POS : {
+ float pos = 0;
+ if (sh_video)
+ pos = sh_video->pts;
+ else
+ if (sh_audio && audio_out)
+ pos = sh_audio->delay - audio_out->get_delay() * playback_speed;
+ mp_msg(MSGT_GLOBAL, MSGL_INFO, MSGTR_AnsTimePos, pos);
+ } break;
case MP_CMD_SWITCH_AUDIO : {
int v = demuxer_switch_audio(demuxer, cmd->args[0].v.i);
if (identify)