diff mbox series

[FFmpeg-devel,v3,3/6] avcodec: add API for automatic handling of icc profiles

Message ID 20220719122608.43974-4-ffmpeg@haasn.xyz
State New
Headers show
Series ICC profile support in avcodec | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Niklas Haas July 19, 2022, 12:26 p.m. UTC
From: Niklas Haas <git@haasn.dev>

This functionally already exists, but as pointed out in #9672 and #9673,
requiring users to manually include filters is clumsy, error-prone and
hard to use together with tools like ffplay.

To streamline ICC profile support, add a new AVCodecContext flag to
globally enable reading and writing ICC profiles, automatically, for all
appropriate media types.

Note that this commit only includes the new API. The implementation is
split off to separate commits for readability.

Signed-off-by: Niklas Haas <git@haasn.dev>
---
 doc/APIchanges       | 5 ++++-
 libavcodec/avcodec.h | 6 ++++++
 libavcodec/version.h | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index b3563cd528..2dab01ab96 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,12 +14,15 @@  libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-07-xx - xxxxxxxxx - lavc 59.40.100 - avcodec.h
+  Add the AV_CODEC_FLAG2_ICC_PROFILES flag to AVCodecContext, to enable
+  automatic reading and writing of embedded ICC profiles in image files.
+
 2022-07-xx - xxxxxxxxxx - lavu 57.30.100 - frame.h
   Add AVFrame.duration, deprecate AVFrame.pkt_duration.
 
 -------- 8< --------- FFmpeg 5.1 was cut here -------- 8< ---------
 
-2022-06-12 - 7cae3d8b76 - lavf 59.25.100 - avio.h
   Add avio_vprintf(), similar to avio_printf() but allow to use it
   from within a function taking a variable argument list as input.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index cb5c25bf63..60b215d2e9 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -331,6 +331,12 @@  typedef struct RcOverride{
  * Do not reset ASS ReadOrder field on flush (subtitles decoding)
  */
 #define AV_CODEC_FLAG2_RO_FLUSH_NOOP  (1 << 30)
+/**
+ * Generate/parse ICC profiles on encode/decode, as appropriate for the type of
+ * file. No effect on codecs which cannot contain embedded ICC profiles, or
+ * when compiled without support for lcms2.
+ */
+#define AV_CODEC_FLAG2_ICC_PROFILES   (1U << 31)
 
 /* Unsupported options :
  *              Syntax Arithmetic coding (SAC)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index f2f14eaed1..19f3f4a272 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  39
+#define LIBAVCODEC_VERSION_MINOR  40
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \