aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mediacodecdec_h2645.c
diff options
context:
space:
mode:
authorMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-10-04 17:47:44 +0200
committerMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-10-19 10:50:52 +0200
commitf62c54456db0fdd3ff82397f9142715d5c479354 (patch)
tree8820fc4b7f9c23ff2d917fd11f866e9f8e040ae7 /libavcodec/mediacodecdec_h2645.c
parent0f7fce87ea9842261076f93bd0f28557fcd065bb (diff)
downloadffmpeg-f62c54456db0fdd3ff82397f9142715d5c479354.tar.gz
lavc: add mpeg4 mediacodec decoder
Diffstat (limited to 'libavcodec/mediacodecdec_h2645.c')
-rw-r--r--libavcodec/mediacodecdec_h2645.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/libavcodec/mediacodecdec_h2645.c b/libavcodec/mediacodecdec_h2645.c
index c5f5af2334..578b10d365 100644
--- a/libavcodec/mediacodecdec_h2645.c
+++ b/libavcodec/mediacodecdec_h2645.c
@@ -1,5 +1,5 @@
/*
- * Android MediaCodec H.264 / H.265 / VP8 / VP9 decoders
+ * Android MediaCodec H.264 / H.265 / MPEG-4 / VP8 / VP9 decoders
*
* Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
*
@@ -266,6 +266,19 @@ done:
}
#endif
+#if CONFIG_MPEG4_MEDIACODEC_DECODER
+static int mpeg4_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
+{
+ int ret = 0;
+
+ if (avctx->extradata) {
+ ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, avctx->extradata_size);
+ }
+
+ return ret;
+}
+#endif
+
#if CONFIG_VP8_MEDIACODEC_DECODER || CONFIG_VP9_MEDIACODEC_DECODER
static int vpx_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
{
@@ -319,6 +332,15 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
goto done;
break;
#endif
+#if CONFIG_MPEG4_MEDIACODEC_DECODER
+ case AV_CODEC_ID_MPEG4:
+ codec_mime = "video/mp4v-es",
+
+ ret = mpeg4_set_extradata(avctx, format);
+ if (ret < 0)
+ goto done;
+ break;
+#endif
#if CONFIG_VP8_MEDIACODEC_DECODER
case AV_CODEC_ID_VP8:
codec_mime = "video/x-vnd.on2.vp8";
@@ -552,6 +574,22 @@ AVCodec ff_hevc_mediacodec_decoder = {
};
#endif
+#if CONFIG_MPEG4_MEDIACODEC_DECODER
+AVCodec ff_mpeg4_mediacodec_decoder = {
+ .name = "mpeg4_mediacodec",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Android MediaCodec decoder"),
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MPEG4,
+ .priv_data_size = sizeof(MediaCodecH264DecContext),
+ .init = mediacodec_decode_init,
+ .decode = mediacodec_decode_frame,
+ .flush = mediacodec_decode_flush,
+ .close = mediacodec_decode_close,
+ .capabilities = CODEC_CAP_DELAY,
+ .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS,
+};
+#endif
+
#if CONFIG_VP8_MEDIACODEC_DECODER
AVCodec ff_vp8_mediacodec_decoder = {
.name = "vp8_mediacodec",