[FFmpeg-devel] [PATCH 2/3] lavc/avcodec.h: add an AVCodecContext flag to indicate caps of encoding

Linjie Fu linjie.fu at intel.com
Thu Feb 27 18:13:45 EET 2020


Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 doc/APIchanges       | 3 +++
 fftools/cmdutils.c   | 2 ++
 libavcodec/avcodec.h | 9 ++++++++-
 libavcodec/rawenc.c  | 1 +
 libavcodec/version.h | 2 +-
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5bfb0a6..ec4531f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2020-xx-xx - xxxxxxxxxx - lavc 58.73.103 - avcodec.h
+  Add AV_CODEC_CAP_VARIABLE_DIMENSIONS.
+
 2020-02-21 - xxxxxxxxxx - lavc 58.73.101 - avcodec.h
   Add AV_CODEC_EXPORT_DATA_PRFT.
 
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index f0f2b4f..30bbbcc 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1431,6 +1431,8 @@ static void print_codec(const AVCodec *c)
         printf("hardware ");
     if (c->capabilities & AV_CODEC_CAP_HYBRID)
         printf("hybrid ");
+    if (c->capabilities & AV_CODEC_CAP_VARIABLE_DIMENSIONS)
+        printf("multidimension ");
     if (!c->capabilities)
         printf("none");
     printf("\n");
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5a0fc34..87ca79f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -91,7 +91,9 @@
  *   - For decoding, call avcodec_send_packet() to give the decoder raw
  *     compressed data in an AVPacket.
  *   - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
- *     containing uncompressed audio or video.
+ *     containing uncompressed audio or video. Video encoder requires input
+ *     frames to be in constant dimensions unless it declare the capability
+ *     of AV_CODEC_CAP_VARIABLE_DIMENSIONS.
  *
  *   In both cases, it is recommended that AVPackets and AVFrames are
  *   refcounted, or libavcodec might have to copy the input data. (libavformat
@@ -1116,6 +1118,11 @@ typedef struct RcOverride{
  * Export encoder Producer Reference Time through packet side data
  */
 #define AV_CODEC_EXPORT_DATA_PRFT        (1 << 1)
+/**
+ * Codec supports variable dimensions encoding. This indicates that input frames are
+ * allowed to be in variable dimensions/resolutions, otherwise they have to keep constant.
+ */
+#define AV_CODEC_CAP_VARIABLE_DIMENSIONS (1 << 21)
 
 /**
  * Pan Scan area.
diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index d181b74..486c0d7 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -92,4 +92,5 @@ AVCodec ff_rawvideo_encoder = {
     .id             = AV_CODEC_ID_RAWVIDEO,
     .init           = raw_encode_init,
     .encode2        = raw_encode,
+    .capabilities   = AV_CODEC_CAP_VARIABLE_DIMENSIONS,
 };
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 36536c3..03d7f32 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  73
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
-- 
2.7.4



More information about the ffmpeg-devel mailing list