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.
7 micro_version=$(echo $version | cut -d . -f 3)
8 odd_version=$(($micro_version % 2))
9 [ "$odd_version" -eq "1" ] && svn_rev="HEAD"
14 FFmpeg/avformat options:
16 --avformat-svn - Obtain FFmpeg from its Subversion repository
17 --avformat-svn-version - Specify a particular revision for --avformat-svn
18 --avformat-svn-extra - Add extra configure options for --avformat-svn
19 --avformat-shared=path - Link against a shared installation of FFmpeg (default)
20 --avformat-static=path - Link against a static FFmpeg development tree
21 --avformat-ldextra=libs - Provide additional libs to link with
22 --avformat-suffix=suff - Specify a custom suffix for a shared build of FFmpeg
23 --avformat-swscale - Use libswcale instead of img_convert
24 --avformat-no-codecs - Disable the producer and consumer to avoid the FFmpeg codecs
25 --avformat-no-filters - Disable the filters to make a codecs+muxers-only plugin
26 --avformat-no-devices - Disable support for libavdevice
27 --avformat-no-vdpau - Disable support for NVIDIA VDPAU
29 NOTE: The recommended version of FFmpeg is $([ "$svn_rev" = "0.6.1" ] && echo $svn_rev || echo SVN-r$svn_rev).
49 [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib
59 export shared_ffmpeg=$(pkg-config --variable=prefix libavformat)
62 export svn_ffmpeg_extra=
63 export avformat_suffix=
69 pkg-config x11 > /dev/null 2>&1
75 --avformat-static=* ) static_ffmpeg="${i#--avformat-static=}" ;;
76 --avformat-shared=* ) shared_ffmpeg="${i#--avformat-shared=}" ;;
77 --avformat-ldextra=* ) extra_libs="${i#--avformat-ldextra=}" ;;
78 --avformat-svn ) svn_ffmpeg=true ;;
79 --avformat-svn-extra=* ) svn_ffmpeg_extra="${i#--avformat-svn-extra=}" ;;
80 --avformat-svn-version=* ) svn_rev="${i#--avformat-svn-version=}" ;;
81 --avformat-cvs ) svn_ffmpeg=true ;;
82 --avformat-suffix=* ) avformat_suffix="${i#--avformat-suffix=}" ;;
83 --avformat-swscale ) swscale=true ;;
84 --avformat-swscaler ) swscale=true ;;
85 --avformat-no-codecs ) codecs=false ;;
86 --avformat-no-filters ) filters=false ;;
87 --avformat-no-devices ) devices=false ;;
88 --avformat-no-vdpau ) vdpau=false ;;
92 if [ "$svn_ffmpeg" != "" ]
94 if [ "$gpl" = "true" ]
96 enable_gpl="--enable-gpl"
97 [ "$swscale" != "" ] && [ "$svn_rev" = "0.5" ] &&
98 enable_swscale="--enable-swscale"
103 echo "Checking out ffmpeg/avformat revision $svn_rev - no password required"
105 if [ "$svn_rev" = "0.6.1" ] || [ "$svn_rev" = "0.6" ] || [ "$svn_rev" = "0.5" ]
107 svn checkout svn://svn.mplayerhq.hu/ffmpeg/branches/$svn_rev ffmpeg
109 svn checkout -r $svn_rev svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
112 [ "$devices" = "false" ] && disable_devices="--disable-devices"
113 [ -d "ffmpeg" ] && ( cd ffmpeg ; ./configure $enable_gpl $disable_devices $enable_swscale $svn_ffmpeg_extra --extra-cflags=-fPIC )
114 #[ ! -f "ffmpeg/ffmpeg.patch" ] && ( cd ffmpeg ; cp ../ffmpeg.patch . ; patch -p0 < ffmpeg.patch )
115 echo "CFLAGS+=-DAVDATADIR=\\\"${prefix}/share/ffmpeg/\\\"" >> config.mak
116 echo "CFLAGS+=-I`pwd`/ffmpeg" >> config.mak
117 echo "LDFLAGS+=-L`pwd`/ffmpeg/libavformat -L`pwd`/ffmpeg/libavcodec -L`pwd`/ffmpeg/libavutil" >> config.mak
118 if [ "$swscale" != "" ] || [ "$svn_rev" = "HEAD" ] || [ "$svn_rev" = "0.6.1" ] || [ "$svn_rev" = "0.6" ] || [ "$svn_rev" = "0.5" ]
120 echo "LDFLAGS+=-L`pwd`/ffmpeg/libswscale" >> config.mak
121 echo "SWSCALE=1" >> config.mak
123 if [ "$devices" = "true" ]
125 echo "LDFLAGS+=-L`pwd`/ffmpeg/libavdevice" >> config.mak
127 [ $targetos = "Darwin" ] &&
128 echo "LDFLAGS+=-single_module" >> config.mak
129 echo "LOCAL_FFMPEG=1" >> config.mak
130 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
131 extra_libs="$extra_libs -lm -lz -lbz2"
133 if [ "$vdpau" = "true" ]
135 printf "#include <libavcodec/vdpau.h>\n int main(){ VdpBitstreamBuffer test; test.struct_version; return 0;}" | gcc -I"`pwd`/ffmpeg" $CFLAGS -c -x c - >/dev/null 2>&1
136 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
138 elif [ "$static_ffmpeg" != "" ]
140 if [ -d "$static_ffmpeg" ]
142 echo "CFLAGS+=-DAVDATADIR=\\\"${static_ffmpeg}/ffpresets/\\\"" >> config.mak
143 echo "CFLAGS+=-I$static_ffmpeg" >> config.mak
144 echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil" >> config.mak
145 [ $targetos = "Darwin" ] &&
146 echo "LDFLAGS+=-single_module" >> config.mak
147 if [ "$swscale" != "" ]
149 echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
150 echo "SWSCALE=1" >> config.mak
152 if [ "$devices" = "true" ]
154 echo "LDFLAGS+=-L$static_ffmpeg/libavdevice" >> config.mak
156 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
157 extra_libs="$extra_libs -lm -lz -lbz2"
159 if [ "$vdpau" = "true" ]
161 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
162 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
165 echo "avformat: Invalid path specified: $static_ffmpeg"
166 touch ../disable-avformat
169 elif [ "$shared_ffmpeg" != "" ]
171 echo "PREFIX=$shared_ffmpeg" >> config.mak
172 echo "CFLAGS+=-DAVDATADIR=\\\"${shared_ffmpeg}/share/ffmpeg/\\\"" >> config.mak
173 echo "CFLAGS+=$(pkg-config --cflags libavformat)" >> config.mak
174 echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat)" >> config.mak
175 if [ "$devices" = "true" ]
177 echo "CFLAGS+=$(pkg-config --cflags libavdevice)" >> config.mak
178 echo "LDFLAGS+=$(pkg-config --libs-only-L libavdevice)" >> config.mak
180 avcodec_version=$(pkg-config --modversion libavcodec)
181 if [ "$swscale" != "" ] || ( [ $(echo $avcodec_version | cut -d. -f1) -ge 52 ] && [ $(echo $avcodec_version | cut -d. -f2) -ge 21 ] )
183 echo "CFLAGS+=$(pkg-config --cflags libswscale)" >> config.mak
184 echo "LDFLAGS+=$(pkg-config --libs-only-L libswscale)" >> config.mak
185 echo "SWSCALE=1" >> config.mak
188 if [ "$vdpau" = "true" ]
190 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
191 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
194 echo "avformat: No build environment found. "
195 echo " Try configuring mlt with --avformat-svn."
196 touch ../disable-avformat
200 echo "EXTRA_LIBS=$extra_libs" >> config.mak
201 echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak
202 [ "$codecs" = "true" ] && echo "CODECS=1" >> config.mak
203 [ "$filters" = "true" ] && echo "FILTERS=1" >> config.mak
204 [ "$devices" = "true" ] && echo "DEVICES=1" >> config.mak