From 3f111804eb5c603a344706b84b7164cbf7b4e0df Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 30 Dec 2012 19:40:20 +0100 Subject: libvpx: make vp8 and vp9 selectable Support older libvpx versions. --- libavcodec/libvpxenc.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'libavcodec/libvpxenc.c') diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 7f7cad9e3a..0ecc2f913b 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -362,11 +362,6 @@ static av_cold int vpx_init(AVCodecContext *avctx, return 0; } -static av_cold int vp8_init(AVCodecContext *avctx) -{ - return vpx_init(avctx, &vpx_codec_vp8_cx_algo); -} - static inline void cx_pktcpy(struct FrameListData *dst, const struct vpx_codec_cx_pkt *src) { @@ -570,13 +565,6 @@ static const AVOption options[] = { { NULL } }; -static const AVClass class = { - .class_name = "libvpx encoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - static const AVCodecDefault defaults[] = { { "qmin", "-1" }, { "qmax", "-1" }, @@ -585,7 +573,20 @@ static const AVCodecDefault defaults[] = { { NULL }, }; -AVCodec ff_libvpx_encoder = { +#if CONFIG_LIBVPX_VP8_ENCODER +static av_cold int vp8_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp8_cx_algo); +} + +static const AVClass class_vp8 = { + .class_name = "libvpx encoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + +AVCodec ff_libvpx_vp8_encoder = { .name = "libvpx", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_VP8, @@ -596,11 +597,12 @@ AVCodec ff_libvpx_encoder = { .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), - .priv_class = &class, + .priv_class = &class_vp8, .defaults = defaults, }; +#endif /* CONFIG_LIBVPX_VP8_ENCODER */ - +#if CONFIG_LIBVPX_VP9_ENCODER static av_cold int vp9_init(AVCodecContext *avctx) { return vpx_init(avctx, &vpx_codec_vp9_cx_algo); @@ -613,7 +615,6 @@ static const AVClass class_vp9 = { .version = LIBAVUTIL_VERSION_INT, }; - AVCodec ff_libvpx_vp9_encoder = { .name = "libvpx-vp9", .type = AVMEDIA_TYPE_VIDEO, @@ -628,3 +629,4 @@ AVCodec ff_libvpx_vp9_encoder = { .priv_class = &class_vp9, .defaults = defaults, }; +#endif /* CONFIG_LIBVPX_VP9_ENCODER */ -- cgit v1.2.3