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
57 export shared_ffmpeg=$(pkg-config --variable=prefix libavformat)
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 if [ "$static_ffmpeg" != "" ]
87 if [ -d "$static_ffmpeg" ]
89 echo "CFLAGS+=-DAVDATADIR=\\\"${static_ffmpeg}/ffpresets/\\\"" >> config.mak
90 echo "CFLAGS+=-I$static_ffmpeg" >> config.mak
91 echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil" >> config.mak
92 [ $targetos = "Darwin" ] &&
93 echo "LDFLAGS+=-single_module" >> config.mak
94 if [ "$swscale" != "" ]
96 echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
97 echo "SWSCALE=1" >> config.mak
99 if [ "$devices" = "true" ]
101 echo "LDFLAGS+=-L$static_ffmpeg/libavdevice" >> config.mak
103 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
104 extra_libs="$extra_libs -lm -lz -lbz2"
106 if [ "$vdpau" = "true" ]
108 printf "#include <libavcodec/vdpau.h>\n int main(){ VdpBitstreamBuffer test; test.struct_version; return 0;}" | gcc -I"$static_ffmpeg" $CFLAGS -c -x c - >/dev/null 2>&1
109 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
112 echo "avformat: Invalid path specified: $static_ffmpeg"
113 touch ../disable-avformat
116 elif [ "$shared_ffmpeg" != "" ]
118 echo "PREFIX=$shared_ffmpeg" >> config.mak
121 echo "CFLAGS+=-DAVDATADIR=\\\"share/ffmpeg/\\\"" >> config.mak
124 echo "CFLAGS+=-DAVDATADIR=\\\"${shared_ffmpeg}/share/ffmpeg/\\\"" >> config.mak
127 echo "CFLAGS+=$(pkg-config --cflags libavformat)" >> config.mak
128 echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat)" >> config.mak
129 if [ "$devices" = "true" ]
131 echo "CFLAGS+=$(pkg-config --cflags libavdevice)" >> config.mak
132 echo "LDFLAGS+=$(pkg-config --libs-only-L libavdevice)" >> config.mak
134 avcodec_version=$(pkg-config --modversion libavcodec)
135 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 ] )
137 echo "CFLAGS+=$(pkg-config --cflags libswscale)" >> config.mak
138 echo "LDFLAGS+=$(pkg-config --libs-only-L libswscale)" >> config.mak
139 echo "SWSCALE=1" >> config.mak
142 if [ "$vdpau" = "true" ]
144 printf "#include <libavcodec/vdpau.h>\n int main(){ VdpBitstreamBuffer test; test.struct_version; return 0;}" | gcc -I"$(pkg-config --cflags libavformat)" -I"$shared_ffmpeg/include" $CFLAGS -c -x c - >/dev/null 2>&1
145 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
148 echo "- libavformat not found: disabling"
149 touch ../disable-avformat
153 echo "EXTRA_LIBS=$extra_libs" >> config.mak
154 echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak
155 [ "$codecs" = "true" ] && echo "CODECS=1" >> config.mak
156 [ "$filters" = "true" ] && echo "FILTERS=1" >> config.mak
157 [ "$devices" = "true" ] && echo "DEVICES=1" >> config.mak