static int setup_hwaccel(AVCodecContext *avctx,
                         const enum AVPixelFormat fmt,
                         const char *name)
{
    AVHWAccel *hwa = find_hwaccel(avctx->codec_id, fmt);
    int ret        = 0;
    if (!hwa) {
               "Could not find an AVHWAccel for the pixel format: %s",
               name);
        return AVERROR(ENOENT);
    if (hwa->capabilities & HWACCEL_CODEC_CAP_EXPERIMENTAL &&
        avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
        av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
               hwa->name);
        return AVERROR_PATCHWELCOME;
    if (hwa->priv_data_size) {
        avctx->internal->hwaccel_priv_data = av_mallocz(hwa->priv_data_size);
        if (!avctx->internal->hwaccel_priv_data)
            return AVERROR(ENOMEM);
    if (hwa->init) {
        ret = hwa->init(avctx);
        if (ret < 0) {
            av_freep(&avctx->internal->hwaccel_priv_data);
            return ret;
    avctx->hwaccel = hwa;
    return 0;
static int setup_hwaccel(AVCodecContext *avctx,
                         const enum AVPixelFormat fmt,
                         const char *name)
{
    AVHWAccel *hwa = find_hwaccel(avctx->codec_id, fmt);
    int ret        = 0;
    if (!hwa) {
               "Could not find an AVHWAccel for the pixel format: %s",
               name);
        return AVERROR(ENOENT);
    if (hwa->capabilities & HWACCEL_CODEC_CAP_EXPERIMENTAL &&
        avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
        av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
               hwa->name);
        return AVERROR_PATCHWELCOME;
    if (hwa->priv_data_size) {
        avctx->internal->hwaccel_priv_data = av_mallocz(hwa->priv_data_size);
        if (!avctx->internal->hwaccel_priv_data)
            return AVERROR(ENOMEM);
    if (hwa->init) {
        ret = hwa->init(avctx);
        if (ret < 0) {
            av_freep(&avctx->internal->hwaccel_priv_data);
            return ret;
    avctx->hwaccel = hwa;
    return 0;
static int FUNC_0(AVCodecContext *VAR_0,
                         const enum AVPixelFormat VAR_1,
                         const char *VAR_2)
{
    AVHWAccel *hwa = find_hwaccel(VAR_0->codec_id, VAR_1);
    int VAR_3        = 0;
    if (!hwa) {
               "Could not find an AVHWAccel for the pixel format: %s",
               VAR_2);
        return AVERROR(ENOENT);
    if (hwa->capabilities & HWACCEL_CODEC_CAP_EXPERIMENTAL &&
        VAR_0->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
        av_log(VAR_0, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
               hwa->VAR_2);
        return AVERROR_PATCHWELCOME;
    if (hwa->priv_data_size) {
        VAR_0->internal->hwaccel_priv_data = av_mallocz(hwa->priv_data_size);
        if (!VAR_0->internal->hwaccel_priv_data)
            return AVERROR(ENOMEM);
    if (hwa->init) {
        VAR_3 = hwa->init(VAR_0);
        if (VAR_3 < 0) {
            av_freep(&VAR_0->internal->hwaccel_priv_data);
            return VAR_3;
    VAR_0->hwaccel = hwa;
    return 0;
static int FUNC_0(AVCodecContext *VAR_0,
const enum AVPixelFormat VAR_1,
const char *VAR_2)
{ AVHWAccel *hwa = find_hwaccel(VAR_0->codec_id, VAR_1); int VAR_3        = 0; if (!hwa) { "Could not find an AVHWAccel for the pixel format: %s",
VAR_2); return AVERROR(ENOENT); if (hwa->capabilities & HWACCEL_CODEC_CAP_EXPERIMENTAL &&
VAR_0->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(VAR_0, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
hwa->VAR_2); return AVERROR_PATCHWELCOME; if (hwa->priv_data_size) { VAR_0->internal->hwaccel_priv_data = av_mallocz(hwa->priv_data_size); if (!VAR_0->internal->hwaccel_priv_data)
return AVERROR(ENOMEM); if (hwa->init) { VAR_3 = hwa->init(VAR_0); if (VAR_3 < 0) { av_freep(&VAR_0->internal->hwaccel_priv_data); return VAR_3; VAR_0->hwaccel = hwa; return 0;