[FFmpeg-devel] [PATCH] VP8 de/encode via libvpx

Michael Niedermayer michaelni
Thu May 20 19:46:34 CEST 2010


On Thu, May 20, 2010 at 11:33:57AM -0400, James Zern wrote:
[..]

> +static int vp8_decode(AVCodecContext *avctx,
> +                      void *data, int *data_size, AVPacket *avpkt)
> +{
> +    VP8Context *ctx = avctx->priv_data;
> +    AVFrame *picture = data;
> +    vpx_codec_iter_t iter = NULL;
> +    vpx_image_t *img;
> +
> +    /* end of stream, vp8 does no buffering */
> +    if (!avpkt->size)
> +        return 0;
> +
> +    if (vpx_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL, 0) !=
> +        VPX_CODEC_OK) {
> +        const char *error  = vpx_codec_error(&ctx->decoder);
> +        const char *detail = vpx_codec_error_detail(&ctx->decoder);
> +
> +        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
> +        if (detail)
> +            av_log(avctx, AV_LOG_ERROR, "  Additional information: %s\n",
> +                   detail);
> +        return AVERROR_INVALIDDATA;
> +    }
> +
> +    if ((img = vpx_codec_get_frame(&ctx->decoder, &iter))) {
> +        if (img->fmt != IMG_FMT_I420) {

IMG_FMT_I420 probably should have a VPX_ prefix

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100520/a16b7fc1/attachment.pgp>



More information about the ffmpeg-devel mailing list