[FFmpeg-devel] [PATCH 5/5] lavc/encoder: declare caps for encoding with variable dimension
Linjie Fu
linjie.fu at intel.com
Tue Jun 9 11:49:28 EEST 2020
Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
This patch is for RFC:
Did some tests on some of the encoders and find some encoders
not suitable for now, hence didn't declare the caps for them:
1. libx264: seems have frame drop.
2. hardware encoders like vaapi: failed.
Hence before we got all encoders supported, I'd prefer to declare
caps for specific encoder and add the enhancement step by step.
libavcodec/libopenh264enc.c | 4 +++-
libavcodec/libvpxenc.c | 4 +++-
libavcodec/libx265.c | 4 +++-
libavcodec/rawenc.c | 3 ++-
libavcodec/wrapped_avframe.c | 3 ++-
5 files changed, 13 insertions(+), 5 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/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