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  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

#define GET_CALLBACK (   id,
  result 
)
Value:
do { \
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"); \
} \
} while (0)
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
AVFormatContext * ctx
Definition: movenc.c:48
if(ret)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
and forward the result(frame or status change) to the corresponding input.If nothing is possible
static uint8_t tmp[11]
Definition: aes_ctr.c:26

Definition at line 133 of file hwcontext_vdpau.c.

Referenced by vdpau_device_init(), and vdpau_transfer_data_to().

Function Documentation

static int count_pixfmts ( const VDPAUPixFmtMap map)
static

Definition at line 92 of file hwcontext_vdpau.c.

Referenced by vdpau_init_pixmfts().

static int vdpau_init_pixmfts ( AVHWDeviceContext ctx)
static

Definition at line 102 of file hwcontext_vdpau.c.

Referenced by vdpau_device_init().

static int vdpau_device_init ( AVHWDeviceContext ctx)
static

Definition at line 144 of file hwcontext_vdpau.c.

static void vdpau_device_uninit ( AVHWDeviceContext ctx)
static

Definition at line 167 of file hwcontext_vdpau.c.

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

Definition at line 176 of file hwcontext_vdpau.c.

static void vdpau_buffer_free ( void opaque,
uint8_t data 
)
static

Definition at line 205 of file hwcontext_vdpau.c.

Referenced by vdpau_pool_alloc().

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

Definition at line 214 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

static int vdpau_frames_init ( AVHWFramesContext ctx)
static

Definition at line 242 of file hwcontext_vdpau.c.

static int vdpau_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 277 of file hwcontext_vdpau.c.

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

Definition at line 291 of file hwcontext_vdpau.c.

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

Definition at line 315 of file hwcontext_vdpau.c.

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

Definition at line 370 of file hwcontext_vdpau.c.

Variable Documentation

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:89
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66

Definition at line 61 of file hwcontext_vdpau.c.

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:81
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:201

Definition at line 67 of file hwcontext_vdpau.c.

const VDPAUPixFmtMap pix_fmts_444[]
static
Initial value:

Definition at line 75 of file hwcontext_vdpau.c.

VdpChromaType chroma_type

Definition at line 83 of file hwcontext_vdpau.c.

enum AVPixelFormat frames_sw_format

Definition at line 84 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

const VDPAUPixFmtMap* map
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:71
static const VDPAUPixFmtMap pix_fmts_422[]
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
static const VDPAUPixFmtMap pix_fmts_444[]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
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().

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:192
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:197
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
static void vdpau_device_uninit(AVHWDeviceContext *ctx)
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64

Definition at line 490 of file hwcontext_vdpau.c.