@@ -68,6 +68,7 @@ class FFMpegConan(ConanFile):
6868 "with_vaapi" : [True , False ],
6969 "with_vdpau" : [True , False ],
7070 "with_vulkan" : [True , False ],
71+ "with_whisper" : [True , False ],
7172 "with_xcb" : [True , False ],
7273 "with_soxr" : [True , False ],
7374 "with_appkit" : [True , False ],
@@ -157,6 +158,7 @@ class FFMpegConan(ConanFile):
157158 "with_vaapi" : True ,
158159 "with_vdpau" : True ,
159160 "with_vulkan" : False ,
161+ "with_whisper" : False ,
160162 "with_xcb" : True ,
161163 "with_soxr" : False ,
162164 "with_appkit" : True ,
@@ -250,6 +252,7 @@ def _dependencies(self):
250252 "with_libdav1d" : ["avcodec" ],
251253 "with_mediacodec" : ["with_jni" ],
252254 "with_xlib" : ["avdevice" ],
255+ "with_whisper" : ["avfilter" ],
253256 }
254257
255258 @property
@@ -269,6 +272,12 @@ def config_options(self):
269272 del self .options .fPIC
270273 if is_msvc (self ) and self .settings .arch == "armv8" :
271274 self .options .with_libsvtav1 = False
275+
276+ if Version (self .version ) >= "8.0" :
277+ del self .options .postproc
278+ else :
279+ del self .options .with_whisper
280+
272281 if self .settings .os not in ["Linux" , "FreeBSD" ]:
273282 del self .options .with_vaapi
274283 del self .options .with_vdpau
@@ -331,7 +340,7 @@ def requirements(self):
331340 if self .options .with_vorbis :
332341 self .requires ("vorbis/1.3.7" )
333342 if self .options .with_opus :
334- self .requires ("opus/1.4" )
343+ self .requires ("opus/[>= 1.4 <2] " )
335344 if self .options .with_zeromq :
336345 self .requires ("zeromq/4.3.5" )
337346 if self .options .with_sdl :
@@ -372,6 +381,8 @@ def requirements(self):
372381 self .requires ("dav1d/[>=1.4 <2]" )
373382 if self .options .get_safe ("with_libdrm" ):
374383 self .requires ("libdrm/2.4.119" )
384+ if self .options .get_safe ("with_whisper" ):
385+ self .requires ("whisper-cpp/1.7.6" )
375386
376387 def validate (self ):
377388 if self .options .with_ssl == "securetransport" and not is_apple_os (self ):
@@ -449,11 +460,17 @@ def _patch_sources(self):
449460 replace_in_file (self , os .path .join (self .source_folder , "libavcodec" , "libx264.c" ),
450461 "#define X264_API_IMPORTS 1" , "" )
451462 if self .options .with_ssl == "openssl" :
452- # https://trac.ffmpeg.org/ticket/5675
453- openssl_libs = load (self , os .path .join (self .build_folder , "openssl_libs.list" ))
454- replace_in_file (self , os .path .join (self .source_folder , "configure" ),
455- "check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||" ,
456- f"check_lib openssl openssl/ssl.h OPENSSL_init_ssl { openssl_libs } || " )
463+ # https://trac.ffmpeg.org/ticket/5675
464+ if Version (self .version ) >= "8.0" :
465+ openssl_libs = load (self , os .path .join (self .build_folder , "openssl_libs.list" ))
466+ replace_in_file (self , os .path .join (self .source_folder , "configure" ),
467+ "check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto -lws2_32 -lgdi32 ||" ,
468+ f"check_lib openssl openssl/ssl.h OPENSSL_init_ssl { openssl_libs } || " )
469+ else :
470+ openssl_libs = load (self , os .path .join (self .build_folder , "openssl_libs.list" ))
471+ replace_in_file (self , os .path .join (self .source_folder , "configure" ),
472+ "check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||" ,
473+ f"check_lib openssl openssl/ssl.h OPENSSL_init_ssl { openssl_libs } || " )
457474
458475 replace_in_file (self , os .path .join (self .source_folder , "configure" ), "echo libx264.lib" , "echo x264.lib" )
459476
@@ -519,7 +536,6 @@ def opt_append_disable_if_set(args, what, v):
519536 opt_enable_disable ("avformat" , self .options .avformat ),
520537 opt_enable_disable ("swresample" , self .options .swresample ),
521538 opt_enable_disable ("swscale" , self .options .swscale ),
522- opt_enable_disable ("postproc" , self .options .postproc ),
523539 opt_enable_disable ("avfilter" , self .options .avfilter ),
524540
525541 # Dependencies
@@ -570,10 +586,14 @@ def opt_append_disable_if_set(args, what, v):
570586 "--disable-cuvid" , # FIXME: CUVID support
571587 # Licenses
572588 opt_enable_disable ("nonfree" , self .options .get_safe ("with_libfdk_aac" ) or (self .options .with_ssl and (
573- self .options .with_libx264 or self .options .with_libx265 or self .options .postproc ))),
574- opt_enable_disable ("gpl" , self .options .with_libx264 or self .options .with_libx265 or self .options .postproc )
589+ self .options .with_libx264 or self .options .with_libx265 or self .options .get_safe ( " postproc" ) ))),
590+ opt_enable_disable ("gpl" , self .options .with_libx264 or self .options .with_libx265 or self .options .get_safe ( " postproc" ) )
575591 ]
576592
593+ # Version specific options
594+ if Version (self .version ) < "8.0" :
595+ args .append (opt_enable_disable ("postproc" , self .options .get_safe ("postproc" )))
596+
577597 # Individual Component Options
578598 opt_append_disable_if_set (args , "everything" , self .options .disable_everything )
579599 opt_append_disable_if_set (args , "encoders" , self .options .disable_all_encoders )
@@ -634,6 +654,9 @@ def opt_append_disable_if_set(args, what, v):
634654 args .extend (self ._split_and_format_options_string (
635655 "disable-filter" , self .options .disable_filters ))
636656
657+ if "with_whisper" in self .options :
658+ args .append (opt_enable_disable ("whisper" , self .options .with_whisper ))
659+
637660 if self ._version_supports_libsvtav1 :
638661 args .append (opt_enable_disable ("libsvtav1" , self .options .get_safe ("with_libsvtav1" )))
639662 if self ._version_supports_harfbuzz :
@@ -690,9 +713,6 @@ def opt_append_disable_if_set(args, what, v):
690713 if not check_min_vs (self , "190" , raise_invalid = False ):
691714 # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++)
692715 tc .extra_defines .append ("inline=__inline" )
693- if self .settings .compiler == "apple-clang" and Version (self .settings .compiler .version ) >= "15" :
694- # Workaround for link error "ld: building exports trie: duplicate symbol '_av_ac3_parse_header'"
695- tc .extra_ldflags .append ("-Wl,-ld_classic" )
696716 if cross_building (self ):
697717 args .append (f"--target-os={ self ._target_os } " )
698718 if is_apple_os (self ) and self .options .with_audiotoolbox :
@@ -727,7 +747,6 @@ def opt_append_disable_if_set(args, what, v):
727747
728748 env = Environment ()
729749 env .append ("CPPFLAGS" , [f"-I{ unix_path (self , p )} " for p in includedirs ] + [f"-D{ d } " for d in defines ])
730- env .append ("_LINK_" , [lib if lib .endswith (".lib" ) else f"{ lib } .lib" for lib in libs ])
731750 env .append ("LDFLAGS" , [f"-LIBPATH:{ unix_path (self , p )} " for p in libdirs ] + linkflags )
732751 env .append ("CXXFLAGS" , cxxflags )
733752 env .append ("CFLAGS" , cflags )
@@ -737,6 +756,7 @@ def opt_append_disable_if_set(args, what, v):
737756 deps .generate ()
738757
739758 deps = PkgConfigDeps (self )
759+ deps .set_property ("whisper-cpp" , "pkg_config_name" , "whisper" )
740760 deps .generate ()
741761
742762 if self .options .with_ssl == "openssl" :
@@ -847,7 +867,7 @@ def _add_component(name, dependencies):
847867 swresample = _add_component ("swresample" , [])
848868 if self .options .get_safe ("with_soxr" ):
849869 swresample .requires .append ("soxr::soxr" )
850- if self .options .postproc :
870+ if self .options .get_safe ( " postproc" ) :
851871 _add_component ("postproc" , [])
852872
853873 if self .settings .os in ("FreeBSD" , "Linux" ):
@@ -966,6 +986,8 @@ def _add_component(name, dependencies):
966986 avfilter .frameworks .append ("CoreImage" )
967987 if Version (self .version ) >= "5.0" and is_apple_os (self ):
968988 avfilter .frameworks .append ("Metal" )
989+ if self .options .get_safe ("with_whisper" ):
990+ avfilter .requires .append ("whisper-cpp::whisper-cpp" )
969991
970992 if self .options .get_safe ("with_libdrm" ):
971993 avutil .requires .append ("libdrm::libdrm_libdrm" )
0 commit comments