1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavc: add mpeg4 mediacodec decoder

This commit is contained in:
Matthieu Bouron 2016-10-04 17:47:44 +02:00
parent 0f7fce87ea
commit f62c54456d
7 changed files with 54 additions and 4 deletions

View File

@ -10,7 +10,7 @@ version <next>:
- curves filter doesn't automatically insert points at x=0 and x=1 anymore - curves filter doesn't automatically insert points at x=0 and x=1 anymore
- 16-bit support in curves filter and selectivecolor filter - 16-bit support in curves filter and selectivecolor filter
- OpenH264 decoder wrapper - OpenH264 decoder wrapper
- MediaCodec H.264/HEVC/VP8/VP9 hwaccel - MediaCodec H.264/HEVC/MPEG-4/VP8/VP9 hwaccel
- True Audio (TTA) muxer - True Audio (TTA) muxer
- crystalizer audio filter - crystalizer audio filter
- acrusher audio filter - acrusher audio filter
@ -28,7 +28,7 @@ version <next>:
- gblur filter - gblur filter
- avgblur filter - avgblur filter
- sobel and prewitt filter - sobel and prewitt filter
- MediaCodec HEVC/VP8/VP9 decoding - MediaCodec HEVC/MPEG-4/VP8/VP9 decoding
- Meridian Lossless Packing (MLP) / TrueHD encoder - Meridian Lossless Packing (MLP) / TrueHD encoder
- Non-Local Means (nlmeans) denoising filter - Non-Local Means (nlmeans) denoising filter
- sdl2 output device and ffplay support - sdl2 output device and ffplay support

2
configure vendored
View File

@ -2630,6 +2630,8 @@ mpeg2_xvmc_hwaccel_deps="xvmc"
mpeg2_xvmc_hwaccel_select="mpeg2video_decoder" mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_crystalhd_decoder_select="crystalhd"
mpeg4_cuvid_hwaccel_deps="cuda cuvid" mpeg4_cuvid_hwaccel_deps="cuda cuvid"
mpeg4_mediacodec_decoder_deps="mediacodec"
mpeg4_mediacodec_hwaccel_deps="mediacodec"
mpeg4_mmal_decoder_deps="mmal" mpeg4_mmal_decoder_deps="mmal"
mpeg4_mmal_decoder_select="mmal" mpeg4_mmal_decoder_select="mmal"
mpeg4_mmal_hwaccel_deps="mmal" mpeg4_mmal_hwaccel_deps="mmal"

View File

@ -413,6 +413,7 @@ OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o
OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o
OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o
OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec_h2645.o
OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o
OBJS-$(CONFIG_MPL2_DECODER) += mpl2dec.o ass.o OBJS-$(CONFIG_MPL2_DECODER) += mpl2dec.o ass.o
OBJS-$(CONFIG_MSA1_DECODER) += mss3.o OBJS-$(CONFIG_MSA1_DECODER) += mss3.o

View File

@ -103,6 +103,7 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau); REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox); REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid); REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_HWACCEL(MPEG4_MEDIACODEC, mpeg4_mediacodec);
REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal); REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);
REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi); REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau); REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);
@ -657,6 +658,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid); REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv); REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid); REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_DECODER(MPEG4_MEDIACODEC, mpeg4_mediacodec);
REGISTER_DECODER(VC1_CUVID, vc1_cuvid); REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
REGISTER_DECODER(VP8_CUVID, vp8_cuvid); REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
REGISTER_DECODER(VP8_MEDIACODEC, vp8_mediacodec); REGISTER_DECODER(VP8_MEDIACODEC, vp8_mediacodec);

View File

@ -767,6 +767,13 @@ AVHWAccel ff_hevc_mediacodec_hwaccel = {
.pix_fmt = AV_PIX_FMT_MEDIACODEC, .pix_fmt = AV_PIX_FMT_MEDIACODEC,
}; };
AVHWAccel ff_mpeg4_mediacodec_hwaccel = {
.name = "mediacodec",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPEG4,
.pix_fmt = AV_PIX_FMT_MEDIACODEC,
};
AVHWAccel ff_vp8_mediacodec_hwaccel = { AVHWAccel ff_vp8_mediacodec_hwaccel = {
.name = "mediacodec", .name = "mediacodec",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,

View File

@ -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> * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
* *
@ -266,6 +266,19 @@ done:
} }
#endif #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 #if CONFIG_VP8_MEDIACODEC_DECODER || CONFIG_VP9_MEDIACODEC_DECODER
static int vpx_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) static int vpx_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
{ {
@ -319,6 +332,15 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
goto done; goto done;
break; break;
#endif #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 #if CONFIG_VP8_MEDIACODEC_DECODER
case AV_CODEC_ID_VP8: case AV_CODEC_ID_VP8:
codec_mime = "video/x-vnd.on2.vp8"; codec_mime = "video/x-vnd.on2.vp8";
@ -552,6 +574,22 @@ AVCodec ff_hevc_mediacodec_decoder = {
}; };
#endif #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 #if CONFIG_VP8_MEDIACODEC_DECODER
AVCodec ff_vp8_mediacodec_decoder = { AVCodec ff_vp8_mediacodec_decoder = {
.name = "vp8_mediacodec", .name = "vp8_mediacodec",

View File

@ -28,7 +28,7 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 62 #define LIBAVCODEC_VERSION_MINOR 63
#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_MICRO 103
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \