Skip to content

Commit

Permalink
avcodec: add new Videotoolbox hwaccel.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Zwickert authored and ubitux committed Aug 3, 2015
1 parent 127203b commit 11d923d
Show file tree
Hide file tree
Showing 21 changed files with 1,113 additions and 289 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ version <next>:
- acrossfade audio filter
- allyuv video source
- atadenoise video filter
- OS X VideoToolbox support


version 2.7:
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ Hardware acceleration:
vaapi* Gwenole Beauchesne
vda* Sebastien Zwickert
vdpau* Carl Eugen Hoyos
videotoolbox* Sebastien Zwickert


libavdevice
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_o
OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o
OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_vda.o
ifndef CONFIG_VIDEOTOOLBOX
OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o
endif
OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
OBJS-ffserver += ffserver_config.o

TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64
Expand Down
19 changes: 17 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Hardware accelerators:
--disable-vaapi disable VAAPI code [autodetect]
--disable-vda disable VDA code [autodetect]
--disable-vdpau disable VDPAU code [autodetect]
--enable-videotoolbox enable VideoToolbox code [autodetect]
Individual component options:
--disable-everything disable all components listed below
Expand Down Expand Up @@ -1470,6 +1471,7 @@ HWACCEL_LIST="
vaapi
vda
vdpau
videotoolbox
xvmc
"

Expand Down Expand Up @@ -2380,14 +2382,18 @@ d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
vaapi_deps="va_va_h"
vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore -framework CoreServices"
vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
videotoolbox_deps="VideoToolbox_VideoToolbox_h pthreads"
videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore -framework CoreServices"
xvmc_deps="X11_extensions_XvMClib_h"

h263_vaapi_hwaccel_deps="vaapi"
h263_vaapi_hwaccel_select="h263_decoder"
h263_vdpau_hwaccel_deps="vdpau"
h263_vdpau_hwaccel_select="h263_decoder"
h263_videotoolbox_hwaccel_deps="videotoolbox"
h263_videotoolbox_hwaccel_select="h263_decoder"
h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
h264_d3d11va_hwaccel_deps="d3d11va"
h264_d3d11va_hwaccel_select="h264_decoder"
Expand All @@ -2410,6 +2416,8 @@ h264_vdpau_decoder_deps="vdpau"
h264_vdpau_decoder_select="h264_decoder"
h264_vdpau_hwaccel_deps="vdpau"
h264_vdpau_hwaccel_select="h264_decoder"
h264_videotoolbox_hwaccel_deps="videotoolbox"
h264_videotoolbox_hwaccel_select="h264_decoder"
hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
hevc_d3d11va_hwaccel_select="hevc_decoder"
hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
Expand All @@ -2425,6 +2433,8 @@ mpeg1_vdpau_decoder_deps="vdpau"
mpeg1_vdpau_decoder_select="mpeg1video_decoder"
mpeg1_vdpau_hwaccel_deps="vdpau"
mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
mpeg1_xvmc_hwaccel_deps="xvmc"
mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
mpeg2_crystalhd_decoder_select="crystalhd"
Expand All @@ -2438,6 +2448,8 @@ mpeg2_vaapi_hwaccel_deps="vaapi"
mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
mpeg2_vdpau_hwaccel_deps="vdpau"
mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
mpeg2_xvmc_hwaccel_deps="xvmc"
mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
mpeg4_crystalhd_decoder_select="crystalhd"
Expand All @@ -2447,6 +2459,8 @@ mpeg4_vdpau_decoder_deps="vdpau"
mpeg4_vdpau_decoder_select="mpeg4_decoder"
mpeg4_vdpau_hwaccel_deps="vdpau"
mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
msmpeg4_crystalhd_decoder_select="crystalhd"
vc1_crystalhd_decoder_select="crystalhd"
vc1_d3d11va_hwaccel_deps="d3d11va"
Expand Down Expand Up @@ -2902,7 +2916,7 @@ sws_max_filter_size_default=256
set_default sws_max_filter_size

# Enable hwaccels by default.
enable d3d11va dxva2 vaapi vda vdpau xvmc
enable d3d11va dxva2 vaapi vda vdpau videotoolbox xvmc
enable xlib

# build settings
Expand Down Expand Up @@ -5108,6 +5122,7 @@ check_header valgrind/valgrind.h
check_header vdpau/vdpau.h
check_header vdpau/vdpau_x11.h
check_header VideoDecodeAcceleration/VDADecoder.h
check_header VideoToolbox/VideoToolbox.h
check_header windows.h
check_header X11/extensions/XvMClib.h
check_header asm/types.h
Expand Down
3 changes: 3 additions & 0 deletions ffmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ enum HWAccelID {
HWACCEL_VDPAU,
HWACCEL_DXVA2,
HWACCEL_VDA,
HWACCEL_VIDEOTOOLBOX,
};

typedef struct HWAccel {
Expand Down Expand Up @@ -520,6 +521,7 @@ extern int frame_bits_per_raw_sample;
extern AVIOContext *progress_avio;
extern float max_error_rate;
extern int vdpau_api_ver;
extern char *videotoolbox_pixfmt;

extern const AVIOInterruptCB int_cb;

Expand Down Expand Up @@ -554,5 +556,6 @@ int ffmpeg_parse_options(int argc, char **argv);
int vdpau_init(AVCodecContext *s);
int dxva2_init(AVCodecContext *s);
int vda_init(AVCodecContext *s);
int videotoolbox_init(AVCodecContext *s);

#endif /* FFMPEG_H */
8 changes: 7 additions & 1 deletion ffmpeg_opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ const HWAccel hwaccels[] = {
{ "dxva2", dxva2_init, HWACCEL_DXVA2, AV_PIX_FMT_DXVA2_VLD },
#endif
#if CONFIG_VDA
{ "vda", vda_init, HWACCEL_VDA, AV_PIX_FMT_VDA },
{ "vda", videotoolbox_init, HWACCEL_VDA, AV_PIX_FMT_VDA },
#endif
#if CONFIG_VIDEOTOOLBOX
{ "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, AV_PIX_FMT_VIDEOTOOLBOX },
#endif
{ 0 },
};
Expand Down Expand Up @@ -3232,6 +3235,9 @@ const OptionDef options[] = {
"select a device for HW acceleration" "devicename" },
#if HAVE_VDPAU_X11
{ "vdpau_api_ver", HAS_ARG | OPT_INT | OPT_EXPERT, { &vdpau_api_ver }, "" },
#endif
#if CONFIG_VDA || CONFIG_VIDEOTOOLBOX
{ "videotoolbox_pixfmt", HAS_ARG | OPT_STRING | OPT_EXPERT, { &videotoolbox_pixfmt}, "" },
#endif
{ "autorotate", HAS_ARG | OPT_BOOL | OPT_SPEC |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(autorotate) },
Expand Down
137 changes: 0 additions & 137 deletions ffmpeg_vda.c

This file was deleted.

Loading

0 comments on commit 11d923d

Please sign in to comment.