mirror of
https://github.com/mpv-player/mpv
synced 2025-01-15 19:42:53 +00:00
af_scaletempo2: move latency calculation to internal function
This commit is contained in:
parent
0d64f795c7
commit
87cc7ed955
@ -108,9 +108,8 @@ static void process(struct mp_filter *f)
|
||||
|
||||
double pts = mp_aframe_get_pts(p->pending);
|
||||
if (pts != MP_NOPTS_VALUE) {
|
||||
double frame_delay = p->data.input_buffer_frames - p->data.search_block_index
|
||||
+ p->data.num_complete_frames * p->speed
|
||||
+ out_samples * p->speed;
|
||||
double frame_delay = mp_scaletempo2_get_latency(&p->data, p->speed)
|
||||
+ out_samples * p->speed;
|
||||
mp_aframe_set_pts(out, pts - frame_delay / mp_aframe_get_effective_rate(out));
|
||||
}
|
||||
|
||||
|
@ -694,6 +694,12 @@ int mp_scaletempo2_fill_buffer(struct mp_scaletempo2 *p,
|
||||
return rendered_frames;
|
||||
}
|
||||
|
||||
double mp_scaletempo2_get_latency(struct mp_scaletempo2 *p, double playback_rate)
|
||||
{
|
||||
return p->input_buffer_frames - p->search_block_index
|
||||
+ p->num_complete_frames * playback_rate;
|
||||
}
|
||||
|
||||
bool mp_scaletempo2_frames_available(struct mp_scaletempo2 *p)
|
||||
{
|
||||
return can_perform_wsola(p) || p->num_complete_frames > 0;
|
||||
|
@ -114,6 +114,7 @@ struct mp_scaletempo2 {
|
||||
void mp_scaletempo2_destroy(struct mp_scaletempo2 *p);
|
||||
void mp_scaletempo2_reset(struct mp_scaletempo2 *p);
|
||||
void mp_scaletempo2_init(struct mp_scaletempo2 *p, int channels, int rate);
|
||||
double mp_scaletempo2_get_latency(struct mp_scaletempo2 *p, double playback_rate);
|
||||
int mp_scaletempo2_fill_input_buffer(struct mp_scaletempo2 *p,
|
||||
uint8_t **planes, int frame_size, bool final);
|
||||
int mp_scaletempo2_fill_buffer(struct mp_scaletempo2 *p,
|
||||
|
Loading…
Reference in New Issue
Block a user