[FFmpeg-devel] [PATCH v2 5/5] lavc/encoder: declare caps for encoding with variable dimension
Linjie Fu
linjie.fu at intel.com
Thu Jun 11 18:43:44 EEST 2020
Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
Tested following encoders with container muxer(like mp4 muxer for
x264, which previously use extradata to store a global header)
and raw video muxer, results are good.
libavcodec/libopenh264enc.c | 4 +++-
libavcodec/libvpxenc.c | 4 +++-
libavcodec/libx264.c | 4 +++-
libavcodec/libx265.c | 4 +++-
libavcodec/rawenc.c | 3 ++-
libavcodec/wrapped_avframe.c | 3 ++-
6 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index f63aa52..b86041b 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -438,7 +438,9 @@ AVCodec ff_libopenh264_encoder = {
.init = svc_encode_init,
.encode2 = svc_encode_frame,
.close = svc_encode_close,
- .capabilities = AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_AUTO_THREADS |
+ AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+ AV_CODEC_CAP_ENCODER_FLUSH,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 8e0ea42..9faec48 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1789,7 +1789,9 @@ AVCodec ff_libvpx_vp9_encoder = {
.init = vp9_init,
.encode2 = vpx_encode,
.close = vpx_free,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
+ AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+ AV_CODEC_CAP_ENCODER_FLUSH,
.profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
.priv_class = &class_vp9,
.defaults = defaults,
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index d4b1fd0..016c53c 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1177,7 +1177,9 @@ AVCodec ff_libx264_encoder = {
.encode2 = X264_frame,
.close = X264_close,
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
- AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE |
+ AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+ AV_CODEC_CAP_ENCODER_FLUSH,
.priv_class = &x264_class,
.defaults = x264_defaults,
.init_static_data = X264_init_static,
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index f560d7f..2a9ec4e 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -701,6 +701,8 @@ AVCodec ff_libx265_encoder = {
.priv_class = &class,
.defaults = x265_defaults,
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
- AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
+ AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE |
+ AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+ AV_CODEC_CAP_ENCODER_FLUSH,
.wrapper_name = "libx265",
};
diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index 486c0d7..85298dc 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -92,5 +92,6 @@ AVCodec ff_rawvideo_encoder = {
.id = AV_CODEC_ID_RAWVIDEO,
.init = raw_encode_init,
.encode2 = raw_encode,
- .capabilities = AV_CODEC_CAP_VARIABLE_DIMENSIONS,
+ .capabilities = AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+ AV_CODEC_CAP_ENCODER_FLUSH,
};
diff --git a/libavcodec/wrapped_avframe.c b/libavcodec/wrapped_avframe.c
index ae29328..9af3193 100644
--- a/libavcodec/wrapped_avframe.c
+++ b/libavcodec/wrapped_avframe.c
@@ -116,7 +116,8 @@ 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,
+ .capabilities = AV_CODEC_CAP_VARIABLE_DIMENSIONS |
+ AV_CODEC_CAP_ENCODER_FLUSH,
};
AVCodec ff_wrapped_avframe_decoder = {
--
2.7.4
More information about the ffmpeg-devel
mailing list