]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/nvenc_hevc.c
avcodec/nvenc: Bring encoder names in line with other encoders
[ffmpeg] / libavcodec / nvenc_hevc.c
index cef19f7d7127eb107d9c221b7545ec60519ef657..1ce7c89a4b2d5bb12d4affe1d5a5c9b2f2db909c 100644 (file)
@@ -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,
+};