summaryrefslogtreecommitdiff
path: root/libavfilter/vf_tinterlace.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-04-12 11:38:46 -0300
committerJames Almer <jamrial@gmail.com>2023-05-04 18:14:11 -0300
commit36827ea783afbb39e5b75e8a982e316739009773 (patch)
tree745980f298dd29d5e56f5d0480e3d837cc8cc0e5 /libavfilter/vf_tinterlace.c
parent2f561ba953e23887ddb25ab1b6739aab04ff9115 (diff)
avfilter: use the new AVFrame interlace flags in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/vf_tinterlace.c')
-rw-r--r--libavfilter/vf_tinterlace.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 032629279a..742d4e195a 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -393,6 +393,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
out->height = outlink->h;
out->interlaced_frame = 1;
out->top_field_first = 1;
+ out->flags |= AV_FRAME_FLAG_INTERLACED | AV_FRAME_FLAG_TOP_FIELD_FIRST;
out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, av_make_q(2, 1));
/* write odd frame lines into the upper field of the new frame */
@@ -444,7 +445,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
* halving the frame rate and preserving image height */
case MODE_INTERLEAVE_TOP: /* top field first */
case MODE_INTERLEAVE_BOTTOM: /* bottom field first */
- if ((tinterlace->flags & TINTERLACE_FLAG_BYPASS_IL) && cur->interlaced_frame) {
+ if ((tinterlace->flags & TINTERLACE_FLAG_BYPASS_IL) && (cur->flags & AV_FRAME_FLAG_INTERLACED)) {
av_log(ctx, AV_LOG_WARNING,
"video is already interlaced, adjusting framerate only\n");
out = av_frame_clone(cur);
@@ -461,6 +462,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
av_frame_copy_props(out, cur);
out->interlaced_frame = 1;
out->top_field_first = tff;
+ out->flags |= AV_FRAME_FLAG_INTERLACED;
+ if (tff)
+ out->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
+ else
+ out->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
/* copy upper/lower field from cur */
copy_picture_field(tinterlace, out->data, out->linesize,
@@ -482,6 +488,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
if (!out)
return AVERROR(ENOMEM);
out->interlaced_frame = 1;
+ out->flags |= AV_FRAME_FLAG_INTERLACED;
if (cur->pts != AV_NOPTS_VALUE)
out->pts = cur->pts*2;
@@ -490,13 +497,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
return ret;
/* output mix of current and next frame */
- tff = next->top_field_first;
+ tff = !!(next->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out)
return AVERROR(ENOMEM);
av_frame_copy_props(out, next);
out->interlaced_frame = 1;
out->top_field_first = !tff;
+ out->flags |= AV_FRAME_FLAG_INTERLACED;
+ if (tff)
+ out->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
+ else
+ out->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
if (next->pts != AV_NOPTS_VALUE && cur->pts != AV_NOPTS_VALUE)
out->pts = cur->pts + next->pts;