Commit 8e5a2989 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/libvpx: set CODEC_CAP_EXPERIMENTAL correctly instead of testing at codec open time

Reviewed-by: 's avatarJames Zern <jzern@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 0e575c24
...@@ -22,14 +22,9 @@ ...@@ -22,14 +22,9 @@
#include "libvpx.h" #include "libvpx.h"
int ff_vp9_check_experimental(AVCodecContext *avctx) av_cold void ff_vp9_init_static(AVCodec *codec)
{ {
if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL && if ( vpx_codec_version_major() < 1
(vpx_codec_version_major() < 1 || || (vpx_codec_version_major() == 1 && vpx_codec_version_minor() < 3))
(vpx_codec_version_major() == 1 && vpx_codec_version_minor() < 3))) { codec->capabilities |= CODEC_CAP_EXPERIMENTAL;
av_log(avctx, AV_LOG_ERROR,
"Non-experimental support of VP9 requires libvpx >= 1.3.0\n");
return AVERROR_EXPERIMENTAL;
}
return 0;
} }
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
#include "avcodec.h" #include "avcodec.h"
int ff_vp9_check_experimental(AVCodecContext *avctx); void ff_vp9_init_static(AVCodec *codec);
#endif /* AVCODEC_LIBVPX_H */ #endif /* AVCODEC_LIBVPX_H */
...@@ -133,9 +133,6 @@ AVCodec ff_libvpx_vp8_decoder = { ...@@ -133,9 +133,6 @@ AVCodec ff_libvpx_vp8_decoder = {
#if CONFIG_LIBVPX_VP9_DECODER #if CONFIG_LIBVPX_VP9_DECODER
static av_cold int vp9_init(AVCodecContext *avctx) static av_cold int vp9_init(AVCodecContext *avctx)
{ {
int ret;
if ((ret = ff_vp9_check_experimental(avctx)))
return ret;
return vpx_init(avctx, &vpx_codec_vp9_dx_algo); return vpx_init(avctx, &vpx_codec_vp9_dx_algo);
} }
...@@ -149,5 +146,6 @@ AVCodec ff_libvpx_vp9_decoder = { ...@@ -149,5 +146,6 @@ AVCodec ff_libvpx_vp9_decoder = {
.close = vp8_free, .close = vp8_free,
.decode = vp8_decode, .decode = vp8_decode,
.capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_DR1, .capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_DR1,
.init_static_data = ff_vp9_init_static,
}; };
#endif /* CONFIG_LIBVPX_VP9_DECODER */ #endif /* CONFIG_LIBVPX_VP9_DECODER */
...@@ -852,9 +852,6 @@ AVCodec ff_libvpx_vp8_encoder = { ...@@ -852,9 +852,6 @@ AVCodec ff_libvpx_vp8_encoder = {
#if CONFIG_LIBVPX_VP9_ENCODER #if CONFIG_LIBVPX_VP9_ENCODER
static av_cold int vp9_init(AVCodecContext *avctx) static av_cold int vp9_init(AVCodecContext *avctx)
{ {
int ret;
if ((ret = ff_vp9_check_experimental(avctx)))
return ret;
return vpx_init(avctx, &vpx_codec_vp9_cx_algo); return vpx_init(avctx, &vpx_codec_vp9_cx_algo);
} }
...@@ -878,5 +875,6 @@ AVCodec ff_libvpx_vp9_encoder = { ...@@ -878,5 +875,6 @@ AVCodec ff_libvpx_vp9_encoder = {
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.priv_class = &class_vp9, .priv_class = &class_vp9,
.defaults = defaults, .defaults = defaults,
.init_static_data = ff_vp9_init_static,
}; };
#endif /* CONFIG_LIBVPX_VP9_ENCODER */ #endif /* CONFIG_LIBVPX_VP9_ENCODER */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment