return 0;
}
-static int _filter_add_video(simp_avio_t* io)
+static int _filter_add_video(simp_avio_t* io, AVRational speed)
{
simp_frame_t* vf;
scf_list_t* vl;
int64_t time = gettime() - io->start_time;
int64_t vtime = vf->frame->pts * av_q2d(io->frame_rate) * 1000000LL;
+ if (speed.num > 0 && speed.den > 0)
+ time *= av_q2d(speed);
+
+ else if (io->speed.num > 0 && io->speed.num > 0)
+ time *= av_q2d(io->speed);
+
if (vtime < time) {
scf_list_del(&vf->list);
io->nb_vframes--;
return 0;
}
-static int _filter_add_audio(simp_avio_t* io)
+static int _filter_add_audio(simp_avio_t* io, AVRational speed)
{
simp_frame_t* af;
scf_list_t* al;
while (!f->exit) {
- usleep(500 * 1000);
+ usleep(1000);
for (l = scf_list_head(&f->inputs); l != scf_list_sentinel(&f->inputs); l = scf_list_next(l)) {
io = scf_list_data(l, simp_avio_t, list);
simp_avio_stop(io);
if (io->vopen) {
- f->error = _filter_add_video(io);
+ f->error = _filter_add_video(io, f->speed);
if (f->error < 0)
goto error;
}
if (io->aopen) {
- f->error = _filter_add_audio(io);
+ f->error = _filter_add_audio(io, f->speed);
if (f->error < 0)
goto error;