diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-21 06:55:23 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-23 13:48:37 +0300 |
commit | d9aa368a6d8dcbea2cd03b6c2a6c2e6df5fc16ce (patch) | |
tree | ece2fdab0e72728938932170191d9508b5313c7b | |
parent | c2a36d9264313d00f696bb7decff55877fc7596e (diff) | |
download | mpv-d9aa368a6d8dcbea2cd03b6c2a6c2e6df5fc16ce.tar.bz2 mpv-d9aa368a6d8dcbea2cd03b6c2a6c2e6df5fc16ce.tar.xz |
Move playback_speed to options struct
-rw-r--r-- | cfg-common-opts.h | 2 | ||||
-rw-r--r-- | cfg-common.h | 1 | ||||
-rw-r--r-- | command.c | 34 | ||||
-rw-r--r-- | defaultopts.c | 1 | ||||
-rw-r--r-- | mencoder.c | 37 | ||||
-rw-r--r-- | mp_core.h | 4 | ||||
-rw-r--r-- | mplayer.c | 57 | ||||
-rw-r--r-- | options.h | 1 |
8 files changed, 69 insertions, 68 deletions
diff --git a/cfg-common-opts.h b/cfg-common-opts.h index f54b533a17..ac5572a860 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h @@ -175,7 +175,7 @@ {"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL}, {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 1, 6, NULL}, {"format", &audio_output_format, CONF_TYPE_AFMT, 0, 0, 0, NULL}, - {"speed", &playback_speed, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL}, + FLOATRANGE("speed", playback_speed, 0.01, 100.0, 0), // set a-v distance {"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL}, diff --git a/cfg-common.h b/cfg-common.h index c3438c24b5..7fb13bf0b9 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -384,5 +384,6 @@ int dvd_parse_chapter_range(const m_option_t*, const char*); #define FLAG_CONSTANTS(optname, varname, offvalue, value, flags) {optname, NULL, CONF_TYPE_FLAG, flags, offvalue, value, NULL, 1, offsetof(struct MPOpts, varname)} #define STRINGLIST(optname, varname, flags) {optname, NULL, CONF_TYPE_STRING_LIST, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)} #define INTRANGE(optname, varname, min, max, flags) {optname, NULL, CONF_TYPE_INT, (flags)|CONF_RANGE, min, max, NULL, 1, offsetof(struct MPOpts, varname)} +#define FLOATRANGE(optname, varname, min, max, flags) {optname, NULL, CONF_TYPE_FLOAT, (flags)|CONF_RANGE, min, max, NULL, 1, offsetof(struct MPOpts, varname)} #endif /* MPLAYER_CFG_COMMON_H */ @@ -196,23 +196,24 @@ static int mp_property_loop(m_option_t * prop, int action, void *arg, static int mp_property_playback_speed(m_option_t * prop, int action, void *arg, MPContext * mpctx) { + struct MPOpts *opts = &mpctx->opts; switch (action) { case M_PROPERTY_SET: if (!arg) return M_PROPERTY_ERROR; M_PROPERTY_CLAMP(prop, *(float *) arg); - playback_speed = *(float *) arg; + opts->playback_speed = *(float *) arg; build_afilter_chain(mpctx, mpctx->sh_audio, &ao_data); return M_PROPERTY_OK; case M_PROPERTY_STEP_UP: case M_PROPERTY_STEP_DOWN: - playback_speed += (arg ? *(float *) arg : 0.1) * + opts->playback_speed += (arg ? *(float *) arg : 0.1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); - M_PROPERTY_CLAMP(prop, playback_speed); + M_PROPERTY_CLAMP(prop, opts->playback_speed); build_afilter_chain(mpctx, mpctx->sh_audio, &ao_data); return M_PROPERTY_OK; } - return m_property_float_range(prop, action, arg, &playback_speed); + return m_property_float_range(prop, action, arg, &opts->playback_speed); } /// filename with path (RO) @@ -374,9 +375,7 @@ static int mp_property_time_pos(m_option_t * prop, int action, } return m_property_time_ro(prop, action, arg, mpctx->sh_video ? mpctx->sh_video->pts : - playing_audio_pts(mpctx->sh_audio, - mpctx->d_audio, - mpctx->audio_out)); + playing_audio_pts(mpctx)); } /// Current chapter (RW) @@ -2288,6 +2287,7 @@ static int set_property_command(MPContext * mpctx, mp_cmd_t * cmd) int run_command(MPContext * mpctx, mp_cmd_t * cmd) { + struct MPOpts *opts = &mpctx->opts; sh_audio_t * const sh_audio = mpctx->sh_audio; sh_video_t * const sh_video = mpctx->sh_video; int brk_cmd = 0; @@ -2391,9 +2391,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd) case MP_CMD_EDL_MARK: if (edl_fd) { float v = sh_video ? sh_video->pts : - playing_audio_pts(sh_audio, mpctx->d_audio, - mpctx->audio_out); - + playing_audio_pts(mpctx); if (mpctx->begin_skip == MP_NOPTS_VALUE) { mpctx->begin_skip = v; mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutStartSkip); @@ -2419,26 +2417,26 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd) case MP_CMD_SPEED_INCR:{ float v = cmd->args[0].v.f; - playback_speed += v; + opts->playback_speed += v; build_afilter_chain(mpctx, sh_audio, &ao_data); set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed, - playback_speed); + opts->playback_speed); } break; case MP_CMD_SPEED_MULT:{ float v = cmd->args[0].v.f; - playback_speed *= v; + opts->playback_speed *= v; build_afilter_chain(mpctx, sh_audio, &ao_data); set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed, - playback_speed); + opts->playback_speed); } break; case MP_CMD_SPEED_SET:{ float v = cmd->args[0].v.f; - playback_speed = v; + opts->playback_speed = v; build_afilter_chain(mpctx, sh_audio, &ao_data); set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed, - playback_speed); + opts->playback_speed); } break; case MP_CMD_FRAME_STEP: @@ -3055,9 +3053,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd) if (sh_video) pos = sh_video->pts; else if (sh_audio && mpctx->audio_out) - pos = - playing_audio_pts(sh_audio, mpctx->d_audio, - mpctx->audio_out); + pos = playing_audio_pts(mpctx); mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_TIME_POSITION=%.1f\n", pos); } break; diff --git a/defaultopts.c b/defaultopts.c index f0c2483fd2..d9d65747b5 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -10,6 +10,7 @@ void set_default_mplayer_options(struct MPOpts *opts) .fixed_vo = 0, .loop_times = -1, .user_correct_pts = -1, + .playback_speed = 1., }; } diff --git a/mencoder.c b/mencoder.c index 8c429fa615..d47a1cded2 100644 --- a/mencoder.c +++ b/mencoder.c @@ -166,7 +166,6 @@ static int audio_density=2; double force_fps=0; static double force_ofps=0; // set to 24 for inverse telecine static int skip_limit=-1; -float playback_speed=1.0; static int force_srate=0; static int audio_output_format=0; @@ -673,7 +672,7 @@ sh_video=d_video->sh; mencoder_exit(1,NULL); } -if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_speed != 1.0)){ +if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || opts.playback_speed != 1.0)){ // Go through the codec.conf and find the best codec... mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); if(!init_best_audio_codec(sh_audio,audio_codec_list,audio_fm_list)){ @@ -684,12 +683,12 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee if (sh_audio) { new_srate = sh_audio->samplerate; - if (playback_speed != 1.0) { - new_srate *= playback_speed; + if (opts.playback_speed != 1.0) { + new_srate *= opts.playback_speed; // limits are taken from libaf/af_resample.c if (new_srate < 8000) new_srate = 8000; if (new_srate > 192000) new_srate = 192000; - playback_speed = (float)new_srate / (float)sh_audio->samplerate; + opts.playback_speed = (float)new_srate / (float)sh_audio->samplerate; } } @@ -789,14 +788,14 @@ mux_v->source=sh_video; mux_v->h.dwSampleSize=0; // VBR #ifdef USE_LIBAVCODEC { - double fps = force_ofps?force_ofps:sh_video->fps*playback_speed; + double fps = force_ofps?force_ofps:sh_video->fps*opts.playback_speed; AVRational q= av_d2q(fps, fps*1001+2); mux_v->h.dwScale= q.den; mux_v->h.dwRate = q.num; } #else mux_v->h.dwScale=10000; -mux_v->h.dwRate=mux_v->h.dwScale*(force_ofps?force_ofps:sh_video->fps*playback_speed); +mux_v->h.dwRate=mux_v->h.dwScale*(force_ofps?force_ofps:sh_video->fps*opts.playback_speed); #endif mux_v->codec=out_video_codec; @@ -972,7 +971,7 @@ if(mux_a->codec != ACODEC_COPY) { } switch(mux_a->codec){ case ACODEC_COPY: - if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); + if (opts.playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); if (sh_audio->format >= 0x10000) { mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantCopyAudioFormat, sh_audio->format); mencoder_exit(1,NULL); @@ -1000,8 +999,8 @@ case ACODEC_COPY: mux_a->h.dwScale=mux_a->h.dwSampleSize; mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec; } - mux_a->h.dwRate *= playback_speed; - mux_a->wf->nSamplesPerSec *= playback_speed; + mux_a->h.dwRate *= opts.playback_speed; + mux_a->wf->nSamplesPerSec *= opts.playback_speed; mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec, mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize); @@ -1031,17 +1030,17 @@ else { mencoder_exit(1,NULL); } if (sh_audio && mux_a->codec == ACODEC_COPY) { - if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); + if (opts.playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec, mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize); if (sh_audio->wf) { if ((mux_a->wf->wFormatTag != sh_audio->wf->wFormatTag) || (mux_a->wf->nChannels != sh_audio->wf->nChannels) || - (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * playback_speed)) + (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * opts.playback_speed)) { mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, - sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * playback_speed), + sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * opts.playback_speed), sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); mencoder_exit(1,NULL); @@ -1049,10 +1048,10 @@ else { } else { if ((mux_a->wf->wFormatTag != sh_audio->format) || (mux_a->wf->nChannels != sh_audio->channels) || - (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * playback_speed)) + (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * opts.playback_speed)) { mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, - sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * playback_speed), + sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * opts.playback_speed), sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); mencoder_exit(1,NULL); @@ -1279,7 +1278,7 @@ if(sh_audio){ frame_data.in_size=video_read_frame(sh_video,&frame_data.frame_time,&frame_data.start,force_fps); sh_video->timer+=frame_data.frame_time; } - frame_data.frame_time /= playback_speed; + frame_data.frame_time /= opts.playback_speed; if(frame_data.in_size<0){ at_eof=1; break; } ++decoded_frameno; @@ -1428,7 +1427,7 @@ if(sh_audio && !demuxer2){ // av = compensated (with out buffering delay) A-V diff AV_delay=(a_pts-v_pts); AV_delay-=audio_delay; - AV_delay /= playback_speed; + AV_delay /= opts.playback_speed; AV_delay-=mux_a->timer-(mux_v->timer-(v_timer_corr+v_pts_corr)); // adjust for encoder delays AV_delay -= (float) mux_a->encoder_delay * mux_a->h.dwScale/mux_a->h.dwRate; @@ -1438,9 +1437,9 @@ if(sh_audio && !demuxer2){ if(x<-max_pts_correction) x=-max_pts_correction; else if(x> max_pts_correction) x= max_pts_correction; if(default_max_pts_correction>=0) - max_pts_correction=default_max_pts_correction*playback_speed; + max_pts_correction=default_max_pts_correction*opts.playback_speed; else - max_pts_correction=sh_video->frametime*0.10 *playback_speed; // +-10% of time + max_pts_correction=sh_video->frametime*0.10 *opts.playback_speed; // +-10% of time // sh_video->timer-=x; c_total+=x; v_pts_corr+=x; @@ -115,7 +115,6 @@ typedef struct MPContext { extern FILE *edl_fd; extern int file_filter; // These appear in options list -extern float playback_speed; extern int forced_subs_only; @@ -123,8 +122,7 @@ int build_afilter_chain(struct MPContext *mpctx, sh_audio_t *sh_audio, ao_data_t void uninit_player(struct MPContext *mpctx, unsigned int mask); void reinit_audio_chain(struct MPContext *mpctx); void init_vo_spudec(struct MPContext *mpctx); -double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio, - const ao_functions_t *audio_out); +double playing_audio_pts(struct MPContext *mpctx); void exit_player_with_rc(struct MPContext *mpctx, const char* how, int rc); void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr); int reinit_video_chain(struct MPContext *mpctx); @@ -205,8 +205,6 @@ int benchmark=0; int auto_quality=0; static int output_quality=0; -float playback_speed=1.0; - int use_gui=0; #ifdef HAVE_NEW_GUI @@ -1176,6 +1174,7 @@ static void sadd_hhmmssf(char *buf, unsigned *pos, int len, float time) { */ static void print_status(struct MPContext *mpctx, float a_pos, float a_v, float corr) { + struct MPOpts *opts = &mpctx->opts; sh_video_t * const sh_video = mpctx->sh_video; int width; char *line; @@ -1223,9 +1222,9 @@ static void print_status(struct MPContext *mpctx, float a_pos, float a_v, float if (sh_video) { if (sh_video->timer > 0.5) saddf(line, &pos, width, "%2d%% %2d%% %4.1f%% ", - (int)(100.0*video_time_usage*playback_speed/(double)sh_video->timer), - (int)(100.0*vout_time_usage*playback_speed/(double)sh_video->timer), - (100.0*audio_time_usage*playback_speed/(double)sh_video->timer)); + (int)(100.0*video_time_usage*opts->playback_speed/(double)sh_video->timer), + (int)(100.0*vout_time_usage*opts->playback_speed/(double)sh_video->timer), + (100.0*audio_time_usage*opts->playback_speed/(double)sh_video->timer)); else saddf(line, &pos, width, "??%% ??%% ??,?%% "); } else if (mpctx->sh_audio) { @@ -1247,8 +1246,8 @@ static void print_status(struct MPContext *mpctx, float a_pos, float a_v, float #endif // other - if (playback_speed != 1) - saddf(line, &pos, width, "%4.2fx ", playback_speed); + if (opts->playback_speed != 1) + saddf(line, &pos, width, "%4.2fx ", opts->playback_speed); // end if (erase_to_end_of_line) { @@ -1270,6 +1269,7 @@ static void print_status(struct MPContext *mpctx, float a_pos, float a_v, float */ int build_afilter_chain(struct MPContext *mpctx, sh_audio_t *sh_audio, ao_data_t *ao_data) { + struct MPOpts *opts = &mpctx->opts; int new_srate; int result; if (!sh_audio) @@ -1282,17 +1282,17 @@ int build_afilter_chain(struct MPContext *mpctx, sh_audio_t *sh_audio, ao_data_t } if(af_control_any_rev(sh_audio->afilter, AF_CONTROL_PLAYBACK_SPEED | AF_CONTROL_SET, - &playback_speed)) { + &opts->playback_speed)) { new_srate = sh_audio->samplerate; } else { - new_srate = sh_audio->samplerate * playback_speed; + new_srate = sh_audio->samplerate * opts->playback_speed; if (new_srate != ao_data->samplerate) { // limits are taken from libaf/af_resample.c if (new_srate < 8000) new_srate = 8000; if (new_srate > 192000) new_srate = 192000; - playback_speed = (float)new_srate / (float)sh_audio->samplerate; + opts->playback_speed = (float)new_srate / (float)sh_audio->samplerate; } } result = init_audio_filters(sh_audio, new_srate, @@ -1636,8 +1636,10 @@ if(mpctx->sh_audio){ // Return pts value corresponding to the end point of audio written to the // ao so far. -static double written_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio) +static double written_audio_pts(struct MPContext *mpctx) { + sh_audio_t *sh_audio = mpctx->sh_audio; + demux_stream_t *d_audio = mpctx->d_audio; double buffered_output; // first calculate the end pts of audio that has been output by decoder double a_pts = sh_audio->pts; @@ -1680,25 +1682,25 @@ static double written_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio) // Filters divide audio length by playback_speed, so multiply by it // to get the length in original units without speedup or slowdown - a_pts -= buffered_output * playback_speed / ao_data.bps; + a_pts -= buffered_output * mpctx->opts.playback_speed / ao_data.bps; return a_pts; } // Return pts value corresponding to currently playing audio. -double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio, - const ao_functions_t *audio_out) +double playing_audio_pts(struct MPContext *mpctx) { - return written_audio_pts(sh_audio, d_audio) - playback_speed * - audio_out->get_delay(); + return written_audio_pts(mpctx) - mpctx->opts.playback_speed * + mpctx->audio_out->get_delay(); } static int check_framedrop(struct MPContext *mpctx, double frame_time) { + struct MPOpts *opts = &mpctx->opts; // check for frame-drop: current_module = "check_framedrop"; if (mpctx->sh_audio && !mpctx->d_audio->eof) { static int dropped_frames; - float delay = playback_speed*mpctx->audio_out->get_delay(); + float delay = opts->playback_speed*mpctx->audio_out->get_delay(); float d = delay-mpctx->delay; ++total_frame_cnt; // we should avoid dropping too many frames in sequence unless we @@ -1930,6 +1932,7 @@ static void adjust_sync_and_print_status(struct MPContext *mpctx, int between_frames, float timing_error) { + struct MPOpts *opts = &mpctx->opts; current_module="av_sync"; if(mpctx->sh_audio){ @@ -1947,9 +1950,9 @@ static void adjust_sync_and_print_status(struct MPContext *mpctx, * value here, even a "corrected" one, would be incompatible with * autosync mode.) */ - a_pts = written_audio_pts(mpctx->sh_audio, mpctx->d_audio) - mpctx->delay; + a_pts = written_audio_pts(mpctx) - mpctx->delay; else - a_pts = playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out); + a_pts = playing_audio_pts(mpctx); v_pts = mpctx->sh_video->pts; @@ -1967,7 +1970,7 @@ static void adjust_sync_and_print_status(struct MPContext *mpctx, /* Do not correct target time for the next frame if this frame * was late not because of wrong target time but because the * target time could not be met */ - x = (AV_delay + timing_error * playback_speed) * 0.1f; + x = (AV_delay + timing_error * opts->playback_speed) * 0.1f; if (x < -max_pts_correction) x = -max_pts_correction; else if (x> max_pts_correction) @@ -1994,6 +1997,7 @@ static void adjust_sync_and_print_status(struct MPContext *mpctx, static int fill_audio_out_buffers(struct MPContext *mpctx) { + struct MPOpts *opts = &mpctx->opts; unsigned int t; double tt; int playsize; @@ -2057,7 +2061,7 @@ static int fill_audio_out_buffers(struct MPContext *mpctx) sh_audio->a_out_buffer_len -= playsize; memmove(sh_audio->a_out_buffer, &sh_audio->a_out_buffer[playsize], sh_audio->a_out_buffer_len); - mpctx->delay += playback_speed*playsize/(double)ao_data.bps; + mpctx->delay += opts->playback_speed*playsize/(double)ao_data.bps; } else if (audio_eof && mpctx->audio_out->get_delay() < .04) { // Sanity check to avoid hanging in case current ao doesn't output @@ -2072,6 +2076,7 @@ static int fill_audio_out_buffers(struct MPContext *mpctx) static int sleep_until_update(struct MPContext *mpctx, float *time_frame, float *aq_sleep_time) { + struct MPOpts *opts = &mpctx->opts; int frame_time_remaining = 0; current_module="calc_sleep_time"; @@ -2091,12 +2096,12 @@ static int sleep_until_update(struct MPContext *mpctx, float *time_frame, * sync to settle at the right value (but it eventually will.) * This settling time is very short for values below 100. */ - float predicted = mpctx->delay / playback_speed + *time_frame; + float predicted = mpctx->delay / opts->playback_speed + *time_frame; float difference = delay - predicted; delay = predicted + difference / (float)autosync; } - *time_frame = delay - mpctx->delay / playback_speed; + *time_frame = delay - mpctx->delay / opts->playback_speed; // delay = amount of audio buffered in soundcard/driver if (delay > 0.25) delay=0.25; else @@ -3707,7 +3712,7 @@ if(!mpctx->sh_video) { // handle audio-only case: double a_pos=0; if(!quiet || end_at.type == END_AT_TIME ) - a_pos = playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out); + a_pos = playing_audio_pts(mpctx); if(!quiet) print_status(mpctx, a_pos, 0, 0); @@ -3735,7 +3740,7 @@ if(!mpctx->sh_video) { else { // might return with !eof && !blit_frame if !correct_pts mpctx->num_buffered_frames += blit_frame; - time_frame += frame_time / playback_speed; // for nosound + time_frame += frame_time / opts->playback_speed; // for nosound } } @@ -3903,7 +3908,7 @@ if(mpctx->rel_seek_secs || mpctx->abs_seek_pos){ guiIntfStruct.Position=demuxer_get_percent_pos(mpctx->demuxer); } if ( mpctx->sh_video ) guiIntfStruct.TimeSec=mpctx->sh_video->pts; - else if ( mpctx->sh_audio ) guiIntfStruct.TimeSec=playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out); + else if ( mpctx->sh_audio ) guiIntfStruct.TimeSec=playing_audio_pts(mpctx); guiIntfStruct.LengthInSec=demuxer_get_time_length(mpctx->demuxer); guiGetEvent( guiReDraw,NULL ); guiGetEvent( guiSetVolume,NULL ); @@ -12,6 +12,7 @@ typedef struct MPOpts { int correct_pts; int loop_times; int user_correct_pts; + float playback_speed; } MPOpts; #endif |