summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-11-25 15:38:23 +0100
committerAnton Khirnov <anton@khirnov.net>2022-11-28 10:33:59 +0100
commit14c14662b2955bac9c9bdcebe2f5b1da187f82cf (patch)
tree766d3c30312c80141e9700fa9cf8cb8f1c072c34
parentac4c09a4c89cd438f8086f44d8dfc0e0db9ce306 (diff)
lavfi/vf_w3fdif: set output frame durations
-rw-r--r--libavfilter/vf_w3fdif.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c
index 512c8070c7..4b29e8cb39 100644
--- a/libavfilter/vf_w3fdif.c
+++ b/libavfilter/vf_w3fdif.c
@@ -481,6 +481,8 @@ static int filter(AVFilterContext *ctx, int is_second)
AVFilterLink *outlink = ctx->outputs[0];
AVFrame *out, *adj;
ThreadData td;
+ int64_t cur_pts = s->cur->pts;
+ int64_t next_pts = s->next->pts;
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out)
@@ -492,9 +494,6 @@ static int filter(AVFilterContext *ctx, int is_second)
if (out->pts != AV_NOPTS_VALUE)
out->pts *= 2;
} else {
- int64_t cur_pts = s->cur->pts;
- int64_t next_pts = s->next->pts;
-
if (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) {
out->pts = cur_pts + next_pts;
} else {
@@ -502,6 +501,9 @@ static int filter(AVFilterContext *ctx, int is_second)
}
}
+ out->duration = (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) ?
+ next_pts - cur_pts : 0;
+
adj = s->field ? s->next : s->prev;
td.out = out; td.cur = s->cur; td.adj = adj;
ff_filter_execute(ctx, deinterlace_slice, &td, NULL,
@@ -541,6 +543,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
av_frame_free(&s->prev);
if (out->pts != AV_NOPTS_VALUE)
out->pts *= 2;
+ out->duration *= 2;
return ff_filter_frame(ctx->outputs[0], out);
}