[FFmpeg-devel] [PATCH 1/3] lavc/avcodec: Add caps for the support of variable dimension encoding
Linjie Fu
linjie.fu at intel.com
Mon Jun 8 11:58:03 EEST 2020
And declare AV_CODEC_CAP_VARIABLE_DIMENSIONS for rawvideo and
wrapped_avframe.
Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
doc/APIchanges | 3 +++
fftools/cmdutils.c | 2 ++
libavcodec/avcodec.h | 4 +++-
libavcodec/codec.h | 5 +++++
libavcodec/rawenc.c | 1 +
libavcodec/version.h | 2 +-
libavcodec/wrapped_avframe.c | 1 +
7 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index c7e4ce3..f4d350c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
+2020-06-xx - xxxxxxxxxx - lavc 58.90.101 - codec.h
+ Add AV_CODEC_CAP_VARIABLE_DIMENSIONS.
+
2020-06-xx - xxxxxxxxxx - lavu 56.50.100 - buffer.h
Passing NULL as alloc argument to av_buffer_pool_init2() is now allowed.
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 13567a7..e0469cd 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1424,6 +1424,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 c91b2fd..b435ce6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -97,7 +97,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
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 1fda619..9855477 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -169,6 +169,11 @@
* remain pending.
*/
#define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21)
+/**
+ * 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 << 22)
/**
* AVProfile.
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 524fbc3..4e2cc5d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 90
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/wrapped_avframe.c b/libavcodec/wrapped_avframe.c
index 85ff32d..ae29328 100644
--- a/libavcodec/wrapped_avframe.c
+++ b/libavcodec/wrapped_avframe.c
@@ -116,6 +116,7 @@ AVCodec ff_wrapped_avframe_encoder = {
.id = AV_CODEC_ID_WRAPPED_AVFRAME,
.encode2 = wrapped_avframe_encode,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
+ .capabilities = AV_CODEC_CAP_VARIABLE_DIMENSIONS,
};
AVCodec ff_wrapped_avframe_decoder = {
--
2.7.4
More information about the ffmpeg-devel
mailing list