mirror of https://github.com/mpv-player/mpv
player: fix --end for backwards playback
We need to transform the timestamp returned by get_play_end_pts(). I considered making it return the transformed timestamp directly. There are 4 callers; 2 need a transformed timestamps, 2 don't. So I guess it doesn't matter.
This commit is contained in:
parent
aebccb8801
commit
f68d9e75f8
|
@ -736,6 +736,8 @@ static int filter_audio(struct MPContext *mpctx, struct mp_audio_buffer *outbuf,
|
||||||
struct ao_chain *ao_c = mpctx->ao_chain;
|
struct ao_chain *ao_c = mpctx->ao_chain;
|
||||||
|
|
||||||
double endpts = get_play_end_pts(mpctx);
|
double endpts = get_play_end_pts(mpctx);
|
||||||
|
if (endpts != MP_NOPTS_VALUE)
|
||||||
|
endpts *= mpctx->play_dir;
|
||||||
|
|
||||||
bool eof = false;
|
bool eof = false;
|
||||||
if (!copy_output(mpctx, ao_c, minsamples, endpts, &eof))
|
if (!copy_output(mpctx, ao_c, minsamples, endpts, &eof))
|
||||||
|
|
|
@ -483,6 +483,8 @@ static int video_output_image(struct MPContext *mpctx)
|
||||||
}
|
}
|
||||||
if (img) {
|
if (img) {
|
||||||
double endpts = get_play_end_pts(mpctx);
|
double endpts = get_play_end_pts(mpctx);
|
||||||
|
if (endpts != MP_NOPTS_VALUE)
|
||||||
|
endpts *= mpctx->play_dir;
|
||||||
if ((endpts != MP_NOPTS_VALUE && img->pts >= endpts) ||
|
if ((endpts != MP_NOPTS_VALUE && img->pts >= endpts) ||
|
||||||
mpctx->max_frames == 0)
|
mpctx->max_frames == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue