From 116ca0c768219b10eeee1f68b5b0365916d4b4e0 Mon Sep 17 00:00:00 2001 From: albeu Date: Sun, 23 Apr 2006 14:31:54 +0000 Subject: [PATCH] Add a new command: osd_show_property_text that show an expanded property string on the OSD. Based on a patch 'by someone named "veal" on irc' that showed the filename. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18223 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 2 ++ DOCS/tech/slave.txt | 6 ++++++ etc/input.conf | 2 ++ input/input.c | 2 ++ input/input.h | 1 + mplayer.c | 10 ++++++++++ 6 files changed, 23 insertions(+) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 7c86ef813d..a44dc8cf7e 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -307,6 +307,8 @@ Move subtitles up/down. Set EDL mark. .IPs "s (\-vf screenshot only)" Take a screenshot. +.IPs "I" +Show filename on the OSD. .RE .PD 1 .PP diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt index ef25e3f44d..0f321ee0b4 100644 --- a/DOCS/tech/slave.txt +++ b/DOCS/tech/slave.txt @@ -137,6 +137,12 @@ mute [value] osd [level] Toggle OSD mode or set it to [level] when [level] >= 0. +osd_show_property_text [duration] [level] + Show an expanded property string on the OSD, see -playing-msg for a + description of the available expansions. If [duration] is >= 0 the text + is shown for [duration] ms. [level] set the minimum OSD level needed for + the message to be visible, default to 0 (always show). + osd_show_text Show on the OSD. diff --git a/etc/input.conf b/etc/input.conf index 88e6e7c6cb..7e7a60fb2f 100644 --- a/etc/input.conf +++ b/etc/input.conf @@ -58,6 +58,8 @@ T vo_ontop w panscan -0.1 e panscan +0.1 +I osd_show_property_text "${filename}" + h tv_step_channel 1 l tv_step_channel -1 n tv_step_norm diff --git a/input/input.c b/input/input.c index 651537dc8c..41d4ecf3ae 100644 --- a/input/input.c +++ b/input/input.c @@ -66,6 +66,7 @@ static mp_cmd_t mp_cmds[] = { { MP_CMD_SUB_STEP, "sub_step",1, { { MP_CMD_ARG_INT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, { MP_CMD_OSD, "osd",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } }, { MP_CMD_OSD_SHOW_TEXT, "osd_show_text", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + { MP_CMD_OSD_SHOW_PROPERTY_TEXT, "osd_show_property_text",1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_INT,{-1}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, { MP_CMD_VOLUME, "volume", 1, { { MP_CMD_ARG_FLOAT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, { MP_CMD_MIXER_USEMASTER, "use_master", 0, { {-1,{0}} } }, { MP_CMD_MUTE, "mute", 0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } }, @@ -327,6 +328,7 @@ static mp_cmd_bind_t def_cmd_binds[] = { { { KEY_DEL, 0 }, "alt_src_step -1" }, { { 'o', 0 }, "osd" }, { { 'O', 0 }, "osd" }, + { { 'I', 0 }, "osd_show_property_text \"${filename}\"" }, { { 'z', 0 }, "sub_delay -0.1" }, { { 'x', 0 }, "sub_delay +0.1" }, { { 'g', 0 }, "sub_step -1" }, diff --git a/input/input.h b/input/input.h index 378bc17624..4bc61041fe 100644 --- a/input/input.h +++ b/input/input.h @@ -71,6 +71,7 @@ #define MP_CMD_VO_BORDER 67 #define MP_CMD_SET_PROPERTY 68 #define MP_CMD_GET_PROPERTY 69 +#define MP_CMD_OSD_SHOW_PROPERTY_TEXT 70 #define MP_CMD_GUI_EVENTS 5000 #define MP_CMD_GUI_LOADFILE 5001 diff --git a/mplayer.c b/mplayer.c index 32814dc963..34363edaa9 100644 --- a/mplayer.c +++ b/mplayer.c @@ -4234,6 +4234,16 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still) case MP_CMD_OSD_SHOW_TEXT : { set_osd_msg(OSD_MSG_TEXT,1,osd_duration,"%-.63s",cmd->args[0].v.s); } break; + case MP_CMD_OSD_SHOW_PROPERTY_TEXT : { + char* txt = m_properties_expand_string(mp_properties,cmd->args[0].v.s); + /* if no argument supplied take default osd_duration, otherwise ms. */ + if(txt) { + set_osd_msg(OSD_MSG_TEXT,cmd->args[2].v.i, + (cmd->args[1].v.i < 0 ? osd_duration : cmd->args[1].v.i), + "%-.63s",txt); + free(txt); + } + } break; case MP_CMD_LOADFILE : { play_tree_t* e = play_tree_new(); play_tree_add_file(e,cmd->args[0].v.s);