MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_dxva2_commit_buffer

Function ff_dxva2_commit_buffer

libavcodec/dxva2.c:44–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44int ff_dxva2_commit_buffer(AVCodecContext *avctx,
45 struct dxva_context *ctx,
46 DXVA2_DecodeBufferDesc *dsc,
47 unsigned type, const void *data, unsigned size,
48 unsigned mb_count)
49{
50 void *dxva_data;
51 unsigned dxva_size;
52 int result;
53
54 if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->decoder, type,
55 &dxva_data, &dxva_size))) {
56 av_log(avctx, AV_LOG_ERROR, "Failed to get a buffer for %d\n", type);
57 return -1;
58 }
59 if (size <= dxva_size) {
60 memcpy(dxva_data, data, size);
61
62 memset(dsc, 0, sizeof(*dsc));
63 dsc->CompressedBufferType = type;
64 dsc->DataSize = size;
65 dsc->NumMBsInBuffer = mb_count;
66
67 result = 0;
68 } else {
69 av_log(avctx, AV_LOG_ERROR, "Buffer for type %d was too small\n", type);
70 result = -1;
71 }
72 if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->decoder, type))) {
73 av_log(avctx, AV_LOG_ERROR, "Failed to release buffer type %d\n", type);
74 result = -1;
75 }
76 return result;
77}
78
79int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
80 const void *pp, unsigned pp_size,

Calls 1

av_logFunction · 0.85

Tested by

no test coverage detected