[FFmpeg-cvslog] avcodec/nvenc: Bring encoder names in line with other encoders
Timo Rothenpieler
git at videolan.org
Sat Jun 25 23:08:34 CEST 2016
ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sat Jun 25 22:24:13 2016 +0200| [888a5c794778a2f2aad22e9b4a3952dff92b11fa] | committer: Timo Rothenpieler
avcodec/nvenc: Bring encoder names in line with other encoders
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=888a5c794778a2f2aad22e9b4a3952dff92b11fa
---
configure | 2 ++
libavcodec/Makefile | 2 ++
libavcodec/allcodecs.c | 6 +++++-
libavcodec/nvenc_h264.c | 37 +++++++++++++++++++++++++++++++++--
libavcodec/nvenc_hevc.c | 49 +++++++++++++++++++++++++++++++++++++++--------
libavcodec/version.h | 5 ++++-
6 files changed, 89 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index 2c9d00a..aa07224 100755
--- a/configure
+++ b/configure
@@ -2674,6 +2674,7 @@ scale_npp_filter_deps="cuda libnpp"
nvenc_encoder_deps="nvenc"
h264_cuvid_decoder_deps="cuda cuvid CUVIDH264PICPARAMS"
h264_cuvid_decoder_select="h264_mp4toannexb_bsf h264_cuvid_hwaccel"
+h264_nvenc_encoder_deps="nvenc"
h264_qsv_decoder_deps="libmfx"
h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
h264_qsv_encoder_deps="libmfx"
@@ -2683,6 +2684,7 @@ h264_vaapi_encoder_select="vaapi_encode golomb"
hevc_cuvid_decoder_deps="cuda cuvid CUVIDHEVCPICPARAMS"
hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf hevc_cuvid_hwaccel"
+hevc_nvenc_encoder_deps="nvenc"
hevc_qsv_decoder_deps="libmfx"
hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel"
hevc_qsv_encoder_deps="libmfx"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 81cd507..a251845 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -315,6 +315,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o h264_cabac.o h264_cavlc.o \
OBJS-$(CONFIG_H264_CUVID_DECODER) += cuvid.o
OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec_h264.o
OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o
+OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o
OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o
OBJS-$(CONFIG_NVENC_H264_ENCODER) += nvenc_h264.o
OBJS-$(CONFIG_H264_VDA_DECODER) += vda_h264_dec.o
@@ -329,6 +330,7 @@ OBJS-$(CONFIG_HEVC_DECODER) += hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o
hevc_cabac.o hevc_refs.o hevcpred.o \
hevcdsp.o hevc_filter.o h2645_parse.o hevc_data.o
OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuvid.o
+OBJS-$(CONFIG_HEVC_NVENC_ENCODER) += nvenc_hevc.o
OBJS-$(CONFIG_NVENC_HEVC_ENCODER) += nvenc_hevc.o
OBJS-$(CONFIG_HEVC_QSV_DECODER) += qsvdec_h2645.o
OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o h2645_parse.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 36a0de0..02fc834 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -623,14 +623,18 @@ void avcodec_register_all(void)
* above is available */
REGISTER_ENCODER(LIBOPENH264, libopenh264);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
+ REGISTER_ENCODER(H264_NVENC, h264_nvenc);
+ REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(H264_QSV, h264_qsv);
REGISTER_ENCODER(H264_VAAPI, h264_vaapi);
REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
+#if FF_API_NVENC_OLD_NAME
REGISTER_ENCODER(NVENC, nvenc);
- REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(NVENC_H264, nvenc_h264);
REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc);
+#endif
REGISTER_DECODER(HEVC_CUVID, hevc_cuvid);
+ REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);
REGISTER_ENCODER(HEVC_QSV, hevc_qsv);
REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);
REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 19103f9..b576f15 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -98,6 +98,14 @@ static const AVCodecDefault defaults[] = {
{ NULL },
};
+#if FF_API_NVENC_OLD_NAME
+
+static av_cold 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);
+}
+
#if CONFIG_NVENC_ENCODER
static const AVClass nvenc_class = {
.class_name = "nvenc",
@@ -111,7 +119,7 @@ AVCodec ff_nvenc_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("NVIDIA NVENC H.264 encoder"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_H264,
- .init = ff_nvenc_encode_init,
+ .init = nvenc_old_init,
.encode2 = ff_nvenc_encode_frame,
.close = ff_nvenc_encode_close,
.priv_data_size = sizeof(NvencContext),
@@ -137,7 +145,7 @@ AVCodec ff_nvenc_h264_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("NVIDIA NVENC H.264 encoder"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_H264,
- .init = ff_nvenc_encode_init,
+ .init = nvenc_old_init,
.encode2 = ff_nvenc_encode_frame,
.close = ff_nvenc_encode_close,
.priv_data_size = sizeof(NvencContext),
@@ -148,3 +156,28 @@ AVCodec ff_nvenc_h264_encoder = {
.pix_fmts = ff_nvenc_pix_fmts,
};
#endif
+
+#endif
+
+static const AVClass h264_nvenc_class = {
+ .class_name = "h264_nvenc",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_h264_nvenc_encoder = {
+ .name = "h264_nvenc",
+ .long_name = NULL_IF_CONFIG_SMALL("NVIDIA NVENC H.264 encoder"),
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_H264,
+ .init = ff_nvenc_encode_init,
+ .encode2 = ff_nvenc_encode_frame,
+ .close = ff_nvenc_encode_close,
+ .priv_data_size = sizeof(NvencContext),
+ .priv_class = &h264_nvenc_class,
+ .defaults = defaults,
+ .capabilities = AV_CODEC_CAP_DELAY,
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+ .pix_fmts = ff_nvenc_pix_fmts,
+};
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index cef19f7..1ce7c89 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -83,13 +83,6 @@ static const AVOption options[] = {
{ NULL }
};
-static const AVClass nvenc_hevc_class = {
- .class_name = "nvenc_hevc",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
static const AVCodecDefault defaults[] = {
{ "b", "2M" },
{ "qmin", "-1" },
@@ -102,12 +95,27 @@ static const AVCodecDefault defaults[] = {
{ NULL },
};
+#if FF_API_NVENC_OLD_NAME
+
+static av_cold 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_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 = ff_nvenc_encode_init,
+ .init = nvenc_old_init,
.encode2 = ff_nvenc_encode_frame,
.close = ff_nvenc_encode_close,
.priv_data_size = sizeof(NvencContext),
@@ -117,3 +125,28 @@ AVCodec ff_nvenc_hevc_encoder = {
.capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
+
+#endif
+
+static const AVClass hevc_nvenc_class = {
+ .class_name = "hevc_nvenc",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_hevc_nvenc_encoder = {
+ .name = "hevc_nvenc",
+ .long_name = NULL_IF_CONFIG_SMALL("NVIDIA NVENC hevc encoder"),
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_HEVC,
+ .init = ff_nvenc_encode_init,
+ .encode2 = ff_nvenc_encode_frame,
+ .close = ff_nvenc_encode_close,
+ .priv_data_size = sizeof(NvencContext),
+ .priv_class = &hevc_nvenc_class,
+ .defaults = defaults,
+ .pix_fmts = ff_nvenc_pix_fmts,
+ .capabilities = AV_CODEC_CAP_DELAY,
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0852b43..000026e 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 46
+#define LIBAVCODEC_VERSION_MINOR 47
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -217,5 +217,8 @@
#ifndef FF_API_OLD_BSF
#define FF_API_OLD_BSF (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