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
27 NOTE: The recommended version of FFmpeg is $([ "$svn_rev" = "0.5" ] && echo $svn_rev || echo SVN-r$svn_rev).
47 [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib
57 export shared_ffmpeg=$(pkg-config --variable=prefix libavformat)
60 export svn_ffmpeg_extra=
61 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-svn ) svn_ffmpeg=true ;;
75 --avformat-svn-extra=* ) svn_ffmpeg_extra="${i#--avformat-svn-extra=}" ;;
76 --avformat-svn-version=* ) svn_rev="${i#--avformat-svn-version=}" ;;
77 --avformat-cvs ) svn_ffmpeg=true ;;
78 --avformat-suffix=* ) avformat_suffix="${i#--avformat-suffix=}" ;;
79 --avformat-swscale ) swscale=true ;;
80 --avformat-swscaler ) swscale=true ;;
81 --avformat-no-codecs ) codecs=false ;;
82 --avformat-no-filters ) filters=false ;;
86 if [ "$svn_ffmpeg" != "" ]
88 if [ "$gpl" = "true" ]
90 enable_gpl="--enable-gpl"
91 [ "$swscale" != "" ] && [ "$svn_rev" = "0.5" ] &&
92 enable_swscale="--enable-swscale"
97 echo "Checking out ffmpeg/avformat revision $svn_rev - no password required"
99 if [ "$svn_rev" = "0.5" ]; then
100 svn checkout svn://svn.mplayerhq.hu/ffmpeg/branches/$svn_rev ffmpeg
102 svn checkout -r $svn_rev svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
105 [ -d "ffmpeg" ] && ( cd ffmpeg ; ./configure $enable_gpl $enable_swscale $svn_ffmpeg_extra )
106 #[ ! -f "ffmpeg/ffmpeg.patch" ] && ( cd ffmpeg ; cp ../ffmpeg.patch . ; patch -p0 < ffmpeg.patch )
107 echo "CFLAGS+=-I`pwd`/ffmpeg -I`pwd`/ffmpeg/libavformat -I`pwd`/ffmpeg/libavcodec -I`pwd`/ffmpeg/libavutil -I`pwd`/ffmpeg/libavdevice" >> config.mak
108 echo "LDFLAGS+=-L`pwd`/ffmpeg/libavformat -L`pwd`/ffmpeg/libavcodec -L`pwd`/ffmpeg/libavutil -L`pwd`/ffmpeg/libavdevice" >> config.mak
109 if [ "$swscale" != "" ] || [ "$svn_rev" = "HEAD" ]
111 echo "CFLAGS+=-I`pwd`/ffmpeg/libswscale" >> config.mak
112 echo "LDFLAGS+=-L`pwd`/ffmpeg/libswscale" >> config.mak
113 echo "SWSCALE=1" >> config.mak
115 [ $targetos = "Darwin" ] &&
116 echo "LDFLAGS+=-single_module" >> config.mak
117 echo "LOCAL_FFMPEG=1" >> config.mak
118 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
119 extra_libs="$extra_libs -lm -lz -lbz2"
121 echo -e "#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
122 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
123 elif [ "$static_ffmpeg" != "" ]
125 if [ -d "$static_ffmpeg" ]
127 echo "CFLAGS+=-I$static_ffmpeg/libavformat -I$static_ffmpeg/libavcodec -I$static_ffmpeg/libavutil -I$static_ffmpeg/libavdevice" >> config.mak
128 echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil -L$static_ffmpeg/libavdevice" >> config.mak
129 [ $targetos = "Darwin" ] &&
130 echo "LDFLAGS+=-single_module" >> config.mak
131 if [ "$swscale" != "" ]
133 echo "CFLAGS+=-I$static_ffmpeg/libswscale" >> config.mak
134 echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
135 echo "SWSCALE=1" >> config.mak
137 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
138 extra_libs="$extra_libs -lm -lz -lbz2"
140 echo -e "#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
141 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
143 echo "avformat: Invalid path specified: $static_ffmpeg"
144 touch ../disable-avformat
147 elif [ "$shared_ffmpeg" != "" ]
149 echo "PREFIX=$shared_ffmpeg" >> config.mak
150 echo "CFLAGS+=$(pkg-config --cflags libavformat libavdevice) $TMP_CFLAGS" >> config.mak
151 echo "LDFLAGS+=$(pkg-config --libs-only-L libavformat libavdevice)" >> config.mak
152 [ -d "$shared_ffmpeg/include/ffmpeg/libavformat" ] &&
153 echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libavformat -I$shared_ffmpeg/include/ffmpeg/libavcodec -I$shared_ffmpeg/include/ffmpeg/libavdevice" >> config.mak
154 [ -d "$shared_ffmpeg/include/libavformat" ] &&
155 echo "CFLAGS+=-I$shared_ffmpeg/include/libavformat -I$shared_ffmpeg/include/libavcodec -I$shared_ffmpeg/include/libavdevice" >> config.mak
156 avcodec_version=$(pkg-config --modversion libavcodec)
157 if [ "$swscale" != "" ] || ( [ $(echo $avcodec_version | cut -d. -f1) -ge 52 ] && [ $(echo $avcodec_version | cut -d. -f2) -ge 21 ] )
159 [ -d "$shared_ffmpeg/include/ffmpeg/libswscale" ] &&
160 echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libswscale" >> config.mak
161 [ -d "$shared_ffmpeg/include/libswscale" ] &&
162 echo "CFLAGS+=-I$shared_ffmpeg/include/libswscale" >> config.mak
163 echo "SWSCALE=1" >> config.mak
166 echo -e "#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
167 [ "$x11" = "0" -a "$?" = "0" ] && echo "VDPAU=1" >> config.mak
169 echo "avformat: No build environment found. "
170 echo " Try configuring mlt with --avformat-svn."
171 touch ../disable-avformat
175 echo "EXTRA_LIBS=$extra_libs" >> config.mak
176 echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak
177 [ "$codecs" = "true" ] && echo "CODECS=1" >> config.mak
178 [ "$filters" = "true" ] && echo "FILTERS=1" >> config.mak