aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mediacodec_wrapper.c
diff options
context:
space:
mode:
authorSamuel Raposo Vieira Mira <samuel.mira@qt.io>2023-03-27 15:21:27 +0000
committerZhao Zhili <zhilizhao@tencent.com>2023-04-02 15:10:15 +0800
commitb4eca5cce2a1a2872f6525ba50082536ee080445 (patch)
tree842bac05753ac2b9f694d85b882fb41162a9cd6f /libavcodec/mediacodec_wrapper.c
parent139f3352ed4bbe762c6f87b2443c9378c2beaae3 (diff)
downloadffmpeg-b4eca5cce2a1a2872f6525ba50082536ee080445.tar.gz
avcodec/mediacodec: add mpeg4 encoder
This patch will add MPEG4 encoder using Android Mediacodec Signed-off-by: Samuel Mira <samuel.mira@qt.io<mailto:samuel.mira@qt.io>> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavcodec/mediacodec_wrapper.c')
-rw-r--r--libavcodec/mediacodec_wrapper.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index b13211d435..1c29bb7406 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -328,6 +328,23 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
static const int VP9Profile2HDR10Plus = 0x4000;
static const int VP9Profile3HDR10Plus = 0x8000;
+ static const int MPEG4ProfileSimple = 0x01;
+ static const int MPEG4ProfileSimpleScalable = 0x02;
+ static const int MPEG4ProfileCore = 0x04;
+ static const int MPEG4ProfileMain = 0x08;
+ static const int MPEG4ProfileNbit = 0x10;
+ static const int MPEG4ProfileScalableTexture = 0x20;
+ static const int MPEG4ProfileSimpleFBA = 0x80;
+ static const int MPEG4ProfileSimpleFace = 0x40;
+ static const int MPEG4ProfileBasicAnimated = 0x100;
+ static const int MPEG4ProfileHybrid = 0x200;
+ static const int MPEG4ProfileAdvancedRealTime = 0x400;
+ static const int MPEG4ProfileCoreScalable = 0x800;
+ static const int MPEG4ProfileAdvancedCoding = 0x1000;
+ static const int MPEG4ProfileAdvancedCore = 0x2000;
+ static const int MPEG4ProfileAdvancedScalable = 0x4000;
+ static const int MPEG4ProfileAdvancedSimple = 0x8000;
+
// Unused yet.
(void)AVCProfileConstrainedHigh;
(void)HEVCProfileMain10HDR10;
@@ -381,6 +398,44 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
case FF_PROFILE_VP9_3:
return VP9Profile3;
}
+ } else if(avctx->codec_id == AV_CODEC_ID_MPEG4) {
+ switch (avctx->profile)
+ {
+ case FF_PROFILE_MPEG4_SIMPLE:
+ return MPEG4ProfileSimple;
+ case FF_PROFILE_MPEG4_SIMPLE_SCALABLE:
+ return MPEG4ProfileSimpleScalable;
+ case FF_PROFILE_MPEG4_CORE:
+ return MPEG4ProfileCore;
+ case FF_PROFILE_MPEG4_MAIN:
+ return MPEG4ProfileMain;
+ case FF_PROFILE_MPEG4_N_BIT:
+ return MPEG4ProfileNbit;
+ case FF_PROFILE_MPEG4_SCALABLE_TEXTURE:
+ return MPEG4ProfileScalableTexture;
+ case FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION:
+ return MPEG4ProfileSimpleFBA;
+ case FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE:
+ return MPEG4ProfileBasicAnimated;
+ case FF_PROFILE_MPEG4_HYBRID:
+ return MPEG4ProfileHybrid;
+ case FF_PROFILE_MPEG4_ADVANCED_REAL_TIME:
+ return MPEG4ProfileAdvancedRealTime;
+ case FF_PROFILE_MPEG4_CORE_SCALABLE:
+ return MPEG4ProfileCoreScalable;
+ case FF_PROFILE_MPEG4_ADVANCED_CODING:
+ return MPEG4ProfileAdvancedCoding;
+ case FF_PROFILE_MPEG4_ADVANCED_CORE:
+ return MPEG4ProfileAdvancedCore;
+ case FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE:
+ return MPEG4ProfileAdvancedScalable;
+ case FF_PROFILE_MPEG4_ADVANCED_SIMPLE:
+ return MPEG4ProfileAdvancedSimple;
+ case FF_PROFILE_MPEG4_SIMPLE_STUDIO:
+ // Studio profiles are not supported by mediacodec.
+ default:
+ break;
+ }
}
return -1;