summaryrefslogtreecommitdiffstats
path: root/video/image_writer.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-03-18 15:03:05 +0100
committerwm4 <wm4@nowhere>2017-03-18 15:03:05 +0100
commit46e3dc27af20492dd24d228781b895f25abc3438 (patch)
tree78309b4845a627e9f5302b904157e8f911211d81 /video/image_writer.h
parent8e75297c269a2679a5d1683d7d7cb745aba40182 (diff)
downloadmpv-46e3dc27af20492dd24d228781b895f25abc3438.tar.bz2
mpv-46e3dc27af20492dd24d228781b895f25abc3438.tar.xz
screenshot: change details of --screenshot-format handling
This is just a pointless refactor with the only goal of making image_writer_opts.format a number. The pointless part of it is that instead of using some sort of arbitrary ID (in place of a file extension string), we use a AV_CODEC_ID_. There was also some idea of falling back to the libavcodec MJPEG encoder if mpv was not linked against libjpeg, but this fails. libavcodec insist on having AV_PIX_FMT_YUVJ420P, which we pretend does not exist, and which we always map to AV_PIX_FMT_YUV420P (without the J indicating full range), so encoder init fails. This is pretty dumb, but whatever. The not-caring factor is raised by the fact that we don't know that we should convert to full range, because encoders have no proper way to signal this. (Be reminded that AV_PIX_FMT_YUVJ420P is deprecated.)
Diffstat (limited to 'video/image_writer.h')
-rw-r--r--video/image_writer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/image_writer.h b/video/image_writer.h
index 8b7414b62a..723dffc3ef 100644
--- a/video/image_writer.h
+++ b/video/image_writer.h
@@ -21,7 +21,7 @@ struct mp_image;
struct mp_log;
struct image_writer_opts {
- char *format;
+ int format;
int high_bit_depth;
int png_compression;
int png_filter;
@@ -42,6 +42,9 @@ extern const struct m_option image_writer_opts[];
// Return the file extension that will be used, e.g. "png".
const char *image_writer_file_ext(const struct image_writer_opts *opts);
+// Map file extension to format ID - return 0 (which is invalid) if unknown.
+int image_writer_format_from_ext(const char *ext);
+
/*
* Save the given image under the given filename. The parameters csp and opts
* are optional. All pixel formats supported by swscale are supported.