mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 17:32:06 +00:00
avfilter/f_reverse: readjust frame timestamps for areverse
This commit is contained in:
parent
0370c3e3d4
commit
45dc668aea
@ -33,6 +33,7 @@ typedef struct ReverseContext {
|
||||
unsigned int pts_size;
|
||||
int64_t *pts;
|
||||
int flush_idx;
|
||||
int64_t nb_samples;
|
||||
} ReverseContext;
|
||||
|
||||
static av_cold int init(AVFilterContext *ctx)
|
||||
@ -249,7 +250,8 @@ static int areverse_request_frame(AVFilterLink *outlink)
|
||||
|
||||
if (ret == AVERROR_EOF && s->nb_frames > 0) {
|
||||
AVFrame *out = s->frames[s->nb_frames - 1];
|
||||
out->pts = s->pts[s->flush_idx++];
|
||||
out->pts = s->pts[s->flush_idx++] - s->nb_samples;
|
||||
s->nb_samples += s->pts[s->flush_idx] - s->pts[s->flush_idx - 1] - out->nb_samples;
|
||||
|
||||
if (av_sample_fmt_is_planar(out->format))
|
||||
reverse_samples_planar(out);
|
||||
|
Loading…
Reference in New Issue
Block a user