aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-15 14:57:57 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-15 14:57:57 +0100
commit353dbaa29714c9fb7d4b3ccc7e1b50569b0ea257 (patch)
treee0e67a898b5e6ce2ba9d641473960beb109995ff /libavcodec
parent8686b6c68bacfdd9ffa89736756192188973ad5d (diff)
parent3f111804eb5c603a344706b84b7164cbf7b4e0df (diff)
downloadffmpeg-353dbaa29714c9fb7d4b3ccc7e1b50569b0ea257.tar.gz
Merge commit '3f111804eb5c603a344706b84b7164cbf7b4e0df'
* commit '3f111804eb5c603a344706b84b7164cbf7b4e0df': libvpx: make vp8 and vp9 selectable libvpx: support vp9 nut: support vp9 tag mkv: support vp9 tag rtpdec: Make variables that should wrap unsigned Conflicts: configure libavcodec/Makefile libavcodec/allcodecs.c libavcodec/avcodec.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/Makefile6
-rw-r--r--libavcodec/allcodecs.c3
-rw-r--r--libavcodec/avcodec.h1
-rw-r--r--libavcodec/codec_desc.c7
-rw-r--r--libavcodec/libvpxdec.c32
-rw-r--r--libavcodec/libvpxenc.c58
6 files changed, 90 insertions, 17 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 06d426b680..daff3c124d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -702,8 +702,10 @@ OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
OBJS-$(CONFIG_LIBVORBIS_DECODER) += libvorbisdec.o
OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o audio_frame_queue.o \
vorbis_data.o vorbis_parser.o xiph.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 9d228b7a43..974a93732c 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -488,7 +488,8 @@ void avcodec_register_all(void)
REGISTER_ENCODER(LIBVO_AACENC, libvo_aacenc);
REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);
REGISTER_ENCDEC (LIBVORBIS, libvorbis);
- REGISTER_ENCDEC (LIBVPX, libvpx);
+ REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
+ REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
REGISTER_ENCODER(LIBX264, libx264);
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
REGISTER_ENCODER(LIBXAVS, libxavs);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 1522c95382..9367093265 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -267,6 +267,7 @@ enum AVCodecID {
AV_CODEC_ID_MTS2,
AV_CODEC_ID_CLLC,
AV_CODEC_ID_MSS2,
+ AV_CODEC_ID_VP9,
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
AV_CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 780209470b..0806b5b1c5 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1031,6 +1031,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSY,
},
{
+ .id = AV_CODEC_ID_VP9,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vp9",
+ .long_name = NULL_IF_CONFIG_SMALL("Google VP9"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
.id = AV_CODEC_ID_PICTOR,
.type = AVMEDIA_TYPE_VIDEO,
.name = "pictor",
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 809266a982..7e41e80646 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -35,10 +35,10 @@ typedef struct VP8DecoderContext {
struct vpx_codec_ctx decoder;
} VP8Context;
-static av_cold int vp8_init(AVCodecContext *avctx)
+static av_cold int vpx_init(AVCodecContext *avctx,
+ const struct vpx_codec_iface *iface)
{
VP8Context *ctx = avctx->priv_data;
- const struct vpx_codec_iface *iface = &vpx_codec_vp8_dx_algo;
struct vpx_codec_dec_cfg deccfg = {
/* token partitions+1 would be a decent choice */
.threads = FFMIN(avctx->thread_count, 16)
@@ -112,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,
@@ -123,3 +129,23 @@ 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);
+}
+
+AVCodec ff_libvpx_vp9_decoder = {
+ .name = "libvpx-vp9",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VP9,
+ .priv_data_size = sizeof(VP8Context),
+ .init = vp9_init,
+ .close = vp8_free,
+ .decode = vp8_decode,
+ .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 0de11b5448..a749e073a6 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -227,10 +227,10 @@ static av_cold int vp8_free(AVCodecContext *avctx)
return 0;
}
-static av_cold int vp8_init(AVCodecContext *avctx)
+static av_cold int vpx_init(AVCodecContext *avctx,
+ const struct vpx_codec_iface *iface)
{
VP8Context *ctx = avctx->priv_data;
- const struct vpx_codec_iface *iface = &vpx_codec_vp8_cx_algo;
struct vpx_codec_enc_cfg enccfg;
int res;
@@ -608,13 +608,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" },
@@ -623,7 +616,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,
@@ -634,6 +640,36 @@ 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);
+}
+
+static const AVClass class_vp9 = {
+ .class_name = "libvpx encoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_libvpx_vp9_encoder = {
+ .name = "libvpx-vp9",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VP9,
+ .priv_data_size = sizeof(VP8Context),
+ .init = vp9_init,
+ .encode2 = vp8_encode,
+ .close = vp8_free,
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS | CODEC_CAP_EXPERIMENTAL,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"),
+ .priv_class = &class_vp9,
.defaults = defaults,
};
+#endif /* CONFIG_LIBVPX_VP9_ENCODER */