FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
cuvid.c File Reference
#include "libavutil/buffer.h"
#include "libavutil/mathematics.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_cuda.h"
#include "libavutil/fifo.h"
#include "libavutil/log.h"
#include "avcodec.h"
#include "internal.h"
#include <nvcuvid.h>

Go to the source code of this file.

Data Structures

struct  CuvidContext
 

Macros

#define MAX_FRAME_COUNT   20
 
#define CHECK_CU(x)   check_cu(avctx, (x), #x)
 
#define DEFINE_CUVID_CODEC(x, X)
 

Functions

static int check_cu (AVCodecContext *avctx, CUresult err, const char *func)
 
static int CUDAAPI cuvid_handle_video_sequence (void *opaque, CUVIDEOFORMAT *format)
 
static int CUDAAPI cuvid_handle_picture_decode (void *opaque, CUVIDPICPARAMS *picparams)
 
static int CUDAAPI cuvid_handle_picture_display (void *opaque, CUVIDPARSERDISPINFO *dispinfo)
 
static int cuvid_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int cuvid_decode_end (AVCodecContext *avctx)
 
static void cuvid_ctx_free (AVHWDeviceContext *ctx)
 
static int cuvid_test_dummy_decoder (AVCodecContext *avctx, CUVIDPARSERPARAMS *cuparseinfo)
 
static av_cold int cuvid_decode_init (AVCodecContext *avctx)
 

Macro Definition Documentation

#define MAX_FRAME_COUNT   20
#define CHECK_CU (   x)    check_cu(avctx, (x), #x)
#define DEFINE_CUVID_CODEC (   x,
 
)
Value:
AVHWAccel ff_##x##_cuvid_hwaccel = { \
.name = #x "_cuvid", \
.type = AVMEDIA_TYPE_VIDEO, \
.id = AV_CODEC_ID_##X, \
.pix_fmt = AV_PIX_FMT_CUDA, \
}; \
AVCodec ff_##x##_cuvid_decoder = { \
.name = #x "_cuvid", \
.long_name = NULL_IF_CONFIG_SMALL("Nvidia CUVID " #X " decoder"), \
.type = AVMEDIA_TYPE_VIDEO, \
.id = AV_CODEC_ID_##X, \
.priv_data_size = sizeof(CuvidContext), \
.close = cuvid_decode_end, \
.capabilities = AV_CODEC_CAP_DELAY, \
};
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:981
static av_cold int cuvid_decode_init(AVCodecContext *avctx)
Definition: cuvid.c:458
static av_cold int cuvid_decode_end(AVCodecContext *avctx)
Definition: cuvid.c:392
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:90
static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: cuvid.c:208
const char * name
Name of the hardware accelerated codec.
Definition: avcodec.h:3668
HW acceleration through CUDA.
Definition: pixfmt.h:248
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:262
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:722
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 658 of file cuvid.c.

Function Documentation

static int check_cu ( AVCodecContext avctx,
CUresult  err,
const char *  func 
)
static

Definition at line 54 of file cuvid.c.

static int CUDAAPI cuvid_handle_video_sequence ( void opaque,
CUVIDEOFORMAT *  format 
)
static

Definition at line 77 of file cuvid.c.

Referenced by cuvid_decode_init().

static int CUDAAPI cuvid_handle_picture_decode ( void opaque,
CUVIDPICPARAMS *  picparams 
)
static

Definition at line 180 of file cuvid.c.

Referenced by cuvid_decode_init().

static int CUDAAPI cuvid_handle_picture_display ( void opaque,
CUVIDPARSERDISPINFO *  dispinfo 
)
static

Definition at line 194 of file cuvid.c.

Referenced by cuvid_decode_init().

static int cuvid_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 208 of file cuvid.c.

static av_cold int cuvid_decode_end ( AVCodecContext avctx)
static

Definition at line 392 of file cuvid.c.

Referenced by cuvid_decode_init().

static void cuvid_ctx_free ( AVHWDeviceContext ctx)
static

Definition at line 413 of file cuvid.c.

Referenced by cuvid_decode_init().

static int cuvid_test_dummy_decoder ( AVCodecContext avctx,
CUVIDPARSERPARAMS *  cuparseinfo 
)
static

Definition at line 419 of file cuvid.c.

Referenced by cuvid_decode_init().

static av_cold int cuvid_decode_init ( AVCodecContext avctx)
static

Definition at line 458 of file cuvid.c.