Unified · Split
| @@ -33,6 +33,7 @@ typedef struct ReverseContext { · 32 unmodified lines | |||
| 33 | unsigned int pts_size; | 33 | unsigned int pts_size; |
| 34 | int64_t *pts; | 34 | int64_t *pts; |
| 35 | int flush_idx; | 35 | int flush_idx; |
| 36 | int64_t nb_samples; | ||
| 36 | } ReverseContext; | 37 | } ReverseContext; |
| 37 | 38 | ||
| 38 | static av_cold int init(AVFilterContext *ctx) | 39 | static av_cold int init(AVFilterContext *ctx) |
| @@ -249,7 +250,8 @@ static int areverse_request_frame(AVFilterLink *outlink) · 210 unmodified lines | |||
| 249 | 250 | ||
| 250 | if (ret == AVERROR_EOF && s->nb_frames > 0) { | 251 | if (ret == AVERROR_EOF && s->nb_frames > 0) { |
| 251 | AVFrame *out = s->frames[s->nb_frames - 1]; | 252 | AVFrame *out = s->frames[s->nb_frames - 1]; |
| 252 | out->pts = s->pts[s->flush_idx++]; | 253 | out->pts = s->pts[s->flush_idx++] - s->nb_samples; |
| 254 | s->nb_samples += s->pts[s->flush_idx] - s->pts[s->flush_idx - 1] - out->nb_samples; | ||
| 253 | 255 | ||
| 254 | if (av_sample_fmt_is_planar(out->format)) | 256 | if (av_sample_fmt_is_planar(out->format)) |
| 255 | reverse_samples_planar(out); | 257 | reverse_samples_planar(out); |