diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2012-12-30 19:40:20 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-01-14 19:20:47 +0100 |
commit | 3f111804eb5c603a344706b84b7164cbf7b4e0df (patch) | |
tree | 512f926d6ae83bd6d3331146af5d7286812112f2 /libavcodec | |
parent | dab1f543fcac7ad3dcdd427fc1b859667c82aaa2 (diff) | |
download | ffmpeg-3f111804eb5c603a344706b84b7164cbf7b4e0df.tar.gz |
libvpx: make vp8 and vp9 selectable
Support older libvpx versions.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/Makefile | 6 | ||||
-rw-r--r-- | libavcodec/allcodecs.c | 4 | ||||
-rw-r--r-- | libavcodec/libvpxdec.c | 16 | ||||
-rw-r--r-- | libavcodec/libvpxenc.c | 34 |
4 files changed, 34 insertions, 26 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 2330f85fbb..f1a07d0a98 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -594,8 +594,10 @@ OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o audio_frame_queue.o \ vorbis_data.o vorbis_parser.o -OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o -OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o +OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o +OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o +OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o +OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 1aed693fa5..8bfa60329a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -426,8 +426,8 @@ void avcodec_register_all(void) REGISTER_ENCODER(LIBVO_AACENC, libvo_aacenc); REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc); REGISTER_ENCODER(LIBVORBIS, libvorbis); - REGISTER_ENCDEC (LIBVPX, libvpx); - REGISTER_ENCDEC (LIBVPX, libvpx_vp9); + REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8); + REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9); REGISTER_ENCODER(LIBX264, libx264); REGISTER_ENCODER(LIBXAVS, libxavs); REGISTER_ENCODER(LIBXVID, libxvid); diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 06ca69dc61..54eee31dcf 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -58,11 +58,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_dx_algo); -} - static int vp8_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { @@ -117,7 +112,13 @@ static av_cold int vp8_free(AVCodecContext *avctx) return 0; } -AVCodec ff_libvpx_decoder = { +#if CONFIG_LIBVPX_VP8_DECODER +static av_cold int vp8_init(AVCodecContext *avctx) +{ + return vpx_init(avctx, &vpx_codec_vp8_dx_algo); +} + +AVCodec ff_libvpx_vp8_decoder = { .name = "libvpx", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_VP8, @@ -128,7 +129,9 @@ AVCodec ff_libvpx_decoder = { .capabilities = CODEC_CAP_AUTO_THREADS, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"), }; +#endif /* CONFIG_LIBVPX_VP8_DECODER */ +#if CONFIG_LIBVPX_VP9_DECODER static av_cold int vp9_init(AVCodecContext *avctx) { return vpx_init(avctx, &vpx_codec_vp9_dx_algo); @@ -145,3 +148,4 @@ AVCodec ff_libvpx_vp9_decoder = { .capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_EXPERIMENTAL, .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"), }; +#endif /* CONFIG_LIBVPX_VP9_DECODER */ 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 */ |