• Zhao Zhili's avatar
    avutil/hwcontext_mediacodec: fix backward compatibility · 1263b0a6
    Zhao Zhili authored
    AVMediaCodecDeviceContext without surface or native_window is
    useless, it shouldn't be created at all. Such dummy AVHWDeviceContext
    is allowed before, and it's used by mpv player. Creating a ANativeWindow
    automatically breaks such usecases.
    
    So disable creating a ANativeWindow by default. It can be enabled
    via the create_window flag, or by set the AVDictionary of
    av_hwdevice_ctx_create(). The downside is that
    
    ffmpeg -hwaccel mediacodec -i input.mp4 \
    	-c:a copy -c:v hevc_mediacodec output.mp4
    
    use ByteBuffer mode which isn't as efficient as before. The upside
    is libavfilter works now, which should be less surprise.
    
    To enable create_window on ffmpeg command line, use
    ffmpeg -hwaccel mediacodec \
    	-init_hw_device mediacodec=mediacodec,create_window=1 \
    	-i input.mp4 -c:a copy -c:v hevc_mediacodec output.mp4
    
    Users should know what it is to enable create_window. It should
    be OK to take sometime to figure out the option. And there are comments
    inside hwcontext_mediacodec.h to help user figure it out.
    Signed-off-by: 's avatarZhao Zhili <zhilizhao@tencent.com>
    1263b0a6
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...