35 return picture->
f.
data[3];
54 DXVA2_DecodeBufferDesc *dsc,
55 unsigned type,
const void *
data,
unsigned size,
63 hr = IDirectXVideoDecoder_GetBuffer(ctx->
decoder, type,
64 &dxva_data, &dxva_size);
70 if (size <= dxva_size) {
71 memcpy(dxva_data, data, size);
73 memset(dsc, 0,
sizeof(*dsc));
74 dsc->CompressedBufferType = type;
76 dsc->NumMBsInBuffer = mb_count;
84 hr = IDirectXVideoDecoder_ReleaseBuffer(ctx->
decoder, type);
87 "Failed to release buffer type %u: 0x%lx\n",
95 const void *pp,
unsigned pp_size,
96 const void *qm,
unsigned qm_size,
98 DXVA2_DecodeBufferDesc *bs,
99 DXVA2_DecodeBufferDesc *slice))
102 unsigned buffer_count = 0;
103 DXVA2_DecodeBufferDesc
buffer[4];
104 DXVA2_DecodeExecuteParams exec = { 0 };
105 int result, runs = 0;
109 hr = IDirectXVideoDecoder_BeginFrame(ctx->
decoder,
114 }
while (hr == E_PENDING && ++runs < 50);
122 DXVA2_PictureParametersBufferType,
126 "Failed to add picture parameter buffer\n");
133 DXVA2_InverseQuantizationMatrixBufferType,
137 "Failed to add inverse quantization matrix buffer\n");
143 result = commit_bs_si(avctx,
144 &buffer[buffer_count + 0],
145 &buffer[buffer_count + 1]);
148 "Failed to add bitstream or slice control buffer\n");
155 assert(buffer_count == 1 + (qm_size > 0) + 2);
157 exec.NumCompBuffers = buffer_count;
158 exec.pCompressedBuffers =
buffer;
159 exec.pExtensionData =
NULL;
160 hr = IDirectXVideoDecoder_Execute(ctx->
decoder, &exec);
167 hr = IDirectXVideoDecoder_EndFrame(ctx->
decoder,
NULL);
LPDIRECT3DSURFACE9 * surface
The array of Direct3D surfaces used to create the decoder.
int av_usleep(unsigned usec)
Sleep for a period of time.
unsigned surface_count
The number of surface in the surface array.
void * hwaccel_context
Hardware accelerator context.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * ff_dxva2_get_surface(const Picture *picture)
void av_log(void *avcl, int level, const char *fmt,...)
int ff_dxva2_common_end_frame(AVCodecContext *avctx, Picture *pic, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DXVA2_DecodeBufferDesc *bs, DXVA2_DecodeBufferDesc *slice))
int ff_dxva2_commit_buffer(AVCodecContext *avctx, struct dxva_context *ctx, DXVA2_DecodeBufferDesc *dsc, unsigned type, const void *data, unsigned size, unsigned mb_count)
unsigned ff_dxva2_get_surface_index(const struct dxva_context *ctx, const Picture *picture)
Libavcodec external API header.
main external API structure.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
IDirectXVideoDecoder * decoder
DXVA2 decoder object.
This structure is used to provides the necessary configurations and data to the DXVA2 Libav HWAccel i...