3 # Determine whether to recommend/use the HEAD revision of FFmpeg (unreleased)
4 # or a specific revision based upon whether the last digit of our version
5 # is even or odd. An odd MLT version number always represents unreleased.
8 micro_version=$(echo $version | cut -d . -f 3)
9 odd_version=$(($micro_version % 2))
10 [ "$odd_version" -eq "1" ] && ffmpeg_ver="HEAD" && libav_ver="HEAD"
15 FFmpeg/avformat options:
17 --avformat-shared=path - Link against a shared installation of libavformat (default)
18 --avformat-static=path - Link against a static build of libavformat
19 --avformat-ldextra=libs - Provide additional libs to link with
20 --avformat-suffix=suff - Specify a custom suffix
21 --avformat-no-codecs - Disable the producer and consumer to avoid the codecs
22 --avformat-no-filters - Disable the filters to make a codecs+muxers-only plugin
23 --avformat-no-devices - Disable support for libavdevice
24 --avformat-vdpau - Enable support for NVIDIA VDPAU
26 NOTE: The recommended version of FFmpeg is $ffmpeg_ver or libav $libav_ver.
46 [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib
58 export avformat_suffix=
63 pkg-config x11 > /dev/null 2>&1
69 --avformat-static=* ) static_ffmpeg="${i#--avformat-static=}" ;;
70 --avformat-shared=* ) shared_ffmpeg="${i#--avformat-shared=}" ;;
71 --avformat-ldextra=* ) extra_libs="${i#--avformat-ldextra=}" ;;
72 --avformat-suffix=* ) avformat_suffix="${i#--avformat-suffix=}" ;;
73 --avformat-no-codecs ) codecs=false ;;
74 --avformat-no-filters ) filters=false ;;
75 --avformat-no-devices ) devices=false ;;
76 --avformat-no-vdpau ) vdpau=false ;;
77 --avformat-vdpau ) vdpau=true ;;
81 : ${shared_ffmpeg:=$(pkg-config --variable=prefix libavformat${avformat_suffix})}
83 if [ "$static_ffmpeg" != "" ]
85 if [ -d "$static_ffmpeg" ]
87 echo "CFLAGS+=-DAVDATADIR=\\\"${static_ffmpeg}/ffpresets/\\\"" >> config.mak
88 echo "CFLAGS+=-I$static_ffmpeg" >> config.mak
89 echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil" >> config.mak
90 echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
91 [ $targetos = "Darwin" ] &&
92 echo "LDFLAGS+=-single_module" >> config.mak
93 if [ "$devices" = "true" ]
95 echo "LDFLAGS+=-L$static_ffmpeg/libavdevice" >> config.mak
97 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
98 extra_libs="$extra_libs -lm -lz -lbz2"
100 if [ "$vdpau" = "true" ]
102 printf "#include <libavcodec/vdpau.h>\n int main(){ VdpBitstreamBuffer test; test.struct_version; return 0;}" | $CC -I"$static_ffmpeg" $CFLAGS -c -x c - >/dev/null 2>&1
103 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
106 echo "avformat: Invalid path specified: $static_ffmpeg"
107 touch ../disable-avformat
110 elif [ "$shared_ffmpeg" != "" ]
112 if ! $(pkg-config libswscale${avformat_suffix}); then
113 echo "- libswscale not found: disabling"
114 touch ../disable-avformat
117 echo "PREFIX=$shared_ffmpeg" >> config.mak
120 echo "CFLAGS+=-DAVDATADIR=\\\"share/ffmpeg/\\\"" >> config.mak
123 echo "CFLAGS+=-DAVDATADIR=\\\"${shared_ffmpeg}/share/ffmpeg${avformat_suffix}/\\\"" >> config.mak
126 echo "CFLAGS+=$(pkg-config --cflags libavformat${avformat_suffix})" >> config.mak
127 echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat${avformat_suffix})" >> config.mak
128 echo "CFLAGS+=$(pkg-config --cflags libswscale${avformat_suffix})" >> config.mak
129 echo "LDFLAGS+=$(pkg-config --libs-only-L libswscale${avformat_suffix})" >> config.mak
130 if [ "$devices" = "true" ]
132 if ! $(pkg-config libavdevice${avformat_suffix}); then
133 echo "- libavdevice not found: disabling"
134 touch ../disable-avformat
137 echo "CFLAGS+=$(pkg-config --cflags libavdevice${avformat_suffix})" >> config.mak
138 echo "LDFLAGS+=$(pkg-config --libs-only-L libavdevice${avformat_suffix})" >> config.mak
141 if [ "$vdpau" = "true" ]
143 printf "#include <libavcodec/vdpau.h>\n int main(){ VdpBitstreamBuffer test; test.struct_version; return 0;}" | $CC $(pkg-config --cflags libavformat${avformat_suffix}) -I"$shared_ffmpeg/include" $CFLAGS -c -x c - >/dev/null 2>&1
144 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
147 echo "- libavformat not found: disabling"
148 touch ../disable-avformat
152 echo "EXTRA_LIBS=$extra_libs" >> config.mak
153 echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak
154 [ "$codecs" = "true" ] && echo "CODECS=1" >> config.mak
155 [ "$filters" = "true" ] && echo "FILTERS=1" >> config.mak
156 [ "$devices" = "true" ] && echo "DEVICES=1" >> config.mak