On Fri, 27 Mar 2015 11:54:46 +0200 (EET)
Martin Storsjö <mar...@martin.st> wrote:

> On Thu, 26 Mar 2015, wm4 wrote:
> 
> > On Thu, 26 Mar 2015 10:18:14 +0200 (EET)
> > Martin Storsjö <mar...@martin.st> wrote:
> >
> >> On Tue, 24 Mar 2015, wm4 wrote:
> >> 
> >> > Based on a patch by Rodger Combs.
> >> > ---
> >> > Changed the way the configure test works. Now it will first run a test
> >> > without adding the insane RPI driver include and library paths (which
> >> > are usually missing from the compiler's standard paths).
> >> >
> >> > Added a call to bcm_host_init() on init.
> >> >
> >> > Fixed some minor things (mostly compiler warnings).
> >> > ---
> >> > configure              |  11 +
> >> > libavcodec/Makefile    |   1 +
> >> > libavcodec/allcodecs.c |   2 +
> >> > libavcodec/mmaldec.c   | 689 
> >> > +++++++++++++++++++++++++++++++++++++++++++++++++
> >> > libavutil/pixdesc.c    |   4 +
> >> > libavutil/pixfmt.h     |   5 +
> >> > 6 files changed, 712 insertions(+)
> >> > create mode 100644 libavcodec/mmaldec.c
> >> >
> >> > diff --git a/configure b/configure
> >> > index 3c38a8c..1cd3e50 100755
> >> > --- a/configure
> >> > +++ b/configure
> >> > @@ -217,6 +217,7 @@ External library support:
> >> >   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [auto]
> >> >   --enable-libxvid         enable Xvid encoding via xvidcore,
> >> >                            native MPEG-4/Xvid encoder exists [no]
> >> > +  --enable-mmal            enable decoding via MMAL [no]
> >> >   --enable-openssl         enable openssl [no]
> >> >   --enable-x11grab         enable X11 grabbing (legacy) [no]
> >> >   --enable-zlib            enable zlib [autodetect]
> >> > @@ -1182,6 +1183,7 @@ EXTERNAL_LIBRARY_LIST="
> >> >     libxcb_shm
> >> >     libxcb_xfixes
> >> >     libxvid
> >> > +    mmal
> >> >     openssl
> >> >     x11grab
> >> >     zlib
> >> > @@ -1964,6 +1966,10 @@ h263_vdpau_hwaccel_deps="vdpau"
> >> > h263_vdpau_hwaccel_select="h263_decoder"
> >> > h264_dxva2_hwaccel_deps="dxva2"
> >> > h264_dxva2_hwaccel_select="h264_decoder"
> >> > +h264_mmal_decoder_deps="mmal"
> >> > +h264_mmal_hwaccel_deps="mmal"
> >> > +h264_mmal_decoder_select="h264_decoder"
> >> > +h264_mmal_encoder_deps="mmal"
> >> > h264_qsv_hwaccel_deps="libmfx"
> >> > h264_vaapi_hwaccel_deps="vaapi"
> >> > h264_vaapi_hwaccel_select="h264_decoder"
> >> > @@ -4249,6 +4255,11 @@ enabled libx265           && require_pkg_config 
> >> > x265 x265.h x265_encoder_encode
> >> >                                die "ERROR: libx265 version must be >= 
> >> > 17."; }
> >> > enabled libxavs           && require libxavs xavs.h xavs_encoder_encode 
> >> > -lxavs
> >> > enabled libxvid           && require libxvid xvid.h xvid_global 
> >> > -lxvidcore
> >> > +enabled mmal              && { check_lib interface/mmal/mmal.h 
> >> > mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
> >> > +                               { add_cflags -isystem/opt/vc/include/ 
> >> > -isystem/opt/vc/include/interface/vmcs_host/linux 
> >> > -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ;
> >> > +                                 add_extralibs -L/opt/vc/lib/ 
> >> > -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ;
> >> > +                                 check_lib interface/mmal/mmal.h 
> >> > mmal_port_connect ; } ||
> >> > +                               die "ERROR: mmal not found"; }
> >> 
> >> This looks sensible to me. I'm still thinking if the hardcoded /opt/vc 
> >> paths only would be added if cross compiling is disabled - for a cross 
> >> compile it really makes no sense to try to guess using hardcoded paths 
> >> from the host system. But I'm not sure how much that would complicate this 
> >> line further, if it is worth it at all. (So I don't object to this going 
> >> in as such.)
> >
> > Any suggestions how to do this?
> 
> Something along these lines might work:
> 
> enabled mmal              && { check_lib interface/mmal/mmal.h 
> mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
>                                 { ! enabled cross_compile && {
>                                       add_cflags -isystem/opt/vc/include/ 
> -isystem/opt/vc/include/interface/vmcs_host/linux 
> -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ;
>                                       add_extralibs -L/opt/vc/lib/ 
> -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ; };
>                                   check_lib interface/mmal/mmal.h 
> mmal_port_connect ; } ||
>                                 die "ERROR: mmal not found"; }
> 
> If cross_compile is enabled, it does some redundant testing (testing 
> whether the lib works even if we didn't add any extra cflags/libs), but is 
> one of the less intrusive ways of doing it.
> 
> (Also note that ! enabled cross_compile isn't equivalent to disabled 
> cross_compile, these work like three-state booleans with undefined as 
> default value.)

I added this literally to the new patch I just sent. I haven't tested
the cross-compile case, though.
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to