static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)

{

    InputStream *ist = s->opaque;

    const enum AVPixelFormat *p;

    int ret;



    for (p = pix_fmts; *p != -1; p++) {

        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);

        const HWAccel *hwaccel;



        if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))

            break;



        hwaccel = get_hwaccel(*p, ist->hwaccel_id);

        if (!hwaccel ||

            (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) ||

            (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id))

            continue;



        ret = hwaccel->init(s);

        if (ret < 0) {

            if (ist->hwaccel_id == hwaccel->id) {

                av_log(NULL, AV_LOG_FATAL,

                       "%s hwaccel requested for input stream #%d:%d, "

                       "but cannot be initialized.\n", hwaccel->name,

                       ist->file_index, ist->st->index);

                return AV_PIX_FMT_NONE;

            }

            continue;

        }



        if (ist->hw_frames_ctx) {

            s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);

            if (!s->hw_frames_ctx)

                return AV_PIX_FMT_NONE;

        }



        ist->active_hwaccel_id = hwaccel->id;

        ist->hwaccel_pix_fmt   = *p;

        break;

    }



    return *p;

}

static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)

{

    InputStream *ist = s->opaque;

    const enum AVPixelFormat *p;

    int ret;



    for (p = pix_fmts; *p != -1; p++) {

        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);

        const HWAccel *hwaccel;



        if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))

            break;



        hwaccel = get_hwaccel(*p, ist->hwaccel_id);

        if (!hwaccel ||

            (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) ||

            (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id))

            continue;



        ret = hwaccel->init(s);

        if (ret < 0) {

            if (ist->hwaccel_id == hwaccel->id) {

                av_log(NULL, AV_LOG_FATAL,

                       "%s hwaccel requested for input stream #%d:%d, "

                       "but cannot be initialized.\n", hwaccel->name,

                       ist->file_index, ist->st->index);

                return AV_PIX_FMT_NONE;

            }

            continue;

        }



        if (ist->hw_frames_ctx) {

            s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);

            if (!s->hw_frames_ctx)

                return AV_PIX_FMT_NONE;

        }



        ist->active_hwaccel_id = hwaccel->id;

        ist->hwaccel_pix_fmt   = *p;

        break;

    }



    return *p;

}

static enum AVPixelFormat FUNC_0(AVCodecContext *VAR_0, const enum AVPixelFormat *VAR_1)

{

    InputStream *ist = VAR_0->opaque;

    const enum AVPixelFormat *VAR_2;

    int VAR_3;



    for (VAR_2 = VAR_1; *VAR_2 != -1; VAR_2++) {

        const AVPixFmtDescriptor *VAR_4 = av_pix_fmt_desc_get(*VAR_2);

        const HWAccel *VAR_5;



        if (!(VAR_4->flags & AV_PIX_FMT_FLAG_HWACCEL))

            break;



        VAR_5 = get_hwaccel(*VAR_2, ist->hwaccel_id);

        if (!VAR_5 ||

            (ist->active_hwaccel_id && ist->active_hwaccel_id != VAR_5->id) ||

            (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != VAR_5->id))

            continue;



        VAR_3 = VAR_5->init(VAR_0);

        if (VAR_3 < 0) {

            if (ist->hwaccel_id == VAR_5->id) {

                av_log(NULL, AV_LOG_FATAL,

                       "%VAR_0 VAR_5 requested for input stream #%d:%d, "

                       "but cannot be initialized.\n", VAR_5->name,

                       ist->file_index, ist->st->index);

                return AV_PIX_FMT_NONE;

            }

            continue;

        }



        if (ist->hw_frames_ctx) {

            VAR_0->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);

            if (!VAR_0->hw_frames_ctx)

                return AV_PIX_FMT_NONE;

        }



        ist->active_hwaccel_id = VAR_5->id;

        ist->hwaccel_pix_fmt   = *VAR_2;

        break;

    }



    return *VAR_2;

}

static enum AVPixelFormat FUNC_0(AVCodecContext *VAR_0, const enum AVPixelFormat *VAR_1)
{ InputStream *ist = VAR_0->opaque; const enum AVPixelFormat *VAR_2; int VAR_3; for (VAR_2 = VAR_1; *VAR_2 != -1; VAR_2++) { const AVPixFmtDescriptor *VAR_4 = av_pix_fmt_desc_get(*VAR_2); const HWAccel *VAR_5; if (!(VAR_4->flags & AV_PIX_FMT_FLAG_HWACCEL))
break; VAR_5 = get_hwaccel(*VAR_2, ist->hwaccel_id); if (!VAR_5 ||
(ist->active_hwaccel_id && ist->active_hwaccel_id != VAR_5->id) ||
(ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != VAR_5->id))
continue; VAR_3 = VAR_5->init(VAR_0); if (VAR_3 < 0) { if (ist->hwaccel_id == VAR_5->id) { av_log(NULL, AV_LOG_FATAL,
"%VAR_0 VAR_5 requested for input stream #%d:%d, "
"but cannot be initialized.\n", VAR_5->name,
ist->file_index, ist->st->index); return AV_PIX_FMT_NONE; } continue; } if (ist->hw_frames_ctx) { VAR_0->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx); if (!VAR_0->hw_frames_ctx)
return AV_PIX_FMT_NONE; } ist->active_hwaccel_id = VAR_5->id; ist->hwaccel_pix_fmt   = *VAR_2; break; } return *VAR_2; }