You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
nvenc: only support HW frames when CUDA is enabled
hwcontext_cuda.h includes cuda.h, so this will allow building nvenc without depending on cuda.h
This commit is contained in:
@@ -48,13 +48,16 @@
|
|||||||
|
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/hwcontext.h"
|
#include "libavutil/hwcontext.h"
|
||||||
#include "libavutil/hwcontext_cuda.h"
|
|
||||||
#include "libavutil/imgutils.h"
|
#include "libavutil/imgutils.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "nvenc.h"
|
#include "nvenc.h"
|
||||||
|
|
||||||
|
#if CONFIG_CUDA
|
||||||
|
#include "libavutil/hwcontext_cuda.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NVENC_CAP 0x30
|
#define NVENC_CAP 0x30
|
||||||
#define BITSTREAM_BUFFER_SIZE 1024 * 1024
|
#define BITSTREAM_BUFFER_SIZE 1024 * 1024
|
||||||
#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR || \
|
#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR || \
|
||||||
@@ -85,7 +88,9 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
|
|||||||
AV_PIX_FMT_NV12,
|
AV_PIX_FMT_NV12,
|
||||||
AV_PIX_FMT_YUV420P,
|
AV_PIX_FMT_YUV420P,
|
||||||
AV_PIX_FMT_YUV444P,
|
AV_PIX_FMT_YUV444P,
|
||||||
|
#if CONFIG_CUDA
|
||||||
AV_PIX_FMT_CUDA,
|
AV_PIX_FMT_CUDA,
|
||||||
|
#endif
|
||||||
AV_PIX_FMT_NONE
|
AV_PIX_FMT_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -395,6 +400,7 @@ static int nvenc_setup_device(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {
|
if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {
|
||||||
|
#if CONFIG_CUDA
|
||||||
AVHWFramesContext *frames_ctx;
|
AVHWFramesContext *frames_ctx;
|
||||||
AVCUDADeviceContext *device_hwctx;
|
AVCUDADeviceContext *device_hwctx;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -414,6 +420,9 @@ static int nvenc_setup_device(AVCodecContext *avctx)
|
|||||||
ret = nvenc_check_capabilities(avctx);
|
ret = nvenc_check_capabilities(avctx);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
#else
|
||||||
|
return AVERROR_BUG;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
int i, nb_devices = 0;
|
int i, nb_devices = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user