[FFmpeg-cvslog] nvenc: rename encoders

Anton Khirnov git at videolan.org
Wed Jan 27 18:46:20 CET 2016


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jan  7 07:58:24 2016 +0100| [ee359c72ef8735122929da96006565e1558f1e55] | committer: Anton Khirnov

nvenc: rename encoders

Change 'nvenc_<codec>' to '<codec>_nvenc', which is consistent with
other similar decoders and encoders (QSV, MMAL).

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee359c72ef8735122929da96006565e1558f1e55
---

 configure               |    2 ++
 libavcodec/allcodecs.c  |    4 ++++
 libavcodec/nvenc_h264.c |   37 ++++++++++++++++++++++++++++++++++++-
 libavcodec/nvenc_hevc.c |   37 ++++++++++++++++++++++++++++++++++++-
 libavcodec/version.h    |    3 +++
 5 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d44fa08..8518e69 100755
--- a/configure
+++ b/configure
@@ -2011,6 +2011,8 @@ mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
 nuv_decoder_select="idctdsp lzo"
+nvenc_h264_encoder_deps="nvenc"
+nvenc_hevc_encoder_deps="nvenc"
 on2avc_decoder_select="mdct"
 opus_decoder_deps="avresample"
 opus_decoder_select="imdct15"
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 6eec4fe..e1a4382 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -495,6 +495,10 @@ void avcodec_register_all(void)
     REGISTER_ENCODER(HEVC_NVENC,        hevc_nvenc);
     REGISTER_ENCODER(HEVC_QSV,          hevc_qsv);
     REGISTER_ENCODER(MPEG2_QSV,         mpeg2_qsv);
+#if FF_API_NVENC_OLD_NAME
+    REGISTER_ENCODER(NVENC_H264,        nvenc_h264);
+    REGISTER_ENCODER(NVENC_HEVC,        nvenc_hevc);
+#endif
 
     /* parsers */
     REGISTER_PARSER(AAC,                aac);
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 52a2a67..92eb519 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -91,7 +91,7 @@ static const AVCodecDefault defaults[] = {
 };
 
 AVCodec ff_h264_nvenc_encoder = {
-    .name           = "nvenc_h264",
+    .name           = "h264_nvenc",
     .long_name      = NULL_IF_CONFIG_SMALL("NVIDIA NVENC H264 encoder"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H264,
@@ -108,3 +108,38 @@ AVCodec ff_h264_nvenc_encoder = {
     .capabilities   = AV_CODEC_CAP_DELAY,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
+
+#if FF_API_NVENC_OLD_NAME
+
+static int nvenc_old_init(AVCodecContext *avctx)
+{
+    av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated, use 'h264_nvenc' instead\n");
+    return ff_nvenc_encode_init(avctx);
+}
+
+static const AVClass nvenc_h264_old_class = {
+    .class_name = "nvenc_h264",
+    .item_name = av_default_item_name,
+    .option = options,
+    .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_nvenc_h264_encoder = {
+    .name           = "nvenc_h264",
+    .long_name      = NULL_IF_CONFIG_SMALL("NVIDIA NVENC H264 encoder"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_H264,
+    .init           = nvenc_old_init,
+    .encode2        = ff_nvenc_encode_frame,
+    .close          = ff_nvenc_encode_close,
+    .priv_data_size = sizeof(NVENCContext),
+    .priv_class     = &nvenc_h264_old_class,
+    .defaults       = defaults,
+    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_YUV420P,
+                                                    AV_PIX_FMT_YUV444P,
+                                                    AV_PIX_FMT_NONE },
+    .capabilities   = AV_CODEC_CAP_DELAY,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
+};
+#endif
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 58bde77..2a69197 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -89,7 +89,7 @@ static const AVCodecDefault defaults[] = {
 };
 
 AVCodec ff_hevc_nvenc_encoder = {
-    .name           = "nvenc_hevc",
+    .name           = "hevc_nvenc",
     .long_name      = NULL_IF_CONFIG_SMALL("NVIDIA NVENC HEVC encoder"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_HEVC,
@@ -106,3 +106,38 @@ AVCodec ff_hevc_nvenc_encoder = {
     .capabilities   = AV_CODEC_CAP_DELAY,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
+
+#if FF_API_NVENC_OLD_NAME
+
+static int nvenc_old_init(AVCodecContext *avctx)
+{
+    av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated, use 'hevc_nvenc' instead\n");
+    return ff_nvenc_encode_init(avctx);
+}
+
+static const AVClass nvenc_hevc_old_class = {
+    .class_name = "nvenc_hevc",
+    .item_name = av_default_item_name,
+    .option = options,
+    .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_nvenc_hevc_encoder = {
+    .name           = "nvenc_hevc",
+    .long_name      = NULL_IF_CONFIG_SMALL("NVIDIA NVENC HEVC encoder"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_HEVC,
+    .init           = nvenc_old_init,
+    .encode2        = ff_nvenc_encode_frame,
+    .close          = ff_nvenc_encode_close,
+    .priv_data_size = sizeof(NVENCContext),
+    .priv_class     = &nvenc_hevc_old_class,
+    .defaults       = defaults,
+    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+                                                    AV_PIX_FMT_YUV420P,
+                                                    AV_PIX_FMT_YUV444P,
+                                                    AV_PIX_FMT_NONE },
+    .capabilities   = AV_CODEC_CAP_DELAY,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
+};
+#endif
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e9e76b6..303c112 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -189,5 +189,8 @@
 #ifndef FF_API_STAT_BITS
 #define FF_API_STAT_BITS         (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_NVENC_OLD_NAME
+#define FF_API_NVENC_OLD_NAME    (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
 
 #endif /* AVCODEC_VERSION_H */



More information about the ffmpeg-cvslog mailing list