Ticket #1459: mplayer-quiet-time-2010-06.patch

File mplayer-quiet-time-2010-06.patch, 4.0 KB (added by djtm@…, 15 years ago)

a later patch version after some review

  • stream/cache2.c

     
    143143
    144144    newb=s->max_filepos-s->read_filepos; // new bytes in the buffer
    145145    if(newb<min_fill) min_fill=newb; // statistics...
     146        //if(newb<min_fill) min_fill=newb; // buffer underrun, rebuffer...
    146147
    147148//    printf("*** newb: %d bytes ***\n",newb);
    148149
  • DOCS/man/en/mplayer.1

     
    746746handle carriage return (i.e.\& \\r).
    747747.
    748748.TP
     749.B "\-quiet-time <n>\ "
     750Reduce console output updates to n per tenth of a second.
     751Values of 5 or more work around slow terminals.
     752See \-quiet for more.
     753.
     754.TP
    749755.B \-priority <prio> (Windows and OS/2 only)
    750756Set process priority for MPlayer according to the predefined
    751757priorities available under Windows and OS/2.
  • mplayer.c

     
    9898int slave_mode=0;
    9999int player_idle_mode=0;
    100100int quiet=0;
     101int quiet_time=0;
    101102int enable_mouse_movements=0;
    102103float start_volume = -1;
    103104
     
    20772078
    20782079static void adjust_sync_and_print_status(int between_frames, float timing_error)
    20792080{
     2081    static unsigned last_status_update=0;
     2082    unsigned now=GetTimerMS();
     2083    if (quiet_time && now >= (last_status_update + quiet_time * 100))
     2084        last_status_update=now;
     2085
    20802086    current_module="av_sync";
    2081 
     2087   
    20822088    if(mpctx->sh_audio){
    20832089        double a_pts, v_pts;
    20842090
     
    21282134                c_total+=x;
    21292135            }
    21302136            if(!quiet)
    2131                 print_status(a_pts - audio_delay, AV_delay, c_total);
     2137                if (!quiet_time || (last_status_update == now))
     2138                    print_status(a_pts - audio_delay, AV_delay, c_total);
    21322139        }
    21332140
    21342141    } else {
    21352142        // No audio:
    21362143
    21372144        if (!quiet)
    2138             print_status(0, 0, 0);
     2145            if (!quiet_time || (last_status_update == now))
     2146                print_status(0, 0, 0);
    21392147    }
    21402148}
    21412149
  • cfg-common.h

     
    300300    {"quiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
    301301    {"noquiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
    302302    {"really-quiet", &verbose, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL},
     303    {"quiet-time", &quiet_time, CONF_TYPE_INT, CONF_RANGE, 0, 65536, NULL},
    303304    {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
    304305    {"msglevel", msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
    305306    {"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
  • mencoder.c

     
    139139
    140140int out_file_format=MUXER_TYPE_AVI;     // default to AVI
    141141int quiet=0;
     142int quiet_time=0;
    142143double video_time_usage=0;
    143144double vout_time_usage=0;
    144145double max_video_time_usage=0;
     
    16391640             / (float)(sh_audio->audio.dwLength);
    16401641        }
    16411642#endif
     1643    static unsigned last_status_update=0;
     1644    unsigned now=GetTimerMS();
     1645    if (quiet_time && now >= (last_status_update + quiet_time * 100))
     1646       last_status_update=now;
     1647
    16421648      if(!quiet) {
    16431649        if( mp_msg_test(MSGT_STATUSLINE,MSGL_V) ) {
     1650                if (!quiet_time || (last_status_update == now))
    16441651                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",
    16451652                mux_v->timer, decoded_frameno, (int)(p*100),
    16461653                (t>1) ? (int)(decoded_frameno/t+0.5) : 0,
     
    16531660                        duplicatedframes, badframes, skippedframes
    16541661                );
    16551662        } else
     1663        if (!quiet_time || (last_status_update == now))
    16561664        mp_msg(MSGT_STATUSLINE,MSGL_STATUS,"Pos:%6.1fs %6df (%2d%%) %5.2ffps Trem:%4dmin %3dmb  A-V:%5.3f [%d:%d]\r",
    16571665            mux_v->timer, decoded_frameno, (int)(p*100),
    16581666            (t>1) ? (float)(decoded_frameno/t) : 0,