[FFmpeg-cvslog] nvenc: factor out the pixel format list
Anton Khirnov
git at videolan.org
Tue Feb 16 20:50:19 CET 2016
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Jan 30 21:33:48 2016 +0100| [28259c13db784d4b4175ca323dc1eeffec7f919b] | committer: Anton Khirnov
nvenc: factor out the pixel format list
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28259c13db784d4b4175ca323dc1eeffec7f919b
---
libavcodec/nvenc.c | 7 +++++++
libavcodec/nvenc.h | 2 ++
libavcodec/nvenc_h264.c | 10 ++--------
libavcodec/nvenc_hevc.c | 10 ++--------
4 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 2dfea94..53f0b13 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -76,6 +76,13 @@
} \
} while (0)
+const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
+ AV_PIX_FMT_NV12,
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_NONE
+};
+
static const struct {
NVENCSTATUS nverr;
int averr;
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 32d3345..7b1e8a5 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -135,4 +135,6 @@ int ff_nvenc_encode_close(AVCodecContext *avctx);
int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *frame, int *got_packet);
+extern const enum AVPixelFormat ff_nvenc_pix_fmts[];
+
#endif /* AVCODEC_NVENC_H */
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 92eb519..7374b13 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -101,12 +101,9 @@ AVCodec ff_h264_nvenc_encoder = {
.priv_data_size = sizeof(NVENCContext),
.priv_class = &nvenc_hevc_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,
+ .pix_fmts = ff_nvenc_pix_fmts,
};
#if FF_API_NVENC_OLD_NAME
@@ -135,11 +132,8 @@ AVCodec ff_nvenc_h264_encoder = {
.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,
+ .pix_fmts = ff_nvenc_pix_fmts,
};
#endif
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 2a69197..f0c6d41 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -99,10 +99,7 @@ AVCodec ff_hevc_nvenc_encoder = {
.priv_data_size = sizeof(NVENCContext),
.priv_class = &nvenc_hevc_class,
.defaults = defaults,
- .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
- AV_PIX_FMT_YUV420P,
- AV_PIX_FMT_YUV444P,
- AV_PIX_FMT_NONE },
+ .pix_fmts = ff_nvenc_pix_fmts,
.capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
@@ -133,10 +130,7 @@ AVCodec ff_nvenc_hevc_encoder = {
.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 },
+ .pix_fmts = ff_nvenc_pix_fmts,
.capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};
More information about the ffmpeg-cvslog
mailing list