Ticket #1459: mplayerquiettime-new-v5.diff

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

patch

  • DOCS/man/en/mplayer.1

     
    732732handle carriage return (i.e.\& \\r).
    733733.
    734734.TP
     735.B "\-status-rate-max <n>\ "
     736Reduce status line updates to a maximum of one per n milliseconds.
     737Values of 500 or more work around slow terminals.
     738See \-quiet for more.
     739.
     740.TP
    735741.B \-priority <prio> (Windows and OS/2 only)
    736742Set process priority for MPlayer according to the predefined
    737743priorities available under Windows and OS/2.
  • 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  int update_status = 1;
     1190
     1191  if (!quiet && quiet_time) {
     1192    unsigned int now = GetTimerMS();
     1193    if (now - last_status_update >= quiet_time)
     1194      last_status_update = now;
     1195    else
     1196      update_status = 0;
     1197  }
     1198  if (!update_status)
     1199    return;
     1200
    11861201  get_screen_size();
    11871202  if (screen_width > 0)
    11881203    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),