summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2023-05-10 11:25:48 -0700
committerPhilip Langdale <github.philipl@overt.org>2023-05-11 14:31:17 -0700
commit8343b3bded5eb9c7ef1eb42c79888b40a55261d2 (patch)
treeef0da390e89166d8fa91f301b80792e7a8634519 /video
parent5afc0da5304401d3f7f4d3e27402943b63f6cc71 (diff)
downloadmpv-8343b3bded5eb9c7ef1eb42c79888b40a55261d2.tar.bz2
mpv-8343b3bded5eb9c7ef1eb42c79888b40a55261d2.tar.xz
mp_image: use the ffmpeg interlaced frame flags where available
The old frame properties are deprecated and have been replaced by frame flags.
Diffstat (limited to 'video')
-rw-r--r--video/mp_image.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 0473bda36e..e54cbb82b7 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -973,10 +973,17 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
dst->pict_type = src->pict_type;
dst->fields = 0;
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 7, 100)
+ if (src->flags & AV_FRAME_FLAG_INTERLACED)
+ dst->fields |= MP_IMGFIELD_INTERLACED;
+ if (src->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)
+ dst->fields |= MP_IMGFIELD_TOP_FIRST;
+#else
if (src->interlaced_frame)
dst->fields |= MP_IMGFIELD_INTERLACED;
if (src->top_field_first)
dst->fields |= MP_IMGFIELD_TOP_FIRST;
+#endif
if (src->repeat_pict == 1)
dst->fields |= MP_IMGFIELD_REPEAT_FIRST;
@@ -1098,10 +1105,17 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src)
dst->extended_data = dst->data;
dst->pict_type = src->pict_type;
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(58, 7, 100)
+ if (src->fields & MP_IMGFIELD_INTERLACED)
+ dst->flags |= AV_FRAME_FLAG_INTERLACED;
+ if (src->fields & MP_IMGFIELD_TOP_FIRST)
+ dst->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
+#else
if (src->fields & MP_IMGFIELD_INTERLACED)
dst->interlaced_frame = 1;
if (src->fields & MP_IMGFIELD_TOP_FIRST)
dst->top_field_first = 1;
+#endif
if (src->fields & MP_IMGFIELD_REPEAT_FIRST)
dst->repeat_pict = 1;