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-swscale - Use libswcale instead of img_convert (with --avformat-static)
21 --avformat-suffix=suff - Specify a custom suffix
22 --avformat-no-codecs - Disable the producer and consumer to avoid the codecs
23 --avformat-no-filters - Disable the filters to make a codecs+muxers-only plugin
24 --avformat-no-devices - Disable support for libavdevice
25 --avformat-vdpau - Enable support for NVIDIA VDPAU
27 NOTE: The recommended version of FFmpeg is $ffmpeg_ver or libav $libav_ver.
47 [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib
59 export avformat_suffix=
65 pkg-config x11 > /dev/null 2>&1
71 --avformat-static=* ) static_ffmpeg="${i#--avformat-static=}" ;;
72 --avformat-shared=* ) shared_ffmpeg="${i#--avformat-shared=}" ;;
73 --avformat-ldextra=* ) extra_libs="${i#--avformat-ldextra=}" ;;
74 --avformat-suffix=* ) avformat_suffix="${i#--avformat-suffix=}" ;;
75 --avformat-swscale ) swscale=true ;;
76 --avformat-swscaler ) swscale=true ;;
77 --avformat-no-codecs ) codecs=false ;;
78 --avformat-no-filters ) filters=false ;;
79 --avformat-no-devices ) devices=false ;;
80 --avformat-no-vdpau ) vdpau=false ;;
81 --avformat-vdpau ) vdpau=true ;;
85 : ${shared_ffmpeg:=$(pkg-config --variable=prefix libavformat${avformat_suffix})}
87 if [ "$static_ffmpeg" != "" ]
89 if [ -d "$static_ffmpeg" ]
91 echo "CFLAGS+=-DAVDATADIR=\\\"${static_ffmpeg}/ffpresets/\\\"" >> config.mak
92 echo "CFLAGS+=-I$static_ffmpeg" >> config.mak
93 echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil" >> config.mak
94 [ $targetos = "Darwin" ] &&
95 echo "LDFLAGS+=-single_module" >> config.mak
96 if [ "$swscale" != "" ]
98 echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
99 echo "SWSCALE=1" >> config.mak
101 if [ "$devices" = "true" ]
103 echo "LDFLAGS+=-L$static_ffmpeg/libavdevice" >> config.mak
105 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
106 extra_libs="$extra_libs -lm -lz -lbz2"
108 if [ "$vdpau" = "true" ]
110 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
111 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
114 echo "avformat: Invalid path specified: $static_ffmpeg"
115 touch ../disable-avformat
118 elif [ "$shared_ffmpeg" != "" ]
120 echo "PREFIX=$shared_ffmpeg" >> config.mak
123 echo "CFLAGS+=-DAVDATADIR=\\\"share/ffmpeg/\\\"" >> config.mak
126 echo "CFLAGS+=-DAVDATADIR=\\\"${shared_ffmpeg}/share/ffmpeg${avformat_suffix}/\\\"" >> config.mak
129 echo "CFLAGS+=$(pkg-config --cflags libavformat${avformat_suffix})" >> config.mak
130 echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat${avformat_suffix})" >> config.mak
131 if [ "$devices" = "true" ]
133 echo "CFLAGS+=$(pkg-config --cflags libavdevice${avformat_suffix})" >> config.mak
134 echo "LDFLAGS+=$(pkg-config --libs-only-L libavdevice${avformat_suffix})" >> config.mak
136 avcodec_version=$(pkg-config --modversion libavcodec${avformat_suffix})
137 if [ "$swscale" != "" ] || [ $(echo $avcodec_version | cut -d. -f1) -gt 52 ] || ( [ $(echo $avcodec_version | cut -d. -f1) -ge 52 ] && [ $(echo $avcodec_version | cut -d. -f2) -ge 21 ] )
139 echo "CFLAGS+=$(pkg-config --cflags libswscale${avformat_suffix})" >> config.mak
140 echo "LDFLAGS+=$(pkg-config --libs-only-L libswscale${avformat_suffix})" >> config.mak
141 echo "SWSCALE=1" >> config.mak
144 if [ "$vdpau" = "true" ]
146 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
147 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
150 echo "- libavformat not found: disabling"
151 touch ../disable-avformat
155 echo "EXTRA_LIBS=$extra_libs" >> config.mak
156 echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak
157 [ "$codecs" = "true" ] && echo "CODECS=1" >> config.mak
158 [ "$filters" = "true" ] && echo "FILTERS=1" >> config.mak
159 [ "$devices" = "true" ] && echo "DEVICES=1" >> config.mak