@@ -236,6 +236,23 @@ fn build() -> io::Result<()> {
236236 configure. arg ( format ! ( "--target_os={}" , get_ffmpet_target_os( ) ) ) ;
237237 }
238238
239+ // for ios specific hardware acceleration ffmpeg needs to find the frameworks
240+ // and link against them using -framework
241+ if env:: var ( "CARGO_CFG_TARGET_OS" ) . as_deref ( ) == Ok ( "ios" ) {
242+ let output = Command :: new ( "xcrun" )
243+ . args ( [ "--sdk" , "iphoneos" , "--show-sdk-path" ] )
244+ . output ( )
245+ . expect ( "failed to run xcrun" )
246+ . stdout ;
247+
248+ configure. arg ( format ! (
249+ "--sysroot={}" ,
250+ str :: from_utf8( & output)
251+ . expect( "Failed to parse xcrun output" )
252+ . trim( )
253+ ) ) ;
254+ }
255+
239256 // control debug build
240257 if env:: var ( "DEBUG" ) . is_ok ( ) {
241258 configure. arg ( "--enable-debug" ) ;
@@ -348,6 +365,36 @@ fn build() -> io::Result<()> {
348365 enable ! ( configure, "BUILD_LIB_AVS" , "libavs" ) ;
349366 enable ! ( configure, "BUILD_LIB_XVID" , "libxvid" ) ;
350367
368+ // hardware accelleration
369+ enable ! ( configure, "BUILD_VAAPI" , "vaapi" ) ;
370+ enable ! ( configure, "BUILD_VULKAN" , "vdpau" ) ;
371+ enable ! ( configure, "BUILD_OPENCL" , "vaapi" ) ;
372+
373+ if env:: var ( "CARGO_FEATURE_BUILD_VIDEOTOOLBOX" ) . is_ok ( ) {
374+ configure. arg ( "--enable-videotoolbox" ) ;
375+
376+ if target != host && env:: var ( "CARGO_CFG_TARGET_OS" ) . as_deref ( ) == Ok ( "ios" ) {
377+ configure. arg ( "--extra-cflags=-mios-version-min=11.0" ) ;
378+ }
379+
380+ if target != host && env:: var ( "CARGO_CFG_TARGET_OS" ) . as_deref ( ) == Ok ( "macos" ) {
381+ configure. arg ( "--extra-cflags=-mmacosx-version-min=10.11" ) ;
382+ }
383+ }
384+
385+ if env:: var ( "CARGO_FEATURE_BUILD_AUDIOTOOLBOX" ) . is_ok ( ) {
386+ configure. arg ( "--enable-audiotoolbox" ) ;
387+ configure. arg ( "--extra-cflags=-mios-version-min=11.0" ) ;
388+ }
389+
390+ if env:: var ( "CARGO_FEATURE_BUILD_NVIDIA_HWACC" ) . is_ok ( ) {
391+ configure. arg ( "--enable-cuda-nvcc" ) ;
392+ configure. arg ( "--enable-cuvid" ) ;
393+ configure. arg ( "--enable-nvenc" ) ;
394+ configure. arg ( "--enable-nvdec" ) ;
395+ configure. arg ( "--enable-libnpp" ) ;
396+ }
397+
351398 // other external libraries
352399 enable ! ( configure, "BUILD_LIB_DRM" , "libdrm" ) ;
353400 enable ! ( configure, "BUILD_NVENC" , "nvenc" ) ;
@@ -359,6 +406,8 @@ fn build() -> io::Result<()> {
359406 // configure misc build options
360407 enable ! ( configure, "BUILD_PIC" , "pic" ) ;
361408
409+ println ! ( "{configure:#?}" ) ;
410+
362411 // run ./configure
363412 let output = configure
364413 . output ( )
0 commit comments