26 #define VPX_CODEC_DISABLE_COMPAT 1
27 #include <vpx/vpx_decoder.h>
28 #include <vpx/vp8dx.h>
35 typedef struct VP8DecoderContext {
40 const struct vpx_codec_iface *iface)
43 struct vpx_codec_dec_cfg deccfg = {
51 if (vpx_codec_dec_init(&ctx->
decoder, iface, &deccfg, 0) != VPX_CODEC_OK) {
52 const char *error = vpx_codec_error(&ctx->
decoder);
67 const void *iter = NULL;
68 struct vpx_image *
img;
71 if (vpx_codec_decode(&ctx->
decoder, avpkt->
data, avpkt->
size, NULL, 0) !=
73 const char *error = vpx_codec_error(&ctx->
decoder);
74 const char *detail = vpx_codec_error_detail(&ctx->
decoder);
83 if ((img = vpx_codec_get_frame(&ctx->
decoder, &iter))) {
84 if (img->fmt != VPX_IMG_FMT_I420) {
90 if ((
int) img->d_w != avctx->
width || (
int) img->d_h != avctx->
height) {
100 img->stride, avctx->
pix_fmt, img->d_w, img->d_h);
109 vpx_codec_destroy(&ctx->
decoder);
113 #if CONFIG_LIBVPX_VP8_DECODER
116 return vpx_init(avctx, &vpx_codec_vp8_dx_algo);
119 AVCodec ff_libvpx_vp8_decoder = {
132 #if CONFIG_LIBVPX_VP9_DECODER
135 return vpx_init(avctx, &vpx_codec_vp9_dx_algo);
138 AVCodec ff_libvpx_vp9_decoder = {
139 .
name =
"libvpx-vp9",