| 2297 | } |
| 2298 | |
| 2299 | int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private) |
| 2300 | { |
| 2301 | const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); |
| 2302 | |
| 2303 | if (!hwaccel || !hwaccel->frame_priv_data_size) |
| 2304 | return 0; |
| 2305 | |
| 2306 | av_assert0(!*hwaccel_picture_private); |
| 2307 | |
| 2308 | if (hwaccel->free_frame_priv) { |
| 2309 | AVHWFramesContext *frames_ctx; |
| 2310 | |
| 2311 | if (!avctx->hw_frames_ctx) |
| 2312 | return AVERROR(EINVAL); |
| 2313 | |
| 2314 | frames_ctx = (AVHWFramesContext *) avctx->hw_frames_ctx->data; |
| 2315 | *hwaccel_picture_private = av_refstruct_alloc_ext(hwaccel->frame_priv_data_size, 0, |
| 2316 | frames_ctx->device_ctx, |
| 2317 | hwaccel->free_frame_priv); |
| 2318 | } else { |
| 2319 | *hwaccel_picture_private = av_refstruct_allocz(hwaccel->frame_priv_data_size); |
| 2320 | } |
| 2321 | |
| 2322 | if (!*hwaccel_picture_private) |
| 2323 | return AVERROR(ENOMEM); |
| 2324 | |
| 2325 | return 0; |
| 2326 | } |
| 2327 | |
| 2328 | av_cold void ff_decode_flush_buffers(AVCodecContext *avctx) |
| 2329 | { |
no test coverage detected