I am trying to use videotoolbox to encode yuv frames for macOS. I am able
to find the appropriate device and successfully create AVHWFramesContext. But
when trying to call av_hwframe_get_buffer, I always get the error (
AVERROR(EINVAL)) because my AVHWFramesContext pool is NULL.

Here is code to create device context:

ret = av_hwdevice_ctx_create(&deviceCtx_, hwType, nullptr, nullptr, 0);


And to create frame context:


framesCtx_ = av_hwframe_ctx_alloc(deviceCtx_);

if (!framesCtx_)

    return false;


 AVHWFramesContext *ctx = (AVHWFramesContext*)(framesCtx_->data);

 ctx->format = format_;

 ctx->sw_format = swFormat_;

 ctx->width = width;

 ctx->height = height;


 if ((ret = av_hwframe_ctx_init(framesCtx_)) < 0)

     av_buffer_unref(&framesCtx_);


Do I need to set the initial pool size when using videotoolbox? If I do, I
get error when calling av_hwframe_ctx_init. In this case, the internal pool
is NULL.

Do I need to manage the context pool myself or should it be done
automatically?
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to