FFmpeg  4.0
Data Structures | Macros | Functions | Variables
hwcontext_vdpau.c File Reference
#include "config.h"
#include <stdint.h>
#include <string.h>
#include <vdpau/vdpau.h>
#include "buffer.h"
#include "common.h"
#include "hwcontext.h"
#include "hwcontext_internal.h"
#include "hwcontext_vdpau.h"
#include "mem.h"
#include "pixfmt.h"
#include "pixdesc.h"

Go to the source code of this file.

Data Structures

struct  VDPAUDeviceContext
 
struct  VDPAUFramesContext
 
struct  VDPAUPixFmtMap
 

Macros

#define GET_CALLBACK(id, result)
 

Functions

static int count_pixfmts (const VDPAUPixFmtMap *map)
 
static int vdpau_init_pixmfts (AVHWDeviceContext *ctx)
 
static int vdpau_device_init (AVHWDeviceContext *ctx)
 
static void vdpau_device_uninit (AVHWDeviceContext *ctx)
 
static int vdpau_frames_get_constraints (AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
 
static void vdpau_buffer_free (void *opaque, uint8_t *data)
 
static AVBufferRefvdpau_pool_alloc (void *opaque, int size)
 
static int vdpau_frames_init (AVHWFramesContext *ctx)
 
static int vdpau_get_buffer (AVHWFramesContext *ctx, AVFrame *frame)
 
static int vdpau_transfer_get_formats (AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
 
static int vdpau_transfer_data_from (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
 
static int vdpau_transfer_data_to (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
 

Variables

static const VDPAUPixFmtMap pix_fmts_420 []
 
static const VDPAUPixFmtMap pix_fmts_422 []
 
static const VDPAUPixFmtMap pix_fmts_444 []
 
struct {
   VdpChromaType   chroma_type
 
   enum AVPixelFormat   frames_sw_format
 
   const VDPAUPixFmtMap *   map
 
vdpau_pix_fmts []
 
const HWContextType ff_hwcontext_type_vdpau
 

Macro Definition Documentation

◆ GET_CALLBACK

#define GET_CALLBACK (   id,
  result 
)
Value:
do { \
void *tmp; \
err = hwctx->get_proc_address(hwctx->device, id, &tmp); \
if (err != VDP_STATUS_OK) { \
av_log(ctx, AV_LOG_ERROR, "Error getting the " #id " callback.\n"); \
return AVERROR_UNKNOWN; \
} \
result = tmp; \
} while (0)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVFormatContext * ctx
Definition: movenc.c:48
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71
static uint8_t tmp[11]
Definition: aes_ctr.c:26

Definition at line 131 of file hwcontext_vdpau.c.

Referenced by vdpau_device_init(), and vdpau_transfer_data_to().

Function Documentation

◆ count_pixfmts()

static int count_pixfmts ( const VDPAUPixFmtMap map)
static

Definition at line 90 of file hwcontext_vdpau.c.

Referenced by vdpau_init_pixmfts().

◆ vdpau_init_pixmfts()

static int vdpau_init_pixmfts ( AVHWDeviceContext ctx)
static

Definition at line 100 of file hwcontext_vdpau.c.

Referenced by vdpau_device_init().

◆ vdpau_device_init()

static int vdpau_device_init ( AVHWDeviceContext ctx)
static

Definition at line 142 of file hwcontext_vdpau.c.

◆ vdpau_device_uninit()

static void vdpau_device_uninit ( AVHWDeviceContext ctx)
static

Definition at line 165 of file hwcontext_vdpau.c.

◆ vdpau_frames_get_constraints()

static int vdpau_frames_get_constraints ( AVHWDeviceContext ctx,
const void hwconfig,
AVHWFramesConstraints constraints 
)
static

Definition at line 174 of file hwcontext_vdpau.c.

◆ vdpau_buffer_free()

static void vdpau_buffer_free ( void opaque,
uint8_t data 
)
static

Definition at line 203 of file hwcontext_vdpau.c.

Referenced by vdpau_pool_alloc().

◆ vdpau_pool_alloc()

static AVBufferRef* vdpau_pool_alloc ( void opaque,
int  size 
)
static

Definition at line 212 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

◆ vdpau_frames_init()

static int vdpau_frames_init ( AVHWFramesContext ctx)
static

Definition at line 240 of file hwcontext_vdpau.c.

◆ vdpau_get_buffer()

static int vdpau_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 275 of file hwcontext_vdpau.c.

◆ vdpau_transfer_get_formats()

static int vdpau_transfer_get_formats ( AVHWFramesContext ctx,
enum AVHWFrameTransferDirection  dir,
enum AVPixelFormat **  formats 
)
static

Definition at line 289 of file hwcontext_vdpau.c.

◆ vdpau_transfer_data_from()

static int vdpau_transfer_data_from ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 313 of file hwcontext_vdpau.c.

◆ vdpau_transfer_data_to()

static int vdpau_transfer_data_to ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 364 of file hwcontext_vdpau.c.

Variable Documentation

◆ pix_fmts_420

const VDPAUPixFmtMap pix_fmts_420[]
static
Initial value:
= {
{ VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV12 },
{ VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV420P },
{ 0, AV_PIX_FMT_NONE, },
}
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:85
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62

Definition at line 61 of file hwcontext_vdpau.c.

◆ pix_fmts_422

const VDPAUPixFmtMap pix_fmts_422[]
static
Initial value:
= {
{ VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV16 },
{ VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV422P },
{ VDP_YCBCR_FORMAT_UYVY, AV_PIX_FMT_UYVY422 },
{ VDP_YCBCR_FORMAT_YUYV, AV_PIX_FMT_YUYV422 },
{ 0, AV_PIX_FMT_NONE, },
}
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:77
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:63
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:197

Definition at line 67 of file hwcontext_vdpau.c.

◆ pix_fmts_444

const VDPAUPixFmtMap pix_fmts_444[]
static
Initial value:
= {
{ VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV444P },
{ 0, AV_PIX_FMT_NONE, },
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67

Definition at line 75 of file hwcontext_vdpau.c.

◆ chroma_type

VdpChromaType chroma_type

Definition at line 81 of file hwcontext_vdpau.c.

◆ frames_sw_format

enum AVPixelFormat frames_sw_format

Definition at line 82 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

◆ map

const VDPAUPixFmtMap* map

◆ vdpau_pix_fmts

const { ... } vdpau_pix_fmts[]
Initial value:
= {
{ VDP_CHROMA_TYPE_420, AV_PIX_FMT_YUV420P, pix_fmts_420 },
{ VDP_CHROMA_TYPE_422, AV_PIX_FMT_YUV422P, pix_fmts_422 },
{ VDP_CHROMA_TYPE_444, AV_PIX_FMT_YUV444P, pix_fmts_444 },
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
static const VDPAUPixFmtMap pix_fmts_422[]
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
static const VDPAUPixFmtMap pix_fmts_444[]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
static const VDPAUPixFmtMap pix_fmts_420[]

Referenced by vdpau_frames_get_constraints(), vdpau_frames_init(), vdpau_init_pixmfts(), vdpau_transfer_data_from(), and vdpau_transfer_data_to().

◆ ff_hwcontext_type_vdpau

const HWContextType ff_hwcontext_type_vdpau
Initial value:
= {
.name = "VDPAU",
.device_hwctx_size = sizeof(AVVDPAUDeviceContext),
.device_priv_size = sizeof(VDPAUDeviceContext),
.frames_priv_size = sizeof(VDPAUFramesContext),
.device_uninit = vdpau_device_uninit,
.frames_get_constraints = vdpau_frames_get_constraints,
.frames_init = vdpau_frames_init,
.frames_get_buffer = vdpau_get_buffer,
.transfer_get_formats = vdpau_transfer_get_formats,
.transfer_data_to = vdpau_transfer_data_to,
.transfer_data_from = vdpau_transfer_data_from,
}
This struct is allocated as AVHWDeviceContext.hwctx.
static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pixelformat)
Definition: v4l2.c:188
static int vdpau_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
static int vdpau_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
static int vdpau_device_init(AVHWDeviceContext *ctx)
static int vdpau_frames_init(AVHWFramesContext *ctx)
static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:193
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
static void vdpau_device_uninit(AVHWDeviceContext *ctx)
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 480 of file hwcontext_vdpau.c.