summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/img_format.c15
-rw-r--r--video/img_format.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/video/img_format.c b/video/img_format.c
index bf75ba8a18..4fd2897735 100644
--- a/video/img_format.c
+++ b/video/img_format.c
@@ -310,3 +310,18 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(unsigned int out_fmt)
}
return fmt;
}
+
+// Find a format that is MP_IMGFLAG_YUV_P with the following configuration.
+int mp_imgfmt_find_yuv_planar(int xs, int ys, int planes, int component_bits)
+{
+ for (int n = IMGFMT_START + 1; n < IMGFMT_END; n++) {
+ struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(n);
+ if (desc.id && (desc.flags & MP_IMGFLAG_YUV_P)) {
+ if (desc.num_planes == planes && desc.chroma_xs == xs &&
+ desc.chroma_ys == ys && desc.plane_bits == component_bits &&
+ (desc.flags & MP_IMGFLAG_NE))
+ return desc.id;
+ }
+ }
+ return 0;
+}
diff --git a/video/img_format.h b/video/img_format.h
index 1f617b573b..e75fe35831 100644
--- a/video/img_format.h
+++ b/video/img_format.h
@@ -298,4 +298,6 @@ const char *mp_imgfmt_to_name(unsigned int fmt);
#define vo_format_name mp_imgfmt_to_name
+int mp_imgfmt_find_yuv_planar(int xs, int ys, int planes, int component_bits);
+
#endif /* MPLAYER_IMG_FORMAT_H */