[FFmpeg-devel] [PATCH] hwaccel: add VideoToolbox support.

Michael Niedermayer michaelni at gmx.at
Sat Sep 15 05:02:03 CEST 2012


On Thu, Sep 13, 2012 at 03:42:58PM +0200, Sebastien Zwickert wrote:
> ---
>  Changelog                |    1 +
>  MAINTAINERS              |    1 +
>  configure                |   12 ++
>  libavcodec/Makefile      |    7 +
>  libavcodec/allcodecs.c   |    4 +
>  libavcodec/h264.c        |    1 +
>  libavcodec/mpeg12.c      |    3 +
>  libavcodec/mpegvideo.c   |    1 +
>  libavcodec/version.h     |    2 +-
>  libavcodec/vt.c          |  409 ++++++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/vt.h          |  186 +++++++++++++++++++++
>  libavcodec/vt_h264.c     |   79 +++++++++
>  libavcodec/vt_internal.h |   42 +++++
>  libavcodec/vt_mpeg2.c    |   62 +++++++
>  libavcodec/vt_mpeg4.c    |   77 +++++++++
>  libavformat/movenc.c     |    7 +-
>  libavformat/movenc.h     |    1 +
>  libavutil/pixdesc.c      |    6 +
>  libavutil/pixfmt.h       |    1 +
>  19 files changed, 900 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/vt.c
>  create mode 100644 libavcodec/vt.h
>  create mode 100644 libavcodec/vt_h264.c
>  create mode 100644 libavcodec/vt_internal.h
>  create mode 100644 libavcodec/vt_mpeg2.c
>  create mode 100644 libavcodec/vt_mpeg4.c
> 
> diff --git a/Changelog b/Changelog
> index a9ca4f0..200e074 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -60,6 +60,7 @@ version next:
>  - CPiA decoder
>  - decimate filter ported from MPlayer
>  - RTP depacketization of JPEG
> +- OS X VideoToolbox (VT) support
>  
>  
>  version 0.11:
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1860b6e..6233b1c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -257,6 +257,7 @@ Hardware acceleration:
>    libstagefright.cpp                    Mohamed Naufal
>    vaapi*                                Gwenole Beauchesne
>    vda*                                  Sebastien Zwickert
> +  vt*                                   Sebastien Zwickert
>    vdpau*                                Carl Eugen Hoyos
>  
>  
> diff --git a/configure b/configure
> index 3d1fae7..1ba6de3 100755
> --- a/configure
> +++ b/configure
> @@ -133,6 +133,7 @@ Component options:
>    --enable-dxva2           enable DXVA2 code
>    --enable-vaapi           enable VAAPI code [autodetect]
>    --enable-vda             enable VDA code   [autodetect]
> +  --enable-videotoolbox    enable VideoToolbox code [autodetect]
>    --enable-vdpau           enable VDPAU code [autodetect]
>  
>  Individual component options:
> @@ -1174,6 +1175,7 @@ CONFIG_LIST="
>      vda
>      vdpau
>      version3
> +    videotoolbox
>      xmm_clobber_test
>      x11grab
>      zlib
> @@ -1605,6 +1607,7 @@ h261_encoder_select="aandcttables mpegvideoenc"
>  h263_decoder_select="error_resilience h263_parser mpegvideo"
>  h263_encoder_select="aandcttables error_resilience mpegvideoenc"
>  h263_vaapi_hwaccel_select="vaapi h263_decoder"
> +h263_videotoolbox_hwaccel_select="videotoolbox h263_decoder"
>  h263i_decoder_select="h263_decoder"
>  h263p_encoder_select="h263_encoder"
>  h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
> @@ -1615,6 +1618,7 @@ h264_vaapi_hwaccel_select="vaapi h264_decoder"
>  h264_vda_decoder_select="vda h264_parser h264_decoder"
>  h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
>  h264_vda_hwaccel_select="vda h264_decoder"
> +h264_videotoolbox_hwaccel_select="videotoolbox h264_decoder"
>  h264_vdpau_decoder_select="vdpau h264_decoder"
>  huffyuv_encoder_select="huffman"
>  iac_decoder_select="fft mdct sinewin"
> @@ -1650,12 +1654,14 @@ mpeg2_dxva2_hwaccel_deps="dxva2api_h"
>  mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
>  mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
>  mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
> +mpeg2_videotoolbox_hwaccel_select="videotoolbox mpeg2video_decoder"
>  mpeg2video_decoder_select="error_resilience mpegvideo"
>  mpeg2video_encoder_select="aandcttables error_resilience mpegvideoenc"
>  mpeg4_crystalhd_decoder_select="crystalhd"
>  mpeg4_decoder_select="h263_decoder mpeg4video_parser"
>  mpeg4_encoder_select="h263_encoder"
>  mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
> +mpeg4_videotoolbox_hwaccel_select="videotoolbox mpeg4_decoder"
>  mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
>  msmpeg4_crystalhd_decoder_select="crystalhd"
>  msmpeg4v1_decoder_select="h263_decoder"
> @@ -1738,6 +1744,7 @@ crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
>  vaapi_deps="va_va_h"
>  vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
>  vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
> +videotoolbox_deps="VideoToolbox_VideoToolbox_h avformat"
>  
>  # parsers
>  h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo"
> @@ -3535,6 +3542,11 @@ if ! disabled vda; then
>      fi
>  fi
>  
> +# check for VideoToolbox header
> +if ! disabled videotoolbox && check_header VideoToolbox/VideoToolbox.h; then
> +    enable videotoolbox && add_extralibs -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore
> +fi
> +
>  if ! disabled w32threads && ! enabled pthreads; then
>      check_func _beginthreadex && enable w32threads
>  fi

this doesnt work.

if i just ./configure && make i get
In file included from libavcodec/vt_internal.h:26:0,
                 from libavcodec/vt_mpeg2.c:23:
libavcodec/vt.h:35:39: fatal error: VideoToolbox/VideoToolbox.h: No such file or directory
compilation terminated.
make: *** [libavcodec/vt_mpeg2.o] Error 1

think the cause is that you mix VT and VIDEOTOOLBOX between the
used CONFIG_* and what is in configure


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120915/aff9ce10/attachment.asc>


More information about the ffmpeg-devel mailing list