102 const char *err_name;
103 const char *err_string;
107 if (err == CUDA_SUCCESS)
110 ctx->
cudl->cuGetErrorName(err, &err_name);
111 ctx->
cudl->cuGetErrorString(err, &err_string);
114 if (err_name && err_string)
121 #define CHECK_CU(x) check_cu(avctx, (x), #x) 128 CUVIDDECODECAPS *caps =
NULL;
129 CUVIDDECODECREATEINFO cuinfo;
132 int old_width = avctx->
width;
133 int old_height = avctx->
height;
141 memset(&cuinfo, 0,
sizeof(cuinfo));
143 ctx->internal_error = 0;
145 avctx->coded_width = cuinfo.ulWidth =
format->coded_width;
146 avctx->coded_height = cuinfo.ulHeight =
format->coded_height;
149 cuinfo.display_area.left =
format->display_area.left +
ctx->crop.left;
150 cuinfo.display_area.top =
format->display_area.top +
ctx->crop.top;
151 cuinfo.display_area.right =
format->display_area.right -
ctx->crop.right;
152 cuinfo.display_area.bottom =
format->display_area.bottom -
ctx->crop.bottom;
155 if (
ctx->resize_expr) {
156 avctx->width =
ctx->resize.width;
157 avctx->height =
ctx->resize.height;
159 avctx->width = cuinfo.display_area.right - cuinfo.display_area.left;
160 avctx->height = cuinfo.display_area.bottom - cuinfo.display_area.top;
164 cuinfo.ulTargetWidth = avctx->width = (avctx->width + 1) & ~1;
165 cuinfo.ulTargetHeight = avctx->height = (avctx->height + 1) & ~1;
168 cuinfo.target_rect.left = 0;
169 cuinfo.target_rect.top = 0;
170 cuinfo.target_rect.right = cuinfo.ulTargetWidth;
171 cuinfo.target_rect.bottom = cuinfo.ulTargetHeight;
173 switch (
format->bit_depth_luma_minus8) {
190 if (!caps || !caps->bIsSupported) {
192 format->bit_depth_luma_minus8 + 8);
198 if (surface_fmt < 0) {
209 avctx->pix_fmt = surface_fmt;
212 if (avctx->hw_frames_ctx) {
226 (
AVRational){ avctx->width, avctx->height }));
228 ctx->deint_mode_current =
format->progressive_sequence
229 ? cudaVideoDeinterlaceMode_Weave
232 ctx->progressive_sequence =
format->progressive_sequence;
234 if (!
format->progressive_sequence &&
ctx->deint_mode_current == cudaVideoDeinterlaceMode_Weave)
239 if (
format->video_signal_description.video_full_range_flag)
244 avctx->color_primaries =
format->video_signal_description.color_primaries;
245 avctx->color_trc =
format->video_signal_description.transfer_characteristics;
246 avctx->colorspace =
format->video_signal_description.matrix_coefficients;
249 avctx->bit_rate =
format->bitrate;
251 if (
format->frame_rate.numerator &&
format->frame_rate.denominator) {
252 avctx->framerate.num =
format->frame_rate.numerator;
253 avctx->framerate.den =
format->frame_rate.denominator;
257 && avctx->coded_width ==
format->coded_width
258 && avctx->coded_height ==
format->coded_height
259 && avctx->width == old_width
260 && avctx->height == old_height
261 &&
ctx->chroma_format ==
format->chroma_format
265 if (
ctx->cudecoder) {
268 if (
ctx->internal_error < 0)
273 if (hwframe_ctx->pool && (
274 hwframe_ctx->width < avctx->width ||
275 hwframe_ctx->height < avctx->height ||
277 hwframe_ctx->sw_format != avctx->sw_pix_fmt)) {
278 av_log(avctx,
AV_LOG_ERROR,
"AVHWFramesContext is already initialized with incompatible parameters\n");
280 av_log(avctx,
AV_LOG_DEBUG,
"height: %d <-> %d\n", hwframe_ctx->height, avctx->height);
288 if (
format->chroma_format != cudaVideoChromaFormat_420) {
294 ctx->chroma_format =
format->chroma_format;
296 cuinfo.CodecType =
ctx->codec_type =
format->codec;
297 cuinfo.ChromaFormat =
format->chroma_format;
299 switch (avctx->sw_pix_fmt) {
301 cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12;
305 cuinfo.OutputFormat = cudaVideoSurfaceFormat_P016;
308 av_log(avctx,
AV_LOG_ERROR,
"Output formats other than NV12, P010 or P016 are not supported\n");
313 cuinfo.ulNumDecodeSurfaces =
ctx->nb_surfaces;
314 cuinfo.ulNumOutputSurfaces = 1;
315 cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID;
316 cuinfo.bitDepthMinus8 =
format->bit_depth_luma_minus8;
317 cuinfo.DeinterlaceMode =
ctx->deint_mode_current;
319 if (
ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave && !
ctx->drop_second_field)
322 ctx->internal_error =
CHECK_CU(
ctx->cvdl->cuvidCreateDecoder(&
ctx->cudecoder, &cuinfo));
323 if (
ctx->internal_error < 0)
326 if (!hwframe_ctx->pool) {
328 hwframe_ctx->sw_format = avctx->sw_pix_fmt;
329 hwframe_ctx->width = avctx->width;
330 hwframe_ctx->height = avctx->height;
348 ctx->
key_frame[picparams->CurrPicIdx] = picparams->intra_pic_flag;
399 CUcontext
dummy, cuda_ctx = device_hwctx->cuda_ctx;
400 CUVIDSOURCEDATAPACKET cupkt;
403 int ret = 0, eret = 0, is_flush =
ctx->decoder_flushing;
407 if (is_flush && avpkt && avpkt->size)
413 if (
ctx->bsf && avpkt && avpkt->size) {
430 avpkt = &filtered_packet;
433 ret =
CHECK_CU(
ctx->cudl->cuCtxPushCurrent(cuda_ctx));
439 memset(&cupkt, 0,
sizeof(cupkt));
441 if (avpkt && avpkt->size) {
442 cupkt.payload_size = avpkt->size;
443 cupkt.payload = avpkt->data;
446 cupkt.flags = CUVID_PKT_TIMESTAMP;
447 if (avctx->pkt_timebase.num && avctx->pkt_timebase.den)
450 cupkt.timestamp = avpkt->pts;
453 cupkt.flags = CUVID_PKT_ENDOFSTREAM;
454 ctx->decoder_flushing = 1;
457 ret =
CHECK_CU(
ctx->cvdl->cuvidParseVideoData(
ctx->cuparser, &cupkt));
465 if (
ctx->internal_error) {
467 ret =
ctx->internal_error;
489 CUcontext
dummy, cuda_ctx = device_hwctx->cuda_ctx;
490 CUdeviceptr mapped_frame = 0;
491 int ret = 0, eret = 0;
522 unsigned int pitch = 0;
528 memset(¶ms, 0,
sizeof(params));
529 params.progressive_frame = parsed_frame.
dispinfo.progressive_frame;
531 params.top_field_first = parsed_frame.
dispinfo.top_field_first;
550 for (i = 0; i < 2; i++) {
551 CUDA_MEMCPY2D cpy = {
552 .srcMemoryType = CU_MEMORYTYPE_DEVICE,
553 .dstMemoryType = CU_MEMORYTYPE_DEVICE,
554 .srcDevice = mapped_frame,
555 .dstDevice = (CUdeviceptr)frame->
data[i],
560 .Height = avctx->
height >> (i ? 1 : 0),
563 ret =
CHECK_CU(ctx->
cudl->cuMemcpy2DAsync(&cpy, device_hwctx->stream));
570 ret =
CHECK_CU(ctx->
cudl->cuStreamSynchronize(device_hwctx->stream));
626 frame->
pts += pts_diff;
686 }
else if (ret < 0) {
717 cuvid_free_functions(&ctx->
cvdl);
729 CUVIDDECODECAPS *caps;
730 int res8 = 0, res10 = 0, res12 = 0;
732 if (!ctx->
cvdl->cuvidGetDecoderCaps) {
733 av_log(avctx,
AV_LOG_WARNING,
"Used Nvidia driver is too old to perform a capability check.\n");
735 #
if defined(_WIN32) || defined(__CYGWIN__)
740 ". Continuing blind.\n");
741 ctx->
caps8.bIsSupported = ctx->
caps10.bIsSupported = 1;
743 ctx->
caps12.bIsSupported = 0;
748 = cuparseinfo->CodecType;
750 = cudaVideoChromaFormat_420;
752 ctx->
caps8.nBitDepthMinus8 = 0;
753 ctx->
caps10.nBitDepthMinus8 = 2;
754 ctx->
caps12.nBitDepthMinus8 = 4;
761 av_log(avctx,
AV_LOG_VERBOSE,
"8 bit: supported: %d, min_width: %d, max_width: %d, min_height: %d, max_height: %d\n",
763 av_log(avctx,
AV_LOG_VERBOSE,
"10 bit: supported: %d, min_width: %d, max_width: %d, min_height: %d, max_height: %d\n",
765 av_log(avctx,
AV_LOG_VERBOSE,
"12 bit: supported: %d, min_width: %d, max_width: %d, min_height: %d, max_height: %d\n",
785 if (!ctx->
caps8.bIsSupported) {
790 if (!caps->bIsSupported) {
795 if (probed_width > caps->nMaxWidth || probed_width < caps->nMinWidth) {
797 probed_width, caps->nMinWidth, caps->nMaxWidth);
801 if (probed_height > caps->nMaxHeight || probed_height < caps->nMinHeight) {
803 probed_height, caps->nMinHeight, caps->nMaxHeight);
816 CUVIDSOURCEDATAPACKET seq_pkt;
817 CUcontext cuda_ctx =
NULL;
828 int probed_bit_depth = 8;
832 probed_bit_depth = probe_desc->
comp[0].
depth;
860 ret = cuvid_load_functions(&ctx->
cvdl, avctx);
910 device_hwctx = device_ctx->
hwctx;
917 memset(&seq_pkt, 0,
sizeof(seq_pkt));
922 #if CONFIG_H264_CUVID_DECODER 927 #if CONFIG_HEVC_CUVID_DECODER 932 #if CONFIG_MJPEG_CUVID_DECODER 937 #if CONFIG_MPEG1_CUVID_DECODER 942 #if CONFIG_MPEG2_CUVID_DECODER 947 #if CONFIG_MPEG4_CUVID_DECODER 952 #if CONFIG_VP8_CUVID_DECODER 957 #if CONFIG_VP9_CUVID_DECODER 962 #if CONFIG_VC1_CUVID_DECODER 1029 seq_pkt.payload = ctx->
cuparse_ext.raw_seqhdr_data;
1030 seq_pkt.payload_size = ctx->
cuparse_ext.format.seqhdr_data_length;
1032 if (seq_pkt.payload && seq_pkt.payload_size) {
1059 CUcontext
dummy, cuda_ctx = device_hwctx->cuda_ctx;
1060 CUVIDSOURCEDATAPACKET seq_pkt = { 0 };
1063 ret =
CHECK_CU(
ctx->cudl->cuCtxPushCurrent(cuda_ctx));
1070 if (!
ctx->frame_queue) {
1075 if (
ctx->cudecoder) {
1076 ctx->cvdl->cuvidDestroyDecoder(
ctx->cudecoder);
1080 if (
ctx->cuparser) {
1081 ctx->cvdl->cuvidDestroyVideoParser(
ctx->cuparser);
1085 ret =
CHECK_CU(
ctx->cvdl->cuvidCreateVideoParser(&
ctx->cuparser, &
ctx->cuparseinfo));
1089 seq_pkt.payload =
ctx->cuparse_ext.raw_seqhdr_data;
1090 seq_pkt.payload_size =
ctx->cuparse_ext.format.seqhdr_data_length;
1092 if (seq_pkt.payload && seq_pkt.payload_size) {
1093 ret =
CHECK_CU(
ctx->cvdl->cuvidParseVideoData(
ctx->cuparser, &seq_pkt));
1102 ctx->prev_pts = INT64_MIN;
1103 ctx->decoder_flushing = 0;
1110 #define OFFSET(x) offsetof(CuvidContext, x) 1111 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM 1113 {
"deint",
"Set deinterlacing mode",
OFFSET(
deint_mode),
AV_OPT_TYPE_INT, { .i64 = cudaVideoDeinterlaceMode_Weave }, cudaVideoDeinterlaceMode_Weave, cudaVideoDeinterlaceMode_Adaptive,
VD,
"deint" },
1114 {
"weave",
"Weave deinterlacing (do nothing)", 0,
AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Weave }, 0, 0,
VD,
"deint" },
1115 {
"bob",
"Bob deinterlacing", 0,
AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Bob }, 0, 0,
VD,
"deint" },
1116 {
"adaptive",
"Adaptive deinterlacing", 0,
AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Adaptive }, 0, 0,
VD,
"deint" },
1138 #define DEFINE_CUVID_CODEC(x, X) \ 1139 static const AVClass x##_cuvid_class = { \ 1140 .class_name = #x "_cuvid", \ 1141 .item_name = av_default_item_name, \ 1142 .option = options, \ 1143 .version = LIBAVUTIL_VERSION_INT, \ 1145 AVCodec ff_##x##_cuvid_decoder = { \ 1146 .name = #x "_cuvid", \ 1147 .long_name = NULL_IF_CONFIG_SMALL("Nvidia CUVID " #X " decoder"), \ 1148 .type = AVMEDIA_TYPE_VIDEO, \ 1149 .id = AV_CODEC_ID_##X, \ 1150 .priv_data_size = sizeof(CuvidContext), \ 1151 .priv_class = &x##_cuvid_class, \ 1152 .init = cuvid_decode_init, \ 1153 .close = cuvid_decode_end, \ 1154 .decode = cuvid_decode_frame, \ 1155 .receive_frame = cuvid_output_frame, \ 1156 .flush = cuvid_flush, \ 1157 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \ 1158 .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA, \ 1162 AV_PIX_FMT_NONE }, \ 1163 .hw_configs = cuvid_hw_configs, \ 1164 .wrapper_name = "cuvid", \ 1167 #if CONFIG_HEVC_CUVID_DECODER 1171 #if CONFIG_H264_CUVID_DECODER 1175 #if CONFIG_MJPEG_CUVID_DECODER 1179 #if CONFIG_MPEG1_CUVID_DECODER 1183 #if CONFIG_MPEG2_CUVID_DECODER 1187 #if CONFIG_MPEG4_CUVID_DECODER 1191 #if CONFIG_VP8_CUVID_DECODER 1195 #if CONFIG_VP9_CUVID_DECODER 1199 #if CONFIG_VC1_CUVID_DECODER This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
void av_bsf_free(AVBSFContext **ctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
const struct AVCodec * codec
AVCodecParameters * par_out
Parameters of the output stream.
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
static const char * format[]
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
The codec supports this format by some internal method.
int coded_width
Bitstream width / height, may be different from width/height e.g.
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
static av_cold int cuvid_decode_init(AVCodecContext *avctx)
#define AV_LOG_WARNING
Something somehow does not look correct.
AVCUDADeviceContextInternal * internal
The bitstream filter state.
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
CUVIDPARSERPARAMS cuparseinfo
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
static av_cold int cuvid_decode_end(AVCodecContext *avctx)
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
Feed data from a user-supplied callback to an AVFifoBuffer.
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame...
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx)
Allocate a context for a given bitstream filter.
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
struct CuvidContext::@68 crop
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
static int cuvid_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt)
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
enum AVPixelFormat pix_fmt
A hardware pixel format which the codec can use.
struct CuvidContext::@69 resize
AVFifoBuffer * frame_queue
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
Open a device of the specified type and create an AVHWDeviceContext for it.
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
int interlaced_frame
The content of the picture is interlaced.
The codec supports this format via the hw_device_ctx interface.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
cudaVideoChromaFormat chroma_format
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
cudaVideoCodec codec_type
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
static void cuvid_flush(AVCodecContext *avctx)
static const uint8_t offset[127][2]
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
int extradata_size
Size of the extradata content in bytes.
int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags)
Copy data to or from a hw surface.
static int check_cu(AVCodecContext *avctx, CUresult err, const char *func)
uint8_t nb_components
The number of components each pixel has, (1-4)
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT *format)
int width
picture width / height.
static int filter_packet(AVFormatContext *avf, ConcatStream *cs, AVPacket *pkt)
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames...
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame)
#define AVERROR_BSF_NOT_FOUND
Bitstream filter not found.
FFmpeg internal API for CUDA.
static int CUDAAPI cuvid_handle_picture_decode(void *opaque, CUVIDPICPARAMS *picparams)
HW acceleration through CUDA.
preferred ID for MPEG-1/2 video decoding
static void error(const char *err)
the normal 2^n-1 "JPEG" YUV ranges
static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Libavcodec external API header.
int64_t pkt_duration
duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown...
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * data
The data buffer.
static int cuvid_test_capabilities(AVCodecContext *avctx, const CUVIDPARSERPARAMS *cuparseinfo, int probed_width, int probed_height, int bit_depth)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
a very simple circular buffer FIFO implementation
static const AVOption options[]
static const AVCodecHWConfigInternal * cuvid_hw_configs[]
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
This struct is allocated as AVHWDeviceContext.hwctx.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
This struct describes a set or pool of "hardware" frames (i.e.
refcounted data buffer API
#define DEFINE_CUVID_CODEC(x, X)
static enum AVPixelFormat pix_fmts[]
CUVIDPARSERDISPINFO dispinfo
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
attribute_deprecated int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
the normal 219*2^(n-8) "MPEG" YUV ranges
A reference to a data buffer.
const char const char * params
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
static int CUDAAPI cuvid_handle_picture_display(void *opaque, CUVIDPARSERDISPINFO *dispinfo)
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
#define FF_ENABLE_DEPRECATION_WARNINGS
int top_field_first
If the content is interlaced, is top field displayed first.
int key_frame
1 -> keyframe, 0-> not
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
CUVIDEOFORMATEX cuparse_ext
void av_fifo_freep(AVFifoBuffer **f)
Free an AVFifoBuffer and reset pointer to NULL.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
int depth
Number of bits in the component.
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
int pkt_size
size of the corresponding packet containing the compressed frame.
#define AVERROR_EXTERNAL
Generic error in an external library.
AVPixelFormat
Pixel format.
This structure stores compressed data.
AVCodecParameters * par_in
Parameters of the input stream.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int cuvid_is_buffer_full(AVCodecContext *avctx)