Index: DOCS/tech/slave.txt =================================================================== --- DOCS/tech/slave.txt (revision 25943) +++ DOCS/tech/slave.txt (working copy) @@ -26,7 +26,12 @@ only if it was not already in paused mode. Please note that "as soon as possible" can be before the command is fully executed. +All commands can be prefixed with "osd_level " to tell MPlayer +use specific osd_level for the following command. +Value of is from 0 to 3. If combined with prefix like "pausing ", +"osd_level " must be in the front of "pausing ". + Available commands ('mplayer -input cmdlist' will print a list): Index: command.c =================================================================== --- command.c (revision 25943) +++ command.c (working copy) @@ -2300,12 +2300,15 @@ sh_audio_t * const sh_audio = mpctx->sh_audio; sh_video_t * const sh_video = mpctx->sh_video; int brk_cmd = 0; + int ori_abs_seek_pos = abs_seek_pos; + int ori_rel_seek_secs = rel_seek_secs; + mpctx->force_osd_level = cmd->osd_level; if (!set_property_command(mpctx, cmd)) switch (cmd->id) { case MP_CMD_SEEK:{ float v; int abs; - if (sh_video) + if (sh_video && mpctx->force_osd_level != 0) mpctx->osd_show_percentage = sh_video->fps; v = cmd->args[0].v.f; abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; @@ -3155,5 +3158,11 @@ if (mpctx->was_paused) mpctx->osd_function = OSD_PAUSE; } + if ((abs_seek_pos != ori_abs_seek_pos || rel_seek_secs != ori_rel_seek_secs) + && (abs_seek_pos || rel_seek_secs)) + mpctx->force_seek_osd_level = mpctx->force_osd_level; + else + mpctx->force_seek_osd_level = -1; + mpctx->force_osd_level = -1; return brk_cmd; } Index: input/input.c =================================================================== --- input/input.c (revision 25943) +++ input/input.c (working copy) @@ -742,6 +742,7 @@ mp_input_parse_cmd(char* str) { int i,l; int pausing = 0; + int osd = -1; char *ptr,*e; mp_cmd_t *cmd; const mp_cmd_t *cmd_def; @@ -754,6 +755,14 @@ while (str[0] == ' ' || str[0] == '\t') ++str; + if (strncmp(str, "osd_level ", 10) == 0) { + str += 10; + osd = strtol(str, &str, 10); + if (*str != ' ') + return NULL; + ++str; + } + if (strncmp(str, "pausing ", 8) == 0) { pausing = 1; str = &str[8]; @@ -789,6 +798,7 @@ cmd->id = cmd_def->id; cmd->name = strdup(cmd_def->name); cmd->pausing = pausing; + cmd->osd_level = osd; ptr = str; Index: input/input.h =================================================================== --- input/input.h (revision 25943) +++ input/input.h (working copy) @@ -189,6 +189,7 @@ int nargs; mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; int pausing; + int osd_level; // -1: default, 0-3: force osd level to the value for this cmd } mp_cmd_t; Index: mplayer.c =================================================================== --- mplayer.c (revision 25943) +++ mplayer.c (working copy) @@ -194,6 +194,8 @@ // Not all functions in mplayer.c take the context as an argument yet static MPContext mpctx_s = { .osd_function = OSD_PLAY, + .force_osd_level = -1, + .force_seek_osd_level = -1, .begin_skip = MP_NOPTS_VALUE, .play_tree_step = 1, .global_sub_pos = -1, @@ -1356,6 +1358,13 @@ va_list va; int r; + // Force to disable osd msgs. + if (mpctx->force_osd_level == 0) + return; + // Force to display osd msgs matching the force_osd_level. + if (mpctx->force_osd_level > 0 && level <= mpctx->force_osd_level) + level = 0; + // look if the id is already in the stack for(msg = osd_msg_stack ; msg && msg->id != id ; last = msg, msg = msg->prev); @@ -1488,7 +1497,8 @@ void set_osd_bar(int type,const char* name,double min,double max,double val) { - if(osd_level < 1) return; + if ((mpctx->force_osd_level < 0 && osd_level < 1) + || mpctx->force_osd_level == 0) return; if(mpctx->sh_video) { osd_visible = (GetTimerMS() + 1000) | 1; @@ -1532,7 +1542,8 @@ if(mpctx->sh_video) { // fallback on the timer - if(osd_level>=2) { + if(osd_level>=2 || + (mpctx->osd_show_percentage && mpctx->force_seek_osd_level>=2)){ int len = demuxer_get_time_length(mpctx->demuxer); int percentage = -1; char percentage_text[10]; @@ -1546,7 +1557,9 @@ else percentage_text[0] = 0; - if (osd_level == 3) + if (osd_level == 3 || + (mpctx->osd_show_percentage && + mpctx->force_seek_osd_level >= 3)) snprintf(osd_text_timer, 63, "%c %02d:%02d:%02d / %02d:%02d:%02d%s", mpctx->osd_function,pts/3600,(pts/60)%60,pts%60, @@ -3836,6 +3849,7 @@ } if(rel_seek_secs || abs_seek_pos){ + mpctx->force_osd_level = mpctx->force_seek_osd_level; if (seek(mpctx, rel_seek_secs, abs_seek_pos) >= 0) { // Set OSD: if(!loop_seek){ @@ -3843,6 +3857,9 @@ set_osd_bar(0,"Position",0,100,demuxer_get_percent_pos(mpctx->demuxer)); } } + if (mpctx->force_seek_osd_level == 0 && mpctx->osd_function != OSD_PAUSE) + mpctx->osd_function = OSD_PLAY; + mpctx->force_osd_level = -1; rel_seek_secs=0; abs_seek_pos=0;