Samuel Raposo Vieira Mira
b4eca5cce2
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 >
2023-04-02 15:10:15 +08:00
Samuel Raposo Vieira Mira
139f3352ed
avcodec/mediacodec: add vp9 encoder using mediacodec
...
The only encoders avaliable using mediacodec were h264 and hevc. This
patch adds the vp9 encoder.
Signed-off-by: Samuel Mira <samuel.mira@qt.io <mailto:samuel.mira@qt.io >>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2023-04-02 15:09:45 +08:00
Zhao Zhili
d0c6389e91
avcodec/mediacodecdec: refactor color space utils
...
So it can be shared with encoder.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2023-03-18 00:13:12 +08:00
Zhao Zhili
8586540ad1
avcodec/mediacodec_wrapper: get api level via NDK method
...
android_get_device_api_level() is a static inline before API level
29. It was implemented via __system_property_get(). We can do the
same thing, but I don't want to mess up with __system_property_get.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2023-01-11 18:58:14 +08:00
Zhao Zhili
48d5aecfc4
avcodec/mediacodec_wrapper: include stdbool.h
...
Since NDK failed to do that:
https://github.com/android/ndk/issues/1281
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2022-12-19 10:03:54 +08:00
Zhao Zhili
0da8802e95
avcodec/mediacodec_wrapper: use hardcoded value of profiles from MediaCodecInfo
...
Those are static const values and documented at
https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel
No runtime query is needed. Now the method can be used without JVM.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2022-12-08 23:55:06 +08:00
Zhao Zhili
a63834b236
avcodec/mediacodec: fix missing crop info when use NDK MediaCodec
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2022-12-08 23:52:39 +08:00
Zhao Zhili
0ff18a7d6d
avcodec: add MediaCodec encoder
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2022-11-21 23:56:16 +08:00
Zhao Zhili
3a59446967
avcodec/mediacodec: add ANativeWindow support
...
ANativeWindow can be used without JVM.
2022-11-21 23:55:57 +08:00
Zhao Zhili
4df9cb918e
avcodec/mediacodec: add NDK media codec wrapper
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2022-11-21 23:52:34 +08:00
Zhao Zhili
4f2ea862b3
avcodec/mediacodec_wrapper: separate implementation from interface
...
This is in preparation for NDK media codec wrapper.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com >
2022-11-21 23:52:25 +08:00
Martin Storsjö
17ab836a5f
libavcodec, libavdevice: Remove unnecessary includes of version.h
...
xvmc.h used FF_API_* macros before, but they were removed in
1c63aed232 , leaving the include
unused.
The ones in android_camera.c and mediacodec_wrapper.c have been
added due to a misunderstanding, fixed in
c0bce367e4 and
13b77af2f0 .
The one in mediacodec.c seems to never have been used at all.
Signed-off-by: Martin Storsjö <martin@martin.st >
2022-02-24 22:36:15 +02:00
sfan5
a7425f712a
avcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available
...
Added in Android 10 it provides a reliable way of filtering out
software decoders, unlike existing string-based checks.
2021-03-10 14:09:14 +01:00
sfan5
1a033008e8
avcodec/mediacodec_wrapper: check if codec is software earlier
2021-03-10 14:09:04 +01:00
Matthieu Bouron
5216edbc54
avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak
...
Fixes ticket #8607 .
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com >
2020-04-15 09:43:16 +02:00
Matthieu Bouron
817235b195
avcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecNameByType()
2019-07-22 08:57:33 +02:00
Matthieu Bouron
3f232d713d
avcodec/mediacodec_wrapper: fix a potential local reference leak in ff_AMediaCodec_getCodecNameByType()
2019-07-22 08:57:33 +02:00
Matthieu Bouron
9cb8875c16
avcodec/mediacodec_wrapper: fix a local reference leak in ff_AMediaCodec_getName()
2019-07-22 08:57:33 +02:00
Aman Gupta
f6d48b618a
avcodec/mediacodec: add av_mediacodec_render_buffer_at_time()
...
The existing av_mediacodec_release_buffer allows the user to render
or discard the Surface-backed frame. This new method allows the user
to control exactly when the frame will be rendered to its SurfaceView.
Available since Android API 21.
Signed-off-by: Aman Gupta <aman@tmm1.net >
2018-10-11 20:51:14 -07:00
Aman Gupta
fe0a6bcbda
avcodec/mediacodec_wrapper: add helper to fetch SDK_INT
...
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com >
Signed-off-by: Aman Gupta <aman@tmm1.net >
2018-05-04 11:51:45 -07:00
Michael Niedermayer
c0bce367e4
avcodec: Fix AVClass .version
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2018-04-19 23:44:13 +02:00
Stefan _
5ab0ecf283
avcodec/mediacodec_wrapper: fix false positives in swdec blacklist
...
'OMX.SEC.avc.dec' is a valid hardware decoder, while the decoders
we seek to blacklist all match 'OMX.SEC.*.sw.dec'.
2018-03-07 13:52:02 +01:00
Stefan _
313b6057fb
avcodec/mediacodec_wrapper: blacklist more software decoders
...
Additionally blacklist ffmpeg, Samsung and Qualcomm
software implementations offered through MediaCodec.
Signed-off-by: Aman Gupta <aman@tmm1.net >
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com >
2018-03-06 13:52:24 -08:00
Matthieu Bouron
c55ba52a6a
avcodec/mediacodec_wrapper: load and use MediaFormat.constainsKey()
...
Avoids triggering an exception in MediaFormat getter functions if the
key does not exist.
2018-03-03 21:18:35 +01:00
Matthieu Bouron
e30b46b1ae
lavc/mediacodec_wrapper: allocate MediaCodec.BufferInfo once
2018-01-06 22:12:51 +01:00
Matthieu Bouron
1f1207145a
lavc/mediacodec_wrapper: fix potential jni global reference leak
2017-12-16 00:52:28 +01:00
Matthieu Bouron
f3cffd121b
lavc/mediacodec_wrapper: factorize MediaCodec creation functions
2017-12-16 00:52:28 +01:00
Matthieu Bouron
dd8ffb191f
lavc/mediacodec_wrapper: fix jni vaargs types
...
Fixes decoding on 32-bit devices with Android NDK >= 15.
2017-09-15 14:19:16 +02:00
Matthieu Bouron
fb3228bee8
lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack
2017-05-23 15:25:07 +02:00
Matthieu Bouron
224bb46fb8
lavc/mediacodec_wrapper: fix local reference leaks
2017-05-23 15:25:03 +02:00
Matthieu Bouron
1795dccde0
lavc/mediacodec_wrapper: fix local reference leaks
...
Reviewed-by: Clément Bœsch <u@pkh.me >
2017-05-11 16:29:03 +02:00
Matthieu Bouron
b8c158a4ed
lavc/mediacodec_wrapper: do not discard codecs reporting they do not support any profile
...
Depending on the device, some (VP8/VP9/...) decoders report that they do
not support any profiles.
2016-10-19 09:52:15 +02:00
Matthieu Bouron
140da8e810
lavc: add hevc mediacodec decoder
2016-09-15 21:48:28 +02:00
Matthieu Bouron
376d8fb2c5
lavc/ffjni: replace ff_jni_{attach,detach} with ff_jni_get_env
...
If a JNI environment is not already attached to the thread where the
MediaCodec calls are made the current implementation will attach /
detach an environment for each MediaCodec call wasting some CPU time.
ff_jni_get_env replaces ff_jni_{attach,detach} by permanently attaching
an environment (if it is not already the case) to the current thread.
The environment will be automatically detached at the thread destruction
using a pthread_key callback.
Saves around 5% of CPU time (out of 20%) while decoding a stream with
MediaCodec.
2016-07-27 15:43:39 +02:00
Matthieu Bouron
0f2654c9a3
lavc: add mediacodec hwaccel support
2016-07-08 17:02:37 +02:00
Matthieu Bouron
346b3c5c41
lavc/mediacodec: re-indent after previous commit
2016-06-15 16:40:36 +02:00
Matthieu Bouron
e452abc5c2
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.
2016-06-15 16:36:13 +02:00
Matthieu Bouron
93f4d1646e
lavc/mediacodec: bypass width/height restrictions when looking for a decoder
...
Codec width/height restrictions seem hardcoded at the OMX level and
seem arbitrary. Bypassing those restrictions allows a device to decode
streams at higher resolutions.
For example it allows a Nexus 5 to decode h264 streams with a resolution
higher than 1920x1080.
2016-06-07 10:22:20 +02:00
Matthieu Bouron
cb89fd2334
lavc/mediacodec: rename MediaFormat field clazz to mediaformat_class for consistency
2016-06-07 10:20:44 +02:00
Matthieu Bouron
56ef387e21
lavc/mediacodec: move struct declarations at the begin
2016-06-07 10:20:44 +02:00
Matthieu Bouron
79efd3b8b8
lavc/mediacodec: rename jfields_mapping to jni_amediacodeclist_mapping
2016-06-07 10:20:36 +02:00
Matthieu Bouron
f2e7f9966e
lavc/mediacodec: do not delete a local reference twice in case of error
2016-06-07 10:18:11 +02:00
Matthieu Bouron
d14deeb6bc
lavc/mediacodec: add missing MediaCodec.Get{Input,Output}Buffer() checks
2016-05-25 16:46:47 +02:00
Matthieu Bouron
fbc9359d85
lavc/mediacodec: factorize static fields initialization
2016-05-25 16:46:47 +02:00
Matthieu Bouron
03a6ed83b0
lavc/mediacodec: remove stray empty lines
2016-03-15 10:33:16 +01:00
Matthieu Bouron
4737fe6907
lavc: add h264 mediacodec decoder
2016-03-07 11:28:29 +01:00