From 8fff12542279960ff6e0a14f186d5c4c4d2bdfe4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 29 Mar 2015 15:12:11 +0200 Subject: RPI support This requires FFmpeg git master for accelerated hardware decoding. Keep in mind that FFmpeg must be compiled with --enable-mmal. Libav will also work. Most things work. Screenshots don't work with accelerated/opaque decoding (except using full window screenshot mode). Subtitles are very slow - even simple but huge overlays can cause frame drops. This always uses fullscreen mode. It uses dispmanx and mmal directly, and there are no window managers or anything on this level. vo_opengl also kind of works, but is pretty useless and slow. It can't use opaque hardware decoding (copy back can be used by forcing the option --vd=lavc:h264_mmal). Keep in mind that the dispmanx backend is preferred over the X11 ones in case you're trying on X11; but X11 is even more useless on RPI. This doesn't correctly reject extended h264 profiles and thus doesn't fallback to software decoding. The hw supports only up to the high profile, and will e.g. return garbage for Hi10P video. This sets a precedent of enabling hw decoding by default, but only if RPI support is compiled (which most hopefully it will be disabled on desktop Linux platforms). While it's more or less required to use hw decoding on the weak RPI, it causes more problems than it solves on real platforms (Linux has the Intel GPU problem, OSX still has some cases with broken decoding.) So I can live with this compromise of having different defaults depending on the platform. Raspberry Pi 2 is required. This wasn't tested on the original RPI, though at least decoding itself seems to work (but full playback was not tested). --- wscript | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index df0c02a676..5d42446b93 100644 --- a/wscript +++ b/wscript @@ -420,6 +420,12 @@ FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_ 'func': check_statement('libavutil/frame.h', 'enum AVFrameSideDataType type = AV_FRAME_DATA_SKIP_SAMPLES', use='libav') + }, { + 'name': 'av-pix-fmt-mmal', + 'desc': 'libavutil AV_PIX_FMT_MMAL', + 'func': check_statement('libavutil/pixfmt.h', + 'int x = AV_PIX_FMT_MMAL', + use='libav'), } ] @@ -589,11 +595,6 @@ video_output_features = [ 'groups': [ 'gl' ], 'func': check_statement('windows.h', 'wglCreateContext(0)', lib='opengl32') - } , { - 'name': '--gl', - 'desc': 'OpenGL video outputs', - 'deps_any': [ 'gl-cocoa', 'gl-x11', 'gl-win32', 'gl-wayland' ], - 'func': check_true } , { 'name': '--vdpau', 'desc': 'VDPAU acceleration', @@ -634,6 +635,39 @@ video_output_features = [ 'desc': 'Direct3D support', 'deps': [ 'win32' ], 'func': check_cc(header_name='d3d9.h'), + }, { + # We need MMAL/bcm_host/dispmanx APIs. Also, most RPI distros require + # every project to hardcode the paths to the include directories. Also, + # these headers are so broken that they spam tons of warnings by merely + # including them (compensate with -isystem and -fgnu89-inline). + 'name': '--rpi', + 'desc': 'Raspberry Pi support', + 'func': + check_cc(cflags="-isystem/opt/vc/include/ "+ + "-isystem/opt/vc/include/interface/vcos/pthreads " + + "-isystem/opt/vc/include/interface/vmcs_host/linux " + + "-fgnu89-inline", + linkflags="-L/opt/vc/lib", + header_name="bcm_host.h", + lib=['mmal_core', 'mmal_util', 'mmal_vc_client', 'bcm_host']), + }, { + 'name': '--rpi-gles', + 'desc': 'GLES on Raspberry Pi', + 'groups': [ 'gl' ], + 'deps': ['rpi'], + # We still need all OpenGL symbols, because the vo_opengl code is + # generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core. + 'func': compose_checks( + check_cc(lib="EGL"), + check_cc(lib="GLESv2"), + check_statement('GL/gl.h', '(void)GL_RGB32F'), # arbitrary OpenGL 3.0 symbol + check_statement('GL/gl.h', '(void)GL_LUMINANCE16') # arbitrary OpenGL legacy-only symbol + ), + } , { + 'name': '--gl', + 'desc': 'OpenGL video outputs', + 'deps_any': [ 'gl-cocoa', 'gl-x11', 'gl-win32', 'gl-wayland', 'rpi-gles' ], + 'func': check_true } ] -- cgit v1.2.3