static int vdadec_decode(AVCodecContext *avctx,
        void *data, int *got_frame, AVPacket *avpkt)
{
    VDADecoderContext *ctx = avctx->priv_data;
    AVFrame *pic = data;
    int ret;
    ret = ff_h264_decoder.decode(avctx, data, got_frame, avpkt);
    if (*got_frame) {
        AVBufferRef *buffer = pic->buf[0];
        VDABufferContext *context = av_buffer_get_opaque(buffer);
        CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3];
        CVPixelBufferLockBaseAddress(cv_buffer, 0);
        context->cv_buffer = cv_buffer;
        pic->format = ctx->pix_fmt;
        if (CVPixelBufferIsPlanar(cv_buffer)) {
            int i, count = CVPixelBufferGetPlaneCount(cv_buffer);
            av_assert0(count < 4);
            for (i = 0; i < count; i++) {
                pic->data[i] = CVPixelBufferGetBaseAddressOfPlane(cv_buffer, i);
                pic->linesize[i] = CVPixelBufferGetBytesPerRowOfPlane(cv_buffer, i);
            }
        } else {
            pic->data[0] = CVPixelBufferGetBaseAddress(cv_buffer);
            pic->linesize[0] = CVPixelBufferGetBytesPerRow(cv_buffer);
        }
    }
    avctx->pix_fmt = ctx->pix_fmt;
    return ret;
}
static int vdadec_decode(AVCodecContext *avctx,
        void *data, int *got_frame, AVPacket *avpkt)
{
    VDADecoderContext *ctx = avctx->priv_data;
    AVFrame *pic = data;
    int ret;
    ret = ff_h264_decoder.decode(avctx, data, got_frame, avpkt);
    if (*got_frame) {
        AVBufferRef *buffer = pic->buf[0];
        VDABufferContext *context = av_buffer_get_opaque(buffer);
        CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3];
        CVPixelBufferLockBaseAddress(cv_buffer, 0);
        context->cv_buffer = cv_buffer;
        pic->format = ctx->pix_fmt;
        if (CVPixelBufferIsPlanar(cv_buffer)) {
            int i, count = CVPixelBufferGetPlaneCount(cv_buffer);
            av_assert0(count < 4);
            for (i = 0; i < count; i++) {
                pic->data[i] = CVPixelBufferGetBaseAddressOfPlane(cv_buffer, i);
                pic->linesize[i] = CVPixelBufferGetBytesPerRowOfPlane(cv_buffer, i);
            }
        } else {
            pic->data[0] = CVPixelBufferGetBaseAddress(cv_buffer);
            pic->linesize[0] = CVPixelBufferGetBytesPerRow(cv_buffer);
        }
    }
    avctx->pix_fmt = ctx->pix_fmt;
    return ret;
}
static int FUNC_0(AVCodecContext *VAR_0,
        void *VAR_1, int *VAR_2, AVPacket *VAR_3)
{
    VDADecoderContext *ctx = VAR_0->priv_data;
    AVFrame *pic = VAR_1;
    int VAR_4;
    VAR_4 = ff_h264_decoder.decode(VAR_0, VAR_1, VAR_2, VAR_3);
    if (*VAR_2) {
        AVBufferRef *buffer = pic->buf[0];
        VDABufferContext *context = av_buffer_get_opaque(buffer);
        CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->VAR_1[3];
        CVPixelBufferLockBaseAddress(cv_buffer, 0);
        context->cv_buffer = cv_buffer;
        pic->format = ctx->pix_fmt;
        if (CVPixelBufferIsPlanar(cv_buffer)) {
            int VAR_5, VAR_6 = CVPixelBufferGetPlaneCount(cv_buffer);
            av_assert0(VAR_6 < 4);
            for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) {
                pic->VAR_1[VAR_5] = CVPixelBufferGetBaseAddressOfPlane(cv_buffer, VAR_5);
                pic->linesize[VAR_5] = CVPixelBufferGetBytesPerRowOfPlane(cv_buffer, VAR_5);
            }
        } else {
            pic->VAR_1[0] = CVPixelBufferGetBaseAddress(cv_buffer);
            pic->linesize[0] = CVPixelBufferGetBytesPerRow(cv_buffer);
        }
    }
    VAR_0->pix_fmt = ctx->pix_fmt;
    return VAR_4;
}
static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2, AVPacket *VAR_3)
{ VDADecoderContext *ctx = VAR_0->priv_data; AVFrame *pic = VAR_1; int VAR_4; VAR_4 = ff_h264_decoder.decode(VAR_0, VAR_1, VAR_2, VAR_3); if (*VAR_2) { AVBufferRef *buffer = pic->buf[0]; VDABufferContext *context = av_buffer_get_opaque(buffer); CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->VAR_1[3]; CVPixelBufferLockBaseAddress(cv_buffer, 0); context->cv_buffer = cv_buffer; pic->format = ctx->pix_fmt; if (CVPixelBufferIsPlanar(cv_buffer)) { int VAR_5, VAR_6 = CVPixelBufferGetPlaneCount(cv_buffer); av_assert0(VAR_6 < 4); for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) { pic->VAR_1[VAR_5] = CVPixelBufferGetBaseAddressOfPlane(cv_buffer, VAR_5); pic->linesize[VAR_5] = CVPixelBufferGetBytesPerRowOfPlane(cv_buffer, VAR_5); } } else { pic->VAR_1[0] = CVPixelBufferGetBaseAddress(cv_buffer); pic->linesize[0] = CVPixelBufferGetBytesPerRow(cv_buffer); } } VAR_0->pix_fmt = ctx->pix_fmt; return VAR_4; }