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 Subversion
17 --avformat-svn-extra - Add extra configure options for --avformat-svn
18 --avformat-shared=path - Link against a shared installation of ffmpeg (default)
19 --avformat-static=path - Link against a static ffmpeg dev tree
20 --avformat-ldextra=libs - Provide additional libs to link with
21 --avformat-suffix=suff - Specify a custom suffix for an ffmpeg shared build
22 --avformat-swscale - Use ffmpeg libswcale instead of img_convert
24 NOTE: The recommended version of FFmpeg is SVN-r$svn_rev.
44 [ -d /usr/lib/lib64 ] && export LIBDIR=lib64 || export LIBDIR=lib
54 export shared_ffmpeg=$(pkg-config --variable=prefix libavformat)
57 export svn_ffmpeg_extra=
58 export avformat_suffix=
64 --avformat-static=* ) static_ffmpeg="${i#--avformat-static=}" ;;
65 --avformat-shared=* ) shared_ffmpeg="${i#--avformat-shared=}" ;;
66 --avformat-ldextra=* ) extra_libs="${i#--avformat-ldextra=}" ;;
67 --avformat-svn ) svn_ffmpeg=true ;;
68 --avformat-svn-extra=* ) svn_ffmpeg_extra="${i#--avformat-svn-extra=}" ;;
69 --avformat-cvs ) svn_ffmpeg=true ;;
70 --avformat-suffix=* ) avformat_suffix="${i#--avformat-suffix=}" ;;
71 --avformat-swscale ) swscale=true ;;
72 --avformat-swscaler ) swscale=true ;;
76 if [ "$svn_ffmpeg" != "" ]
78 if [ "$gpl" = "true" ]
80 enable_gpl="--enable-gpl"
81 if [ "$swscale" != "" ]
83 enable_swscale="--enable-swscale"
84 echo "SWSCALE=1" >> config.mak
86 elif [ "$swscale" != "" ]
89 echo "ERROR ERROR ERROR ERROR ERROR ERROR"
90 echo "--enable-gpl is required to use --avformat-swscale with --avformat-svn!"
97 echo "Checking out ffmpeg/avformat revision $svn_rev - no password required"
99 svn checkout -r $svn_rev svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
101 [ -d "ffmpeg" ] && ( cd ffmpeg ; ./configure $enable_gpl $enable_swscale $svn_ffmpeg_extra )
102 #[ ! -f "ffmpeg/ffmpeg.patch" ] && ( cd ffmpeg ; cp ../ffmpeg.patch . ; patch -p0 < ffmpeg.patch )
103 echo "CFLAGS+=-I`pwd`/ffmpeg -I`pwd`/ffmpeg/libavformat -I`pwd`/ffmpeg/libavcodec -I`pwd`/ffmpeg/libavutil -I`pwd`/ffmpeg/libavdevice -I`pwd`/ffmpeg/libswscale" >> config.mak
104 echo "LDFLAGS+=-L`pwd`/ffmpeg/libavformat -L`pwd`/ffmpeg/libavcodec -L`pwd`/ffmpeg/libavutil -L`pwd`/ffmpeg/libavdevice -L`pwd`/ffmpeg/libswscale" >> config.mak
105 [ $targetos = "Darwin" ] &&
106 echo "LDFLAGS+=-single_module" >> config.mak
107 echo "LOCAL_FFMPEG=1" >> config.mak
108 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
109 extra_libs="$extra_libs -lz"
110 elif [ "$static_ffmpeg" != "" ]
112 if [ -d "$static_ffmpeg" ]
114 echo "CFLAGS+=-I$static_ffmpeg/libavformat -I$static_ffmpeg/libavcodec -I$static_ffmpeg/libavutil -I$static_ffmpeg/libavdevice" >> config.mak
115 echo "LDFLAGS+=-L$static_ffmpeg/libavformat -L$static_ffmpeg/libavcodec -L$static_ffmpeg/libavutil -L$static_ffmpeg/libavdevice" >> config.mak
116 [ $targetos = "Darwin" ] &&
117 echo "LDFLAGS+=-single_module" >> config.mak
118 if [ "$swscale" != "" ]
120 echo "CFLAGS+=-I$static_ffmpeg/libswscale" >> config.mak
121 echo "LDFLAGS+=-L$static_ffmpeg/libswscale" >> config.mak
122 echo "SWSCALE=1" >> config.mak
124 echo "LDFLAGS+=-Wl,-Bsymbolic" >> config.mak
125 extra_libs="$extra_libs -lz"
127 echo "avformat: Invalid path specified: $static_ffmpeg"
128 touch ../disable-avformat
131 elif [ "$shared_ffmpeg" != "" ]
133 echo "PREFIX=$shared_ffmpeg" >> config.mak
134 echo "CFLAGS+=$(pkg-config --cflags libavformat) $TMP_CFLAGS" >> config.mak
135 echo "LDFLAGS+=$(pkg-config --libs libavformat)" >> config.mak
136 [ -d "$shared_ffmpeg/include/ffmpeg/libavformat" ] &&
137 echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libavformat -I$shared_ffmpeg/include/ffmpeg/libavcodec" >> config.mak
138 [ -d "$shared_ffmpeg/include/libavformat" ] &&
139 echo "CFLAGS+=-I$shared_ffmpeg/include/libavformat -I$shared_ffmpeg/include/libavcodec" >> config.mak
140 if [ "$swscale" != "" ]
142 [ -d "$shared_ffmpeg/include/ffmpeg/libswscale" ] &&
143 echo "CFLAGS+=-I$shared_ffmpeg/include/ffmpeg/libswscale" >> config.mak
144 [ -d "$shared_ffmpeg/include/libswscale" ] &&
145 echo "CFLAGS+=-I$shared_ffmpeg/include/libswscale" >> config.mak
146 echo "SWSCALE=1" >> config.mak
149 echo "avformat: No build environment found. "
150 echo " Try configuring mlt with --avformat-svn."
151 touch ../disable-avformat
155 echo "EXTRA_LIBS=$extra_libs" >> config.mak
156 echo "AVFORMAT_SUFFIX=$avformat_suffix" >> config.mak