Commit 28259c13 authored by Anton Khirnov's avatar Anton Khirnov

nvenc: factor out the pixel format list

parent fb25d99b
...@@ -76,6 +76,13 @@ ...@@ -76,6 +76,13 @@
} \ } \
} while (0) } 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 { static const struct {
NVENCSTATUS nverr; NVENCSTATUS nverr;
int averr; int averr;
......
...@@ -135,4 +135,6 @@ int ff_nvenc_encode_close(AVCodecContext *avctx); ...@@ -135,4 +135,6 @@ int ff_nvenc_encode_close(AVCodecContext *avctx);
int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *frame, int *got_packet); const AVFrame *frame, int *got_packet);
extern const enum AVPixelFormat ff_nvenc_pix_fmts[];
#endif /* AVCODEC_NVENC_H */ #endif /* AVCODEC_NVENC_H */
...@@ -101,12 +101,9 @@ AVCodec ff_h264_nvenc_encoder = { ...@@ -101,12 +101,9 @@ AVCodec ff_h264_nvenc_encoder = {
.priv_data_size = sizeof(NVENCContext), .priv_data_size = sizeof(NVENCContext),
.priv_class = &nvenc_hevc_class, .priv_class = &nvenc_hevc_class,
.defaults = defaults, .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, .capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = ff_nvenc_pix_fmts,
}; };
#if FF_API_NVENC_OLD_NAME #if FF_API_NVENC_OLD_NAME
...@@ -135,11 +132,8 @@ AVCodec ff_nvenc_h264_encoder = { ...@@ -135,11 +132,8 @@ AVCodec ff_nvenc_h264_encoder = {
.priv_data_size = sizeof(NVENCContext), .priv_data_size = sizeof(NVENCContext),
.priv_class = &nvenc_h264_old_class, .priv_class = &nvenc_h264_old_class,
.defaults = defaults, .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, .capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = ff_nvenc_pix_fmts,
}; };
#endif #endif
...@@ -99,10 +99,7 @@ AVCodec ff_hevc_nvenc_encoder = { ...@@ -99,10 +99,7 @@ AVCodec ff_hevc_nvenc_encoder = {
.priv_data_size = sizeof(NVENCContext), .priv_data_size = sizeof(NVENCContext),
.priv_class = &nvenc_hevc_class, .priv_class = &nvenc_hevc_class,
.defaults = defaults, .defaults = defaults,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, .pix_fmts = ff_nvenc_pix_fmts,
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NONE },
.capabilities = AV_CODEC_CAP_DELAY, .capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}; };
...@@ -133,10 +130,7 @@ AVCodec ff_nvenc_hevc_encoder = { ...@@ -133,10 +130,7 @@ AVCodec ff_nvenc_hevc_encoder = {
.priv_data_size = sizeof(NVENCContext), .priv_data_size = sizeof(NVENCContext),
.priv_class = &nvenc_hevc_old_class, .priv_class = &nvenc_hevc_old_class,
.defaults = defaults, .defaults = defaults,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, .pix_fmts = ff_nvenc_pix_fmts,
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NONE },
.capabilities = AV_CODEC_CAP_DELAY, .capabilities = AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment