static int svc_decode_frame(AVCodecContext *avctx, void *data,

                            int *got_frame, AVPacket *avpkt)

{

    SVCContext *s = avctx->priv_data;

    SBufferInfo info = { 0 };

    uint8_t* ptrs[3];

    int linesize[3];

    AVFrame *avframe = data;

    DECODING_STATE state;



    state = (*s->decoder)->DecodeFrame2(s->decoder, avpkt->data, avpkt->size, ptrs, &info);

    if (state != dsErrorFree) {

        av_log(avctx, AV_LOG_ERROR, "DecodeFrame2 failed\n");

        return AVERROR_UNKNOWN;

    }

    if (info.iBufferStatus != 1) {

        av_log(avctx, AV_LOG_DEBUG, "No frame produced\n");

        return avpkt->size;

    }



    ff_set_dimensions(avctx, info.UsrData.sSystemBuffer.iWidth, info.UsrData.sSystemBuffer.iHeight);

    // The decoder doesn't (currently) support decoding into a user

    // provided buffer, so do a copy instead.

    if (ff_get_buffer(avctx, avframe, 0) < 0) {

        av_log(avctx, AV_LOG_ERROR, "Unable to allocate buffer\n");

        return AVERROR(ENOMEM);

    }



    linesize[0] = info.UsrData.sSystemBuffer.iStride[0];

    linesize[1] = linesize[2] = info.UsrData.sSystemBuffer.iStride[1];

    av_image_copy(avframe->data, avframe->linesize, (const uint8_t **) ptrs, linesize, avctx->pix_fmt, avctx->width, avctx->height);



    avframe->pts     = avpkt->pts;

    avframe->pkt_dts = avpkt->dts;

#if FF_API_PKT_PTS

FF_DISABLE_DEPRECATION_WARNINGS

    avframe->pkt_pts = avpkt->pts;

FF_ENABLE_DEPRECATION_WARNINGS

#endif



    *got_frame = 1;

    return avpkt->size;

}

static int svc_decode_frame(AVCodecContext *avctx, void *data,

                            int *got_frame, AVPacket *avpkt)

{

    SVCContext *s = avctx->priv_data;

    SBufferInfo info = { 0 };

    uint8_t* ptrs[3];

    int linesize[3];

    AVFrame *avframe = data;

    DECODING_STATE state;



    state = (*s->decoder)->DecodeFrame2(s->decoder, avpkt->data, avpkt->size, ptrs, &info);

    if (state != dsErrorFree) {

        av_log(avctx, AV_LOG_ERROR, "DecodeFrame2 failed\n");

        return AVERROR_UNKNOWN;

    }

    if (info.iBufferStatus != 1) {

        av_log(avctx, AV_LOG_DEBUG, "No frame produced\n");

        return avpkt->size;

    }



    ff_set_dimensions(avctx, info.UsrData.sSystemBuffer.iWidth, info.UsrData.sSystemBuffer.iHeight);

    

    

    if (ff_get_buffer(avctx, avframe, 0) < 0) {

        av_log(avctx, AV_LOG_ERROR, "Unable to allocate buffer\n");

        return AVERROR(ENOMEM);

    }



    linesize[0] = info.UsrData.sSystemBuffer.iStride[0];

    linesize[1] = linesize[2] = info.UsrData.sSystemBuffer.iStride[1];

    av_image_copy(avframe->data, avframe->linesize, (const uint8_t **) ptrs, linesize, avctx->pix_fmt, avctx->width, avctx->height);



    avframe->pts     = avpkt->pts;

    avframe->pkt_dts = avpkt->dts;

#if FF_API_PKT_PTS

FF_DISABLE_DEPRECATION_WARNINGS

    avframe->pkt_pts = avpkt->pts;

FF_ENABLE_DEPRECATION_WARNINGS

#endif



    *got_frame = 1;

    return avpkt->size;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,

                            int *VAR_2, AVPacket *VAR_3)

{

    SVCContext *s = VAR_0->priv_data;

    SBufferInfo info = { 0 };

    uint8_t* ptrs[3];

    int VAR_4[3];

    AVFrame *avframe = VAR_1;

    DECODING_STATE state;



    state = (*s->decoder)->DecodeFrame2(s->decoder, VAR_3->VAR_1, VAR_3->size, ptrs, &info);

    if (state != dsErrorFree) {

        av_log(VAR_0, AV_LOG_ERROR, "DecodeFrame2 failed\n");

        return AVERROR_UNKNOWN;

    }

    if (info.iBufferStatus != 1) {

        av_log(VAR_0, AV_LOG_DEBUG, "No frame produced\n");

        return VAR_3->size;

    }



    ff_set_dimensions(VAR_0, info.UsrData.sSystemBuffer.iWidth, info.UsrData.sSystemBuffer.iHeight);

    

    

    if (ff_get_buffer(VAR_0, avframe, 0) < 0) {

        av_log(VAR_0, AV_LOG_ERROR, "Unable to allocate buffer\n");

        return AVERROR(ENOMEM);

    }



    VAR_4[0] = info.UsrData.sSystemBuffer.iStride[0];

    VAR_4[1] = VAR_4[2] = info.UsrData.sSystemBuffer.iStride[1];

    av_image_copy(avframe->VAR_1, avframe->VAR_4, (const uint8_t **) ptrs, VAR_4, VAR_0->pix_fmt, VAR_0->width, VAR_0->height);



    avframe->pts     = VAR_3->pts;

    avframe->pkt_dts = VAR_3->dts;

#if FF_API_PKT_PTS

FF_DISABLE_DEPRECATION_WARNINGS

    avframe->pkt_pts = VAR_3->pts;

FF_ENABLE_DEPRECATION_WARNINGS

#endif



    *VAR_2 = 1;

    return VAR_3->size;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{ SVCContext *s = VAR_0->priv_data; SBufferInfo info = { 0 }; uint8_t* ptrs[3]; int VAR_4[3]; AVFrame *avframe = VAR_1; DECODING_STATE state; state = (*s->decoder)->DecodeFrame2(s->decoder, VAR_3->VAR_1, VAR_3->size, ptrs, &info); if (state != dsErrorFree) { av_log(VAR_0, AV_LOG_ERROR, "DecodeFrame2 failed\n"); return AVERROR_UNKNOWN; } if (info.iBufferStatus != 1) { av_log(VAR_0, AV_LOG_DEBUG, "No frame produced\n"); return VAR_3->size; } ff_set_dimensions(VAR_0, info.UsrData.sSystemBuffer.iWidth, info.UsrData.sSystemBuffer.iHeight); if (ff_get_buffer(VAR_0, avframe, 0) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to allocate buffer\n"); return AVERROR(ENOMEM); } VAR_4[0] = info.UsrData.sSystemBuffer.iStride[0]; VAR_4[1] = VAR_4[2] = info.UsrData.sSystemBuffer.iStride[1]; av_image_copy(avframe->VAR_1, avframe->VAR_4, (const uint8_t **) ptrs, VAR_4, VAR_0->pix_fmt, VAR_0->width, VAR_0->height); avframe->pts     = VAR_3->pts; avframe->pkt_dts = VAR_3->dts; #if FF_API_PKT_PTS
FF_DISABLE_DEPRECATION_WARNINGS
avframe->pkt_pts = VAR_3->pts; FF_ENABLE_DEPRECATION_WARNINGS
#endif
*VAR_2 = 1; return VAR_3->size; }