summaryrefslogtreecommitdiffstats
path: root/video/image_writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/image_writer.c')
-rw-r--r--video/image_writer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/video/image_writer.c b/video/image_writer.c
index 8c3cf98d19..fb297f9c0f 100644
--- a/video/image_writer.c
+++ b/video/image_writer.c
@@ -259,9 +259,17 @@ static int get_encoder_format(struct AVCodec *codec, int srcfmt, bool highdepth)
int fmt = pixfmt2imgfmt(pix_fmts[n]);
if (!fmt)
continue;
- // Ignore formats larger than 8 bit per pixel.
- if (!highdepth && IMGFMT_RGB_DEPTH(fmt) > 32)
- continue;
+ if (!highdepth) {
+ // Ignore formats larger than 8 bit per pixel. (Or which are unknown.)
+ struct mp_regular_imgfmt rdesc;
+ if (!mp_get_regular_imgfmt(&rdesc, fmt)) {
+ int ofmt = mp_find_other_endian(fmt);
+ if (!mp_get_regular_imgfmt(&rdesc, ofmt))
+ continue;
+ }
+ if (rdesc.component_size > 1)
+ continue;
+ }
current = current ? mp_imgfmt_select_best(current, fmt, srcfmt) : fmt;
}
return current;