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

Function amf_init_frames_context

libavcodec/amfdec.c:239–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239static int amf_init_frames_context(AVCodecContext *avctx, int sw_format, int new_width, int new_height)
240{
241 int ret;
242 AVHWDeviceContext *hwdev_ctx;
243 AVHWFramesContext *hwframes_ctx;
244 AMFDecoderContext *ctx;
245 if (!avctx->hw_frames_ctx || !avctx->hw_device_ctx)
246 return 0;
247 hwdev_ctx = (AVHWDeviceContext*)avctx->hw_device_ctx->data;
248 hwframes_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
249 ctx = avctx->priv_data;
250
251 if (hwdev_ctx->type != AV_HWDEVICE_TYPE_AMF)
252 return 0;
253
254 hwframes_ctx->width = new_width;
255 hwframes_ctx->height = new_height;
256 hwframes_ctx->format = AV_PIX_FMT_AMF_SURFACE;
257 hwframes_ctx->sw_format = sw_format;
258 hwframes_ctx->initial_pool_size = ctx->surface_pool_size + 8;
259
260 ret = av_hwframe_ctx_init(avctx->hw_frames_ctx);
261 if (ret < 0) {
262 av_log(NULL, AV_LOG_ERROR, "Error initializing a AMF frame pool\n");
263 av_buffer_unref(&avctx->hw_frames_ctx);
264 return ret;
265 }
266 return 0;
267}
268
269static int amf_decode_init(AVCodecContext *avctx)
270{

Callers 2

amf_decode_initFunction · 0.85
amf_decode_frameFunction · 0.85

Calls 3

av_hwframe_ctx_initFunction · 0.85
av_logFunction · 0.85
av_buffer_unrefFunction · 0.85

Tested by

no test coverage detected