- 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;
+ side_data = av_packet_get_side_data(avpkt,
+ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
+ &side_data_size);
+ if (side_data_size > 1) {
+ const uint64_t additional_id = AV_RB64(side_data);
+ side_data += 8;
+ side_data_size -= 8;
+ if (additional_id == 1) { // 1 stands for alpha channel data.
+ if (!ctx->has_alpha_channel) {
+ ctx->has_alpha_channel = 1;
+ ret = vpx_init(avctx,
+#if CONFIG_LIBVPX_VP8_DECODER && CONFIG_LIBVPX_VP9_DECODER
+ (avctx->codec_id == AV_CODEC_ID_VP8) ?
+ &vpx_codec_vp8_dx_algo : &vpx_codec_vp9_dx_algo,
+#elif CONFIG_LIBVPX_VP8_DECODER
+ &vpx_codec_vp8_dx_algo,
+#else
+ &vpx_codec_vp9_dx_algo,
+#endif
+ 1);
+ if (ret)
+ return ret;
+ }
+ ret = decode_frame(avctx, &ctx->decoder_alpha, side_data,
+ side_data_size);
+ if (ret)
+ return ret;
+ }