summaryrefslogtreecommitdiff
path: root/libavcodec/mediacodecdec.c
diff options
context:
space:
mode:
authorMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-06-02 10:42:25 +0200
committerMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-06-15 16:36:13 +0200
commite452abc5c2441356d1aa22ffcd8a9183aa1fac33 (patch)
tree4eebaa6aef1e27371430ba7985a262df0c9ed0b8 /libavcodec/mediacodecdec.c
parent5b95b4616aae7f37a57571aa48ea780a98a40137 (diff)
lavc/mediacodec: refactor ff_AMediaCodecList_getCodecByType
Allows to select a codec (encoder or decoder) only if it supports a specific profile. Adds ff_AMediaCodecProfile_getProfileFromAVCodecContext to convert an AVCodecContext profile to a MediaCodec profile. It only supports H264 for now. The codepath using MediaCodecList.findDecoderForFormat() (Android >= 5.0) has been dropped as this method does not allow to select a decoder compatible with a specific profile.
Diffstat (limited to 'libavcodec/mediacodecdec.c')
-rw-r--r--libavcodec/mediacodecdec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 676ade73a1..0b08f02089 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -308,10 +308,16 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s,
{
int ret = 0;
int status;
+ int profile;
s->first_buffer_at = av_gettime();
- s->codec_name = ff_AMediaCodecList_getCodecNameByType(mime, avctx);
+ profile = ff_AMediaCodecProfile_getProfileFromAVCodecContext(avctx);
+ if (profile < 0) {
+ av_log(avctx, AV_LOG_WARNING, "Unsupported or unknown profile");
+ }
+
+ s->codec_name = ff_AMediaCodecList_getCodecNameByType(mime, profile, 0, avctx);
if (!s->codec_name) {
ret = AVERROR_EXTERNAL;
goto fail;