41 type, size, 1, (
void*)data, &buffer);
42 if (vas != VA_STATUS_SUCCESS) {
44 "buffer (type %d): %d (%s).\n",
45 type, vas, vaErrorStr(vas));
52 "is %#x.\n", type, size, buffer);
59 const void *params_data,
61 const void *slice_data,
87 VASliceParameterBufferType,
88 params_size, 1, (
void*)params_data,
90 if (vas != VA_STATUS_SUCCESS) {
92 "parameter buffer: %d (%s).\n", vas, vaErrorStr(vas));
101 VASliceDataBufferType,
102 slice_size, 1, (
void*)slice_data,
104 if (vas != VA_STATUS_SUCCESS) {
106 "data buffer (size %zu): %d (%s).\n",
107 slice_size, vas, vaErrorStr(vas));
131 if (vas != VA_STATUS_SUCCESS) {
133 "parameter buffer %#x: %d (%s).\n",
138 for (i = 0; i < 2 * pic->
nb_slices; i++) {
141 if (vas != VA_STATUS_SUCCESS) {
143 "slice buffer %#x: %d (%s).\n",
161 if (vas != VA_STATUS_SUCCESS) {
163 "issue: %d (%s).\n", vas, vaErrorStr(vas));
165 goto fail_with_picture;
170 if (vas != VA_STATUS_SUCCESS) {
172 "parameters: %d (%s).\n", vas, vaErrorStr(vas));
174 goto fail_with_picture;
179 if (vas != VA_STATUS_SUCCESS) {
181 "%d (%s).\n", vas, vaErrorStr(vas));
183 goto fail_with_picture;
187 if (vas != VA_STATUS_SUCCESS) {
189 "issue: %d (%s).\n", vas, vaErrorStr(vas));
211 if (vas != VA_STATUS_SUCCESS) {
213 "after error: %d (%s).\n", vas, vaErrorStr(vas));
234 static const struct {
239 #define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, VAProfile ## v }
240 MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2Simple ),
241 MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2Main ),
243 MAP(MPEG4, MPEG4_SIMPLE, MPEG4Simple ),
244 MAP(MPEG4, MPEG4_ADVANCED_SIMPLE,
245 MPEG4AdvancedSimple),
246 MAP(MPEG4, MPEG4_MAIN, MPEG4Main ),
247 MAP(H264, H264_CONSTRAINED_BASELINE,
248 H264ConstrainedBaseline),
249 MAP(H264, H264_MAIN, H264Main ),
250 MAP(H264, H264_HIGH, H264High ),
251 #if VA_CHECK_VERSION(0, 37, 0)
252 MAP(HEVC, HEVC_MAIN, HEVCMain ),
253 MAP(HEVC, HEVC_MAIN_10, HEVCMain10 ),
255 MAP(WMV3, VC1_SIMPLE, VC1Simple ),
256 MAP(WMV3, VC1_MAIN, VC1Main ),
257 MAP(WMV3, VC1_COMPLEX, VC1Advanced ),
258 MAP(WMV3, VC1_ADVANCED, VC1Advanced ),
259 MAP(VC1, VC1_SIMPLE, VC1Simple ),
260 MAP(VC1, VC1_MAIN, VC1Main ),
261 MAP(VC1, VC1_COMPLEX, VC1Advanced ),
262 MAP(VC1, VC1_ADVANCED, VC1Advanced ),
263 #if VA_CHECK_VERSION(0, 35, 0)
266 #if VA_CHECK_VERSION(0, 38, 0)
267 MAP(VP9, VP9_0, VP9Profile0 ),
269 #if VA_CHECK_VERSION(0, 39, 0)
270 MAP(VP9, VP9_2, VP9Profile2 ),
285 int profile_count, exact_match, alt_profile;
303 profile_list, &profile_count);
304 if (vas != VA_STATUS_SUCCESS) {
306 "%d (%s).\n", vas, vaErrorStr(vas));
311 profile = VAProfileNone;
315 int profile_match = 0;
321 for (j = 0; j < profile_count; j++) {
322 if (profile == profile_list[j]) {
323 exact_match = profile_match;
327 if (j < profile_count) {
336 if (profile == VAProfileNone) {
338 "profile %d.\n", codec_desc->
name, avctx->
profile);
346 "supported for hardware decode.\n",
349 "incompatible profile %d instead.\n",
354 "supported for hardware decode.\n",
367 if (vas != VA_STATUS_SUCCESS) {
369 "configuration: %d (%s).\n", vas, vaErrorStr(vas));
398 "size %dx%d (constraints: width %d-%d height %d-%d).\n",
408 "usable surface formats.\n");
429 if (j < desc->nb_components)
481 #if FF_API_STRUCT_VAAPI_CONTEXT
484 "vaapi_context in decode.\n");
526 "decoding must be a VAAPI device (not %d).\n",
534 "is required for VAAPI decoding.\n");
539 #if FF_API_STRUCT_VAAPI_CONTEXT
571 "frames context: %d.\n", err);
584 if (vas != VA_STATUS_SUCCESS) {
586 "context: %d (%s).\n", vas, vaErrorStr(vas));
593 #if FF_API_STRUCT_VAAPI_CONTEXT
609 #if FF_API_STRUCT_VAAPI_CONTEXT
617 if (vas != VA_STATUS_SUCCESS) {
619 "context %#x: %d (%s).\n",
625 if (vas != VA_STATUS_SUCCESS) {
627 "configuration %#x: %d (%s).\n",
632 #if FF_API_STRUCT_VAAPI_CONTEXT
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
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)
The driver does not destroy parameter buffers when they are used by vaRenderPicture().
ptrdiff_t const GLvoid * data
int coded_width
Bitstream width / height, may be different from width/height e.g.
#define AV_LOG_WARNING
Something somehow does not look correct.
static void ff_vaapi_decode_destroy_buffers(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
uint32_t context_id
Context ID (video decode pipeline)
FF_ENABLE_DEPRECATION_WARNINGS AVHWDeviceContext * device
int width
The allocated dimensions of the frames in this pool.
void * av_hwdevice_hwconfig_alloc(AVBufferRef *ref)
Allocate a HW-specific configuration structure for a given HW device.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
int max_width
The maximum size of frames in this hw_frames_ctx.
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
Free an AVHWFrameConstraints structure.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
void * hwaccel_context
Hardware accelerator context.
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
static int vaapi_decode_make_config(AVCodecContext *avctx)
AVHWFramesContext * frames
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
AVVAAPIDeviceContext * hwctx
#define AV_LOG_VERBOSE
Detailed information.
enum AVPixelFormat surface_format
VAEntrypoint va_entrypoint
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVVAAPIFramesContext * hwfc
VAAPI hardware pipeline configuration details.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
int active_thread_type
Which multithreading methods are in use by the codec.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
simple assert() macros that are a bit more flexible than ISO C assert().
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
FF_DISABLE_DEPRECATION_WARNINGS int have_old_context
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
int initial_pool_size
Initial size of the frame pool.
uint8_t nb_components
The number of components each pixel has, (1-4)
#define FF_THREAD_FRAME
Decode more than one frame at once.
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
int ff_vaapi_decode_init(AVCodecContext *avctx)
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames...
VABufferID * slice_buffers
struct vaapi_context * old_context
#define FF_ARRAY_ELEMS(a)
VABufferID param_buffers[MAX_PARAM_BUFFERS]
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
VADisplay display
The VADisplay handle, to be filled by the user.
VASurfaceID output_surface
void * display
Window system dependent data.
int min_width
The minimum size of frames in this hw_frames_ctx.
AVBufferRef * av_hwdevice_ctx_alloc(enum AVHWDeviceType type)
Allocate an AVHWDeviceContext for a given hardware type.
Libavcodec external API header.
This struct describes the constraints on hardware frames attached to a given device with a hardware-s...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
AVHWFramesConstraints * av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, const void *hwconfig)
Get the constraints on HW frames given a device and the HW-specific configuration to be used with tha...
uint8_t * data
The data buffer.
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
unsigned int driver_quirks
Driver quirks to apply - this is filled by av_hwdevice_ctx_init(), with reference to a table of known...
This struct describes a set or pool of "hardware" frames (i.e.
const char * name
Name of the codec described by this descriptor.
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
This struct describes the properties of a single codec described by an AVCodecID. ...
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
common internal api header.
common internal and external API header
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
void * hwaccel_priv_data
hwaccel-specific private data
struct AVCodecInternal * internal
Private context used for internal data.
enum AVPixelFormat * valid_sw_formats
A list of possible values for sw_format in the hw_frames_ctx, terminated by AV_PIX_FMT_NONE.
VAConfigID config_id
ID of a VAAPI pipeline configuration.
VASurfaceID * surface_ids
The surfaces IDs of all surfaces in the pool after creation.
#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
Hardware acceleration should still be attempted for decoding when the codec profile does not match th...
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active)...
#define av_malloc_array(a, b)
static const struct @124 vaapi_profile_map[]
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...
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, const void *params_data, size_t params_size, const void *slice_data, size_t slice_size)
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
uint32_t config_id
Configuration ID.