Ticket #1459: mplayerquiettime-new-v6.diff

File mplayerquiettime-new-v6.diff, 3.5 KB (added by hhaamu@…, 17 years ago)

patch v2

  • DOCS/man/en/mplayer.1

     
    730730(i.e.\& A:   0.7 V:   0.6 A-V:  0.068 ...) from being displayed.
    731731Particularly useful on slow terminals or broken ones which do not properly
    732732handle carriage return (i.e.\& \\r).
     733See also: \-status\-rate\-max
    733734.
    734735.TP
    735736.B \-priority <prio> (Windows and OS/2 only)
     
    759760Show the description and content of a profile.
    760761.
    761762.TP
     763.B "\-status\-rate\-max <n>\ "
     764Reduce status line updates to a maximum of one per n milliseconds.
     765Values of 500 or more work around slow terminals.
     766See \-quiet for more.
     767.
     768.TP
    762769.B \-use\-filedir\-conf
    763770Look for a file-specific configuration file in the same directory as
    764771the file that is being played.
  • mplayer.c

     
    7979int slave_mode=0;
    8080int player_idle_mode=0;
    8181int quiet=0;
     82int quiet_time=0;
    8283int enable_mouse_movements=0;
    8384float start_volume = -1;
    8485
     
    11831184  int width;
    11841185  char *line;
    11851186  unsigned pos = 0;
     1187
     1188  static unsigned int last_status_update = 0;
     1189
     1190  if (quiet_time) {
     1191    unsigned int now = GetTimerMS();
     1192    if (now - last_status_update >= quiet_time)
     1193      last_status_update = now;
     1194    else
     1195      return;
     1196  }
     1197
    11861198  get_screen_size();
    11871199  if (screen_width > 0)
    11881200    width = screen_width;
  • cfg-common-opts.h

     
    88// ------------------------- common options --------------------
    99        {"quiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
    1010        {"noquiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
     11        {"status-rate-max", &quiet_time, CONF_TYPE_INT, CONF_RANGE, 0, 65536, NULL},
    1112        {"really-quiet", &verbose, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL},
    1213        {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
    1314        {"msglevel", msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
  • mencoder.c

     
    126126//void resync_audio_stream(sh_audio_t *sh_audio){}
    127127
    128128int quiet=0;
     129int quiet_time=0;
    129130double video_time_usage=0;
    130131double vout_time_usage=0;
    131132double max_video_time_usage=0;
     
    14021403        off_t pos = demuxer->filepos >= 0 ? demuxer->filepos : stream_tell(demuxer->stream);
    14031404        float p=len>1000 ? (float)(pos-demuxer->movi_start) / len :
    14041405                (demuxer_get_percent_pos(demuxer) / 100.0);
     1406
     1407        static unsigned int last_status_update = 0;
     1408        int update_status = !quiet && !quiet_time;
     1409        if (!quiet && quiet_time) {
     1410            unsigned int now = GetTimerMS();
     1411            if (now - last_status_update >= quiet_time) {
     1412                last_status_update = now;
     1413                update_status = 1;
     1414            }
     1415        }
    14051416#if 0
    14061417        if(!len && sh_audio && sh_audio->audio.dwLength>100){
    14071418            p=(sh_audio->audio.dwSampleSize? ds_tell(sh_audio->ds)/sh_audio->audio.dwSampleSize : sh_audio->ds->block_no)
     
    14141425            (int)demuxer->filepos,
    14151426            (int)demuxer->movi_end);
    14161427#else
    1417       if(!quiet) {
     1428      if(update_status) {
    14181429        if( mp_msg_test(MSGT_STATUSLINE,MSGL_V) ) {
    14191430                mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"Pos:%6.1fs %6df (%2d%%) %3dfps Trem:%4dmin %3dmb  A-V:%5.3f [%d:%d] A/Vms %d/%d D/B/S %d/%d/%d \r",
    14201431                mux_v->timer, decoded_frameno, (int)(p*100),