FFmpeg
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  VDPAUPixFmtMap
 
struct  VDPAUDeviceContext
 
struct  VDPAUFramesContext
 

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, size_t 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)

Definition at line 152 of file hwcontext_vdpau.c.

Function Documentation

◆ count_pixfmts()

static int count_pixfmts ( const VDPAUPixFmtMap map)
static

Definition at line 111 of file hwcontext_vdpau.c.

Referenced by vdpau_init_pixmfts().

◆ vdpau_init_pixmfts()

static int vdpau_init_pixmfts ( AVHWDeviceContext ctx)
static

Definition at line 121 of file hwcontext_vdpau.c.

Referenced by vdpau_device_init().

◆ vdpau_device_init()

static int vdpau_device_init ( AVHWDeviceContext ctx)
static

Definition at line 163 of file hwcontext_vdpau.c.

◆ vdpau_device_uninit()

static void vdpau_device_uninit ( AVHWDeviceContext ctx)
static

Definition at line 186 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 195 of file hwcontext_vdpau.c.

◆ vdpau_buffer_free()

static void vdpau_buffer_free ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 224 of file hwcontext_vdpau.c.

Referenced by vdpau_pool_alloc().

◆ vdpau_pool_alloc()

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

Definition at line 233 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

◆ vdpau_frames_init()

static int vdpau_frames_init ( AVHWFramesContext ctx)
static

Definition at line 261 of file hwcontext_vdpau.c.

◆ vdpau_get_buffer()

static int vdpau_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 297 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 311 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 335 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 393 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, },
}

Definition at line 40 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, },
}

Definition at line 50 of file hwcontext_vdpau.c.

◆ pix_fmts_444

const VDPAUPixFmtMap pix_fmts_444[]
static
Initial value:
= {
{ 0, AV_PIX_FMT_NONE, },
}

Definition at line 58 of file hwcontext_vdpau.c.

◆ chroma_type

VdpChromaType chroma_type

Definition at line 69 of file hwcontext_vdpau.c.

◆ frames_sw_format

enum AVPixelFormat frames_sw_format

Definition at line 70 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

◆ map

const VDPAUPixFmtMap* map

Definition at line 71 of file hwcontext_vdpau.c.

Referenced by ac3_decode_frame(), aptx_insert_sync(), av_channel_layout_ambisonic_order(), av_channel_layout_custom_init(), av_get_pcm_codec(), av_spherical_tile_bounds(), bidir_refine(), colormap_insert(), colormap_nearest_node(), count_pixfmts(), create_map(), d3d11va_transfer_data(), decode_alcd(), decode_avcf(), decode_frame(), decode_inter_block(), decode_inter_blocks(), decode_inter_plane(), decode_intra_block(), decode_intra_blocks(), decode_motion_vectors(), disp_node(), drm_transfer_data_from(), drm_transfer_data_to(), drm_unmap_frame(), dxva2_map_frame(), dxva2_transfer_data_from(), dxva2_transfer_data_to(), epzs_motion_search_internal(), ff_huff_gen_len_table(), ff_opus_parse_extradata(), ff_tx_fft(), ff_tx_fft_inplace(), fill_colmap(), fill_map(), fill_rgb2yuv_table(), fill_texture_ptrs(), filter_frame(), find_layout_map(), fits_decode_frame(), fits_encode_frame(), fps_umf2avr(), generate_joint_tables(), get_aac_tag(), get_channel(), get_channel_idx(), get_channel_label(), get_vs_prop_int(), gif_image_write_image(), hwmap_filter_frame(), init(), is_layout_valid_for_tag(), ls_encode_regular(), ls_encode_runterm(), ls_get_code_runterm(), make_block_map(), make_horizontal_map(), make_vertical_map(), map_init(), map_manual(), map_uninit(), match_streams(), mov_get_channel_layout(), mov_read_kind(), mov_write_track_kinds(), of_map_group(), opencl_map_frame(), opencl_unmap_frame(), opus_decode_packet(), parse_channel_list(), parse_mapping(), parse_maps(), print_ctl_info(), qpel_motion_search(), read_code(), read_map(), remap_frame_to_palette(), sab_diamond_search(), set_default_ctl_value(), shrink_palette(), side_data_map(), small_diamond_search(), tonemap(), vaapi_map_frame(), vaapi_transfer_data_from(), vaapi_transfer_data_to(), vaapi_unmap_frame(), vdpau_init_pixmfts(), vdpau_transfer_data_from(), vdpau_transfer_data_to(), vp6_build_huff_tree(), vt_transfer_data_from(), vt_transfer_data_to(), and wmv2_get_cbp_table_index().

◆ vdpau_pix_fmts

const { ... } vdpau_pix_fmts[]

◆ ff_hwcontext_type_vdpau

const HWContextType ff_hwcontext_type_vdpau
Initial value:
= {
.name = "VDPAU",
.device_hwctx_size = sizeof(VDPAUDeviceContext),
.frames_hwctx_size = sizeof(VDPAUFramesContext),
.device_init = vdpau_device_init,
.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,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU, AV_PIX_FMT_NONE },
}

Definition at line 513 of file hwcontext_vdpau.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
VDPAUFramesContext
Definition: hwcontext_vdpau.c:101
vdpau_frames_init
static int vdpau_frames_init(AVHWFramesContext *ctx)
Definition: hwcontext_vdpau.c:261
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
pix_fmts_422
static const VDPAUPixFmtMap pix_fmts_422[]
Definition: hwcontext_vdpau.c:50
VDPAUDeviceContext
Definition: hwcontext_vdpau.c:85
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
pix_fmts_420
static const VDPAUPixFmtMap pix_fmts_420[]
Definition: hwcontext_vdpau.c:40
vdpau_frames_get_constraints
static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
Definition: hwcontext_vdpau.c:195
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:74
vdpau_device_uninit
static void vdpau_device_uninit(AVHWDeviceContext *ctx)
Definition: hwcontext_vdpau.c:186
AV_PIX_FMT_NV16
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:198
AV_PIX_FMT_VDPAU
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:194
vdpau_transfer_data_to
static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_vdpau.c:393
AV_HWDEVICE_TYPE_VDPAU
@ AV_HWDEVICE_TYPE_VDPAU
Definition: hwcontext.h:29
vdpau_transfer_get_formats
static int vdpau_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
Definition: hwcontext_vdpau.c:311
pix_fmts_444
static const VDPAUPixFmtMap pix_fmts_444[]
Definition: hwcontext_vdpau.c:58
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:96
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
vdpau_transfer_data_from
static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_vdpau.c:335
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
vdpau_device_init
static int vdpau_device_init(AVHWDeviceContext *ctx)
Definition: hwcontext_vdpau.c:163
vdpau_get_buffer
static int vdpau_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
Definition: hwcontext_vdpau.c:297