Revision e11386c0

View differences:

build_ul.sh
1 1
#!/bin/bash
2
SCRIPT=$(readlink -f $0)
3
BASE_UL_DIR=`dirname $SCRIPT`
2
SCRIPT=$0
3
BASE_UL_DIR=`pwd`
4 4
EXTERN_DIR="external_libs"
5
MAKE="make -j `grep processor /proc/cpuinfo | wc -l`"
5
MAKE="make -j 4"
6 6
cd "$BASE_UL_DIR"
7 7

  
8
which svn >/dev/null || { echo "CANNOT build UL Applications: svn missing. Please install subversion, then retry!"; exit 1; }
9
#which libtoolize >/dev/null || { echo "CANNOT build UL Applications: libtool missing. Please install libtool, then retry!"; exit 1; }
10
which yasm >/dev/null || { echo "CANNOT build UL Applications: yasm missing. Please install yasm, then retry!"; exit 1; }
11
if [ ! -n "MAC_OS" ]; then
12
  #we don't have git on osx - so we avoid using it
13
  which git >/dev/null || { echo "CANNOT build UL Applications: git missing. Please install git, then retry!"; exit 1; }
14
fi
15
WGET_OR_CURL=`which wget`
16
[ -n "$WGET_OR_CURL" ] || { WGET_OR_CURL=`which curl` ; WGET_OR_CURLOPT="-L -O"; }
17
[ -n "$WGET_OR_CURL" ] || { echo "please install wget or curl!"; exit 1; }
18

  
8 19
#set some defaults
9 20
IO=${IO:-"httpevent"}
10 21
MONL=${MONL:-1}
11 22
ML=${ML:-1}
12 23

  
24
if [ "$HOSTARCH" = "mingw32" ]; then
25
	MINGW=1
26
fi
27

  
13 28
#by default build an check
14 29
BUILD_ALL=1
15 30

  
16
LIBTOOLIZE_PATH=`whereis -b libtoolize`
31
LIBTOOLIZE_PATH=`whereis libtoolize`
17 32
if [ "$LIBTOOLIZE_PATH" = "libtoolize:" ]; then
18 33
	echo "Can't find libtoolize. Try sudo apt-get install libtool"
19 34
	exit
20 35
fi
21 36

  
22
YASM_PATH=`whereis -b yasm`
37
YASM_PATH=`whereis yasm`
23 38
if [ "$YASM_PATH" = "yasm:" ]; then
24 39
	echo "Can't find yasm assembler. Try sudo apt-get install yasm"
25 40
	exit
26 41
fi
27 42

  
28
#try to find libbz2 in your system
29
LOCAL_BZ2_A=`locate -l 1 libbz2.a`
30
if [ "$LOCAL_BZ2_A" = "" ]; then
31
	if [ -f "/usr/lib/libbz2.a" ]; then
43
mkdir $EXTERN_DIR
44

  
45
if [ -n "$MINGW" ]; then
46
	TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2_mingw"
47
	if [ ! -e "$TEMP_BZ2/lib/libbz2.a" ]; then
48
		#we erase and rebuild since the installation is not there
49
		cd "$BASE_UL_DIR/$EXTERN_DIR"
50
		rm -r -f bzip2_mingw
51
		#get the latest bzip2 library
52
		$WGET_OR_CURL $WGET_OR_CURLOPT http://switch.dl.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-bin.zip; unzip bzip2-1.0.5-bin.zip -d bzip2_mingw
53
		$WGET_OR_CURL $WGET_OR_CURLOPT http://sunet.dl.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-lib.zip; unzip -o bzip2-1.0.5-lib.zip -d bzip2_mingw
54
		rm -f bzip2-1.0.5-lib.zip; rm -f bzip2-1.0.5-bin.zip;
55
	fi
56
	LOCAL_BZ2=$TEMP_BZ2
57
else
58
	#try to find libbz2 in your system
59
	LOCAL_BZ2_A=/usr/lib/libbz2.a
60
	if [ ! -e $LOCAL_BZ2_A ]; then
61
		LOCAL_BZ2_A=`locate -l 1 libbz2.a`
62
		[ X$LOCAL_BZ2_A != X ] && LOCAL_BZ2=`dirname $LOCAL_BZ2_A`/..
63
		if [ ! -e "$LOCAL_BZ2/lib/libbz2.a" ]; then
64
			#wrong location and/or folders structure
65
			echo "you seem not to have file libbz2.a or the location is non-standard.Will be built locally."
66
			LOCAL_BZ2=""
67
			BUILD_BZ2=1
68
		fi
69
	else
32 70
		echo "You have file libbz2.a in default system"
33 71
		echo "setting path for it to default /usr/lib/libbz2.a"
34 72
		LOCAL_BZ2="/usr"
35
	else
36
		echo "you seem not to have file libbz2.a. Will be built locally."
37
		BUILD_BZ2=1
38
	fi
39
else
40
	LOCAL_BZ2=`dirname $LOCAL_BZ2_A`/..
41
	if [ ! -e "$LOCAL_BZ2/lib/libbz2.a" ]; then
42
		#wrong location and/or folders structure
43
		LOCAL_BZ2=""
44
		BUILD_BZ2=1
45 73
	fi
46 74
fi
47 75

  
48
#try to find libz in your system
49
LOCAL_Z_A=`locate -l 1 libz.a`
50
if [ "$LOCAL_Z_A" = "" ]; then
51
	if [ -f "/usr/lib/libz.a" ]; then
52
		echo "You have file libz.a in default system"
53
		echo "setting path for it to default /usr/lib/libz.a"
54
		LOCAL_Z="/usr"
55
	else
56
		echo "you seem not to have file libz.a. Will be built locally."
57
		BUILD_Z=1
76
if [ -n "$MINGW" ]; then
77
	TEMP_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib_mingw"
78
	if [ ! -e "$TEMP_Z/lib/libz.a" ]; then
79
		cd "$BASE_UL_DIR/$EXTERN_DIR"
80
		rm -r -f zlib_mingw;
81
		#get the latest zlib libraries
82
		$WGET_OR_CURL $WGET_OR_CURLOPT http://sunet.dl.sourceforge.net/project/gnuwin32/zlib/1.2.3/zlib-1.2.3-bin.zip; unzip zlib-1.2.3-bin.zip -d zlib_mingw
83
		$WGET_OR_CURL $WGET_OR_CURLOPT http://kent.dl.sourceforge.net/project/gnuwin32/zlib/1.2.3/zlib-1.2.3-lib.zip; unzip -o zlib-1.2.3-lib.zip -d zlib_mingw
84
		rm -f zlib-1.2.3-bin.zip; rm -f zlib-1.2.3-lib.zip;
58 85
	fi
86
	LOCAL_Z=$TEMP_Z
59 87
else
60
	LOCAL_Z=`dirname $LOCAL_Z_A`/..
61
	if [ ! -e "$LOCAL_Z/lib/libz.a" ]; then
62
		#wrong location and/or folders structure
63
		LOCAL_Z=""
64
		BUILD_Z=1
88
	LOCAL_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib/temp_zlib_install_linux"
89
	if [ -f "$LOCAL_Z/lib/libz.a" ]; then
90
		echo "libz.a found in $LOCAL_Z/lib"
91
	else
92
		#force building locally
93
		#does not exist systemwide
94
		cd "$BASE_UL_DIR/$EXTERN_DIR"
95
		rm -r -f zlib
96
		#get and compile latest zlib library
97
		$WGET_OR_CURL $WGET_OR_CURLOPT http://zlib.net/zlib-1.2.5.tar.gz; tar xzf zlib-1.2.5.tar.gz; mv zlib-1.2.5 zlib; rm -f zlib-1.2.5.tar.gz
98
		cd zlib
99
		#make and install in local folder
100
		./configure --prefix="$LOCAL_Z"
101
		$MAKE; $MAKE install
65 102
	fi
66
fi
67 103

  
68
#clean all external libraries if CLEAN_EXTERNAL_BUILD=1
69
if [ -n "$CLEAN_EXTERNAL_BUILD" ]; then
70
	#remove previuos versions of external libs builds
71
	rm -r -f $EXTERN_DIR
104
	#clean all external libraries if CLEAN_EXTERNAL_BUILD=1
105
	if [ -n "$CLEAN_EXTERNAL_BUILD" ]; then
106
		#remove previuos versions of external libs builds
107
		rm -r -f $EXTERN_DIR
108
	fi
72 109
fi
73

  
74
mkdir $EXTERN_DIR
75

  
76
TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2/temp_bzip2_install"
77
if [ -n "$BUILD_BZ2" ]; then
78
	#we have to build it either because of user will or because does not exist system wide
79
	if [ -z "$LOCAL_BZ2" ]; then
80
		#does not exist systemwide
81
		if [ -n "$BUILD_ALL" -a ! -e "$TEMP_BZ2" ]; then
82
			#we erase and rebuild since the installation is not there
83
			cd "$BASE_UL_DIR/$EXTERN_DIR"
84
			rm -r -f bzip2
85
			rm -f bzip2-1.0.5.tar.gz
86
			#get and compile latest bzip2 library
87
			wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz; tar xzf bzip2-1.0.5.tar.gz; mv bzip2-1.0.5 bzip2
88
			cd bzip2
89
			#make and install in local folder
90
			$MAKE; $MAKE install PREFIX="$TEMP_BZ2"
110
LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_Z/include"
111
LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_Z/lib"
112

  
113
if [ ! -n "$MINGW" ]; then
114
	TEMP_BZ2="$BASE_UL_DIR/$EXTERN_DIR/bzip2/temp_bzip2_install_linux"
115
	if [ -n "$BUILD_BZ2" ]; then
116
		#we have to build it either because of user will or because does not exist system wide
117
		if [ -z "$LOCAL_BZ2" ]; then
118
			#does not exist systemwide
119
			if [ -n "$BUILD_ALL" -a ! -e "$TEMP_BZ2" ]; then
120
				#we erase and rebuild since the installation is not there
121
				cd "$BASE_UL_DIR/$EXTERN_DIR"
122
				rm -r -f bzip2
123
				#get and compile latest bzip2 library
124
				$WGET_OR_CURL $WGET_OR_CURLOPT http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz; tar xzf bzip2-1.0.5.tar.gz; mv bzip2-1.0.5 bzip2; rm -f bzip2-1.0.5.tar.gz
125
				cd bzip2
126
				#make and install in local folder
127
				$MAKE; $MAKE install PREFIX="$TEMP_BZ2"
128
			fi
129
			#previous local install is existing, just set pointer to it
130
			#or override location if it was set as systemwide
131
			LOCAL_BZ2=$TEMP_BZ2
91 132
		fi
92
		#previous local install is existing, just set pointer to it
93
		#or override location if it was set as systemwide
94
		LOCAL_BZ2=$TEMP_BZ2
95 133
	fi
96 134
fi
97 135

  
98
TEMP_Z="$BASE_UL_DIR/$EXTERN_DIR/zlib/temp_zlib_install"
99
if [ -n "$BUILD_Z" ]; then
100
	#we have to build it either because of user will or because does not exist system wide
101
	if [ -z "$LOCAL_Z" ]; then
102
		#does not exist systemwide
103
		if [ -n "$BUILD_ALL" -a ! -e "$TEMP_Z" ]; then
104
			cd "$BASE_UL_DIR/$EXTERN_DIR"
105
			rm -r -f zlib
106
			rm -f zlib-1.2.5.tar.gz
107
			#get and compile latest zlib library
108
			wget http://zlib.net/zlib-1.2.5.tar.gz; tar xzf zlib-1.2.5.tar.gz; mv zlib-1.2.5 zlib
109
			cd zlib
110
			#make and install in local folder
111
			./configure --prefix="$TEMP_Z"
112
			$MAKE; $MAKE install
113
		fi
114
		#previous local install is existing, just set pointer to it
115
		#or override location if it was set as systemwide
116
		LOCAL_Z=$TEMP_Z
136

  
137
if [ -n "$MINGW" ]; then
138
	# plibc
139
	LOCAL_PLIBC="$BASE_UL_DIR/$EXTERN_DIR/plibc"
140
	if [ -f "$BASE_UL_DIR/$EXTERN_DIR/plibc/lib/libplibc.dll.a" ]; then
141
		echo "You have file libplibc.dll.a in default system: $BASE_UL_DIR/$EXTERN_DIR/plibc/lib/libplibc.dll.a"
142
	else
143
		cd "$BASE_UL_DIR/$EXTERN_DIR"
144
		rm -fR plibc
145
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ovh.dl.sourceforge.net/project/plibc/plibc/0.1.5/plibc-0.1.5.zip
146
		unzip plibc-0.1.5.zip -d plibc;
147
		rm -f plibc/lib/*.la
148
		rm -f plibc-0.1.5.zip
149
	fi
150
	LIBMICROHHTPD_FLAGS="-I$BASE_UL_DIR/$EXTERN_DIR/plibc/include"
151
	LIBMICROHHTPD_LDFLAGS="-L$BASE_UL_DIR/$EXTERN_DIR/plibc/lib"
152

  
153
	# libiconv
154
	LOCAL_LIBICONV="$BASE_UL_DIR/$EXTERN_DIR/libiconv/temp_libiconv_install_mingw"
155
	if [ -f "$LOCAL_LIBICONV/lib/libiconv.a" ]; then
156
		echo "libiconv.a found in $LOCAL_LIBICONV/lib"
157
	else
158
		cd "$BASE_UL_DIR/$EXTERN_DIR"
159
		rm -fR libiconv
160
		
161
		#download binaries
162
		#~ wget http://kent.dl.sourceforge.net/project/gnuwin32/libintl/0.14.4/libintl-0.14.4-dep.zip; unzip libintl-0.14.4-dep.zip -d libiconv
163
		#~ mkdir -p $LOCAL_LIBICONV/lib/
164
		#~ mv libiconv/*.dll $LOCAL_LIBICONV/lib/
165
		#~ rm -f libintl-0.14.4-dep.zip
166
		
167
		#build from sources
168
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.tar.gz
169
		tar zxvf libiconv-1.13.tar.gz; mv libiconv-1.13 libiconv; rm -f libiconv-1.13.tar.gz; cd libiconv
170
		./configure --enable-static ${HOSTARCH:+--host=$HOSTARCH} --prefix=$LOCAL_LIBICONV
171
		make
172
		make install
173
	fi
174
	LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBICONV/include"
175
	#~ LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBICONV/lib"
176

  
177
	LOCAL_LIBINTL="$BASE_UL_DIR/$EXTERN_DIR/libintl/temp_libintl_install_mingw"
178
	if [ -f "$LOCAL_LIBINTL/lib/libintl.dll.a" ] || [ -f "$LOCAL_LIBINTL/lib/libintl.a" ]; then
179
		echo "libintl libraries found in $LOCAL_LIBINTL/lib"
180
	else
181
		cd "$BASE_UL_DIR/$EXTERN_DIR"
182
		#download binaries
183
		rm -fR libintl
184
		$WGET_OR_CURL $WGET_OR_CURLOPT http://garr.dl.sourceforge.net/project/gnuwin32/libintl/0.14.4/libintl-0.14.4-lib.zip; unzip -o libintl-0.14.4-lib.zip -d libintl
185
		$WGET_OR_CURL $WGET_OR_CURLOPT http://switch.dl.sourceforge.net/project/gnuwin32/libintl/0.14.4/libintl-0.14.4-bin.zip; unzip -o libintl-0.14.4-bin.zip -d libintl
186
		rm -f libintl-0.14.4-bin.zip; rm -f libintl-0.14.4-lib.zip
187
		cd libintl
188
		mkdir -p $LOCAL_LIBINTL;
189
		mv bin $LOCAL_LIBINTL/; mv lib $LOCAL_LIBINTL/; mv include $LOCAL_LIBINTL/
190
		mv man $LOCAL_LIBINTL/; mv share $LOCAL_LIBINTL/
191
		
192
		# build from gettext sources
193
		#~ rm -fR gettext
194
		#~ rm -fR libintl
195
		#~ wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
196
		#~ tar zxvf gettext-0.18.1.1.tar.gz; mv gettext-0.18.1.1 gettext; cd gettext
197
		#~ ./configure ${HOSTARCH:+--host=$HOSTARCH} --with-libiconv-prefix=$LOCAL_LIBICONV
198
		#~ cd gettext-runtime/intl
199
		#~ make
200
		#~ mkdir -p $LOCAL_LIBINTL/bin; mkdir -p $LOCAL_LIBINTL/include; mkdir -p $LOCAL_LIBINTL/lib
201
		#~ cp ./.libs/*a $LOCAL_LIBINTL/lib
202
		#~ cp ./.libs/*.dll $LOCAL_LIBINTL/bin
203
		#~ cp *.h $LOCAL_LIBINTL/include
204
		#~ cd ../../../
205
		#~ rm -f gettext-0.18.1.1.tar.gz
206
		#~ rm -fR gettext
117 207
	fi
208
	LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBINTL"
209
	LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBINTL/lib"
210

  
211
	# check for mingw pthread libs
212
	LOCAL_PTHREAD="$BASE_UL_DIR/$EXTERN_DIR/pthreads"
213
	if [ -f "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthread.a" ]; then
214
		echo "libpthread.a in $LOCAL_PTHREAD/lib/"
215
	else
216
		cd "$BASE_UL_DIR/$EXTERN_DIR"
217
		rm -fR pthreads
218
		$WGET_OR_CURL $WGET_OR_CURLOPT http://www.mirrorservice.org/sites/sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz
219
		tar zxvf pthreads-w32-2-8-0-release.tar.gz; mv pthreads-w32-2-8-0-release pthreads; rm -f pthreads-w32-2-8-0-release.tar.gz;
220
		cd pthreads
221
		mkdir -p ./{include,lib,bin}
222
		make CROSS=i586-mingw32msvc- GC-inlined
223
		mv libpthreadGC2.a ./lib
224
		mv *.h ./include
225
		mv pthreadGC2.dll ./bin
226
		ln -s "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthreadGC2.a" "$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib/libpthread.a"
227
	fi
228
	LIBMICROHHTPD_FLAGS="$LIBMICROHHTPD_FLAGS -I$BASE_UL_DIR/$EXTERN_DIR/pthreads/include"
229
	LIBMICROHHTPD_LDFLAGS="$LIBMICROHHTPD_LDFLAGS -L$BASE_UL_DIR/$EXTERN_DIR/pthreads/lib"
118 230
fi
119 231

  
120
TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install"
232

  
233
#libpng
234
if [ -n "$MINGW" ]; then
235
	LOCAL_LIBPNG="$BASE_UL_DIR/$EXTERN_DIR/libpng/temp_libpng_install_mingw"
236
else
237
	LOCAL_LIBPNG="$BASE_UL_DIR/$EXTERN_DIR/libpng/temp_libpng_install_linux"
238
fi
239
if [ -f "$LOCAL_LIBPNG/lib/libpng.a" ]; then
240
	echo "libpng.a found in $LOCAL_LIBPNG/lib"
241
else
242
	cd "$BASE_UL_DIR/$EXTERN_DIR"
243
	rm -fR libpng
244
	$WGET_OR_CURL $WGET_OR_CURLOPT http://downloads.sourceforge.net/project/libpng/libpng14/older-releases/1.4.4/libpng-1.4.4.tar.gz
245
	tar zxvf libpng-1.4.4.tar.gz; rm -f libpng-1.4.4.tar.gz
246
	mv libpng-1.4.4 libpng; cd libpng;
247
	CFLAGS=-I$LOCAL_Z/include CPPFLAGS=-I$LOCAL_Z/include LDFLAGS=-L$LOCAL_Z/lib sh configure  ${HOSTARCH:+--host=$HOSTARCH} --prefix=$LOCAL_LIBPNG
248
	make
249
	make install
250
fi
251
LIBSDLIMAGE_FLAGS="$LIBSDLIMAGE_FLAGS -I$LOCAL_LIBPNG/include"
252
LIBSDLIMAGE_LDFLAGS="$LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBPNG/lib"
253

  
254

  
255
if [ -n "$MINGW" ]; then
256
	TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install_mingw"
257
else
258
	TEMP_X264="$BASE_UL_DIR/$EXTERN_DIR/x264/temp_x264_install_linux"
259
fi
121 260
if [ -n "$BUILD_X264" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_X264" ]; then
122 261
	cd "$BASE_UL_DIR/$EXTERN_DIR"
123
	rm -r -f x264
124
	#get and compile latest x264 library
125
	git clone git://git.videolan.org/x264.git
126
	cd x264
262
	if [ -e "x264" ]; then
263
		cd x264
264
		make clean
265
	else
266
		#get and compile latest x264 library
267
		if [ -n "$MAC_OS" ]; then
268
		   $WGET_OR_CURL $WGET_OR_CURLOPT ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20110115-2245.tar.bz2
269
		   tar yvfx x264-snapshot-20110115-2245.tar.bz2
270
		   rm -f x264-snapshot-20110115-2245.tar.bz2
271
		   mv x264-snapshot-20110115-2245/ x264
272
		else
273
		   git clone git://git.videolan.org/x264.git
274
		fi
275
		cd x264
276
	fi	
277

  
127 278
	#make and install in local folder
128
	./configure --prefix="$TEMP_X264"
279
	./configure --prefix="$TEMP_X264" ${HOSTARCH:+--host=$HOSTARCH}
129 280
	$MAKE; $MAKE install
130 281
fi
131 282

  
132
TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install"
283

  
284
if [ -n "$MINGW" ]; then
285
	TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install_mingw"
286
else
287
	TEMP_MP3LAME="$BASE_UL_DIR/$EXTERN_DIR/mp3lame/temp_mp3lame_install_linux"
288
fi
133 289
if [ -n "$BUILD_MP3LAME" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MP3LAME" ]; then
134 290
	cd "$BASE_UL_DIR/$EXTERN_DIR"
135
	rm -r -f mp3lame
136
	#get and compile latest mp3lame library
137
	rm -f lame-3.98.4.tar.gz
138
	wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download -O lame-3.98.4.tar.gz; tar xzf lame-3.98.4.tar.gz; mv lame-3.98.4 mp3lame;
139
	cd mp3lame
291
	
292
	if [ -e "mp3lame" ]; then
293
		cd mp3lame
294
		make clean
295
	else
296
		#get and compile latest mp3lame library
297
		rm -f lame-3.98.4.tar.gz
298
		$WGET_OR_CURL $WGET_OR_CURLOPT http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download; tar xzf download; rm -f download; mv lame-3.98.4 mp3lame;
299
		cd mp3lame
300
	fi	
301

  
140 302
	#make and install in local folder
141
	./configure --disable-gtktest --disable-frontend --prefix="$TEMP_MP3LAME"
303
	./configure --disable-gtktest --disable-frontend --prefix="$TEMP_MP3LAME" ${HOSTARCH:+--host=$HOSTARCH}
142 304
	$MAKE; $MAKE install
143 305
fi
144 306

  
145
TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install"
307

  
308
if [ -n "$MINGW" ]; then
309
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_mingw"
310
else
311
	TEMP_FFMPEG="$BASE_UL_DIR/$EXTERN_DIR/ffmpeg/temp_ffmpeg_install_linux"
312
fi
146 313
if [ ! -e "$TEMP_X264/lib/libx264.a" ] || [ ! -e "$TEMP_MP3LAME/lib/libmp3lame.a" ] || [ ! -e "$LOCAL_Z/lib/libz.a" ] || [ ! -e "$LOCAL_BZ2/lib/libbz2.a" ]; then
147 314
	echo "Compilation of ffmpeg dependancies failed. Check your internet connection and errors. Exiting."
148 315
fi
149 316
if [ -n "$BUILD_FFMPEG" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FFMPEG" ]; then
150 317
	cd "$BASE_UL_DIR/$EXTERN_DIR"
151
	rm -r -f ffmpeg
152
	#get and compile ffmpeg with x264 support
153
	#get latest snapshot
154
	#rm -f ffmpeg-checkout-snapshot.tar.bz2
155
	#wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg
156
	#do not get latest snapshot
157
	#get a release tarball instead
158
	rm -f ffmpeg-0.6.tar.bz2
159
	wget http://ffmpeg.org/releases/ffmpeg-0.6.tar.bz2; tar xjf ffmpeg-0.6.tar.bz2; mv ffmpeg-0.6 ffmpeg
160
	#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
161
	#do not get latest snapshot
162
	#get instead a specific one because allows output video rate resampling
163
	#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
164
	cd ffmpeg
165
	./configure --enable-gpl --enable-nonfree --enable-version3 --enable-libmp3lame --enable-libx264 --enable-pthreads --extra-cflags="-I../x264/temp_x264_install/include -I../mp3lame/temp_mp3lame_install/include -I$LOCAL_BZ2/include  -I$LOCAL_Z/include" --extra-ldflags="-L../x264/temp_x264_install/lib -L../mp3lame/temp_mp3lame_install/lib -L$LOCAL_BZ2/lib -L$LOCAL_Z/lib" --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --prefix="$TEMP_FFMPEG"
318
	
319
	if [ -e "ffmpeg" ]; then
320
		cd ffmpeg
321
		make clean
322
	else
323
		#get and compile ffmpeg with x264 support
324
		#get latest snapshot
325
		#rm -f ffmpeg-checkout-snapshot.tar.bz2
326
		#wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg
327
		#do not get latest snapshot
328
		#get a release tarball instead
329
		rm -f ffmpeg-0.6.tar.bz2
330
		$WGET_OR_CURL $WGET_OR_CURLOPT http://ffmpeg.org/releases/ffmpeg-0.6.tar.bz2; tar xjf ffmpeg-0.6.tar.bz2; rm -f ffmpeg-0.6.tar.bz2; mv ffmpeg-0.6 ffmpeg
331
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
332
		#do not get latest snapshot
333
		#get instead a specific one because allows output video rate resampling
334
		#svn -r 21010 checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
335
		cd ffmpeg
336
	fi	
337

  
338
	if [ -n "$MINGW" ]; then
339
		HOSTARCH_OLDSTYLE=${HOSTARCH:+--arch=i586 --enable-cross-compile --cross-prefix=i586-mingw32msvc- --target-os=$HOSTARCH --disable-sse}
340
	
341
		#configure bugfix
342
		sed -i -e 's/^SDL_CONFIG=/[ -z "$SDL_CONFIG" ] \&\& SDL_CONFIG=/g' ./configure;
343
		sed -i -e 's/check_cflags \+-Werror=missing-prototypes/#\0/g' configure;
344
	
345
		./configure $HOSTARCH_OLDSTYLE --enable-gpl --enable-nonfree --enable-version3 --enable-libmp3lame --enable-libx264 --disable-pthreads --extra-cflags="-I$TEMP_X264/include -I$TEMP_MP3LAME/include -I$LOCAL_BZ2/include  -I$LOCAL_Z/include" --extra-ldflags="-L$TEMP_X264/lib -L$TEMP_MP3LAME/lib -L$LOCAL_BZ2/lib -L$LOCAL_Z/lib" --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --prefix="$TEMP_FFMPEG"
346
	else
347
		./configure --enable-gpl --enable-nonfree --enable-version3 --enable-libmp3lame --enable-libx264 --enable-pthreads --extra-cflags="-I$TEMP_X264/include -I$TEMP_MP3LAME/include -I$LOCAL_BZ2/include  -I$LOCAL_Z/include" --extra-ldflags="-L$TEMP_X264/lib -L$TEMP_MP3LAME/lib -L$LOCAL_BZ2/lib -L$LOCAL_Z/lib" --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --prefix="$TEMP_FFMPEG"
348
	fi
166 349
	$MAKE; $MAKE install
167 350
fi
168 351

  
169
TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install"
352

  
353
if [ -n "$MINGW" ]; then
354
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_mingw"
355
else
356
	TEMP_MHD="$BASE_UL_DIR/$EXTERN_DIR/libmicrohttpd/temp_mhd_install_linux"
357
fi
170 358
if [ -n "$BUILD_MHD" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_MHD" ]; then
171 359
	cd "$BASE_UL_DIR/$EXTERN_DIR"
172
	rm -r -f libmicrohttpd
173
	#get and compile libmicrohttpd lib
174
	svn --non-interactive checkout https://ng.gnunet.org/svn/libmicrohttpd
175
	cd libmicrohttpd
360
	
361
	if [ -e "libmicrohttpd" ]; then
362
		cd libmicrohttpd
363
		make clean
364
	else
365
		#get and compile libmicrohttpd lib
366
		svn --non-interactive --trust-server-cert checkout https://ng.gnunet.org/svn/libmicrohttpd
367
		cd libmicrohttpd
368
	fi
369
	
176 370
	autoreconf -fi
177
	./configure --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
371
	if [ -n "$MINGW" ]; then
372
		CFLAGS="$CFLAGS $LIBMICROHHTPD_FLAGS" CPPFLAGS="$CPPFLAGS $LIBMICROHHTPD_FLAGS" LDFLAGS="$LDFLAGS $LIBMICROHHTPD_LDFLAGS" ./configure ${HOSTARCH:+--host=$HOSTARCH} --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
373
	else
374
		./configure --disable-curl --disable-https --enable-messages --disable-client-side --prefix="$TEMP_MHD"
375
	fi
178 376
	$MAKE; $MAKE install
179 377
fi
180 378

  
181
TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install"
379

  
380
if [ -n "$MINGW" ]; then
381
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl_mingw/temp_sdl_install"
382
else
383
	TEMP_SDL="$BASE_UL_DIR/$EXTERN_DIR/sdl/temp_sdl_install_linux"
384
fi
182 385
if [ -n "$BUILD_SDL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL" ]; then
183 386
	cd "$BASE_UL_DIR/$EXTERN_DIR"
184
	rm -r -r sdl
185
	#get and compile SDL lib
186
	rm -f SDL-1.2.14.tar.gz
187
	wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz; tar xzf SDL-1.2.14.tar.gz; mv SDL-1.2.14 sdl
188
	cd sdl
189
	#make and install in local folder
190
	./configure --disable-video-directfb --prefix="$TEMP_SDL"
191
	$MAKE; $MAKE install
387

  
388
	if [ -n "$MINGW" ]; then
389
		if [ ! -e "sdl_mingw" ]; then
390
			# use binaries
391
			$WGET_OR_CURL $WGET_OR_CURLOPT http://www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz; tar zxvf SDL-devel-1.2.14-mingw32.tar.gz; mv SDL-1.2.14 sdl_mingw;
392
			rm -f SDL-devel-1.2.14-mingw32.tar.gz;
393
			cd sdl_mingw
394
			mkdir temp_sdl_install
395
			mv bin $TEMP_SDL/; mv lib $TEMP_SDL/; mv include $TEMP_SDL/; mv share $TEMP_SDL/
396
		fi
397

  
398
		# build from sources
399
		#~ wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz; tar xzf SDL-1.2.14.tar.gz; rm -f SDL-1.2.14.tar.gz; mv SDL-1.2.14 sdl
400
		#make and install in local folder
401
		#~ ./configure ${HOSTARCH:+--host=$HOSTARCH} --disable-video-directfb --prefix="$TEMP_SDL"
402
		#~ $MAKE; $MAKE install
403
	else
404
		if [ -e "sdl" ]; then
405
			cd sdl
406
			make clean
407
		else
408
			#get and compile SDL lib
409
			$WGET_OR_CURL $WGET_OR_CURLOPT http://www.libsdl.org/release/SDL-1.2.14.tar.gz; tar xzf SDL-1.2.14.tar.gz; mv SDL-1.2.14 sdl; rm -f SDL-1.2.14.tar.gz
410
			cd sdl
411
		fi
412
		#make and install in local folder
413
		./configure --disable-video-directfb --prefix="$TEMP_SDL"
414
		$MAKE; $MAKE install
415
	fi
192 416
fi
193 417

  
194 418
if [ -n "$BUILD_SDLIMAGE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_image.a" ]; then
195 419
	cd "$BASE_UL_DIR/$EXTERN_DIR"
196
	rm -r -r sdlimage
197
	#get and compile SDLIMAGE lib
198
	rm -f SDL_image-1.2.10.tar.gz
199
	wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz; tar xzf SDL_image-1.2.10.tar.gz; mv SDL_image-1.2.10 sdlimage
200
	cd sdlimage
420
	
421
	if [ -e "sdlimage" ]; then
422
		cd sdlimage
423
		make clean
424
	else
425
		#get and compile SDLIMAGE lib
426
		$WGET_OR_CURL $WGET_OR_CURLOPT http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.10.tar.gz; tar xzf SDL_image-1.2.10.tar.gz; mv SDL_image-1.2.10 sdlimage
427
		rm -f SDL_image-1.2.10.tar.gz
428
		cd sdlimage
429
	fi
430
	
201 431
	#make and install in local SDL folder
202
	./configure --prefix="$TEMP_SDL"
432
        ./autogen.sh
433
	echo "./configure LIBPNG_CFLAGS=\"-I$LOCAL_LIBPNG/include\" LIBPNG_LIBS=\"-L$LOCAL_LIBPNG/lib\" CFLAGS=\"$CFLAGS $LIBSDLIMAGE_FLAGS -static\" CPPFLAGS=\"$CPPFLAGS $LIBSDLIMAGE_FLAGS -static\" LDFLAGS=\"$LDFLAGS $LIBSDLIMAGE_LDFLAGS -static\" ${HOSTARCH:+--host=$HOSTARCH} --prefix=\"$TEMP_SDL\" --with-sdl-prefix=\"$TEMP_SDL\" --disable-png-shared"
434

  
435
	echo "./configure CFLAGS=\"$CFLAGS -I$LOCAL_LIBPNG/include\" CPPFLAGS=\"$CPPFLAGS -I$LOCAL_LIBPNG/include\" LDFLAGS=\"$LDFLAGS -L$LOCAL_LIBPNG/lib\" ${HOSTARCH:+--host=$HOSTARCH} --prefix=\"$TEMP_SDL\" --with-sdl-prefix=\"$TEMP_SDL\" --disable-png-shared"
436

  
437
	./configure CFLAGS="$CFLAGS $LIBSDLIMAGE_FLAGS -I$LOCAL_LIBPNG/include" CPPFLAGS="$CPPFLAGS -I$LOCAL_LIBPNG/include" LDFLAGS="$LDFLAGS $LIBSDLIMAGE_LDFLAGS -L$LOCAL_LIBPNG/lib" ${HOSTARCH:+--host=$HOSTARCH} --prefix="$TEMP_SDL" --with-sdl-prefix="$TEMP_SDL" --disable-png-shared
438

  
203 439
	$MAKE; $MAKE install
204 440
fi
205 441

  
206 442
# SDL_ttf depends on freetype
207
TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install"
443
if [ -n "$MINGW" ]; then
444
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_mingw"
445
else
446
	TEMP_FREETYPE="$BASE_UL_DIR/$EXTERN_DIR/freetype/temp_freetype_install_linux"
447
fi
208 448
if [ -n "$BUILD_FREETYPE" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_FREETYPE" ]; then
209 449
	cd "$BASE_UL_DIR/$EXTERN_DIR"
210
	rm -r -r freetype
211
	#get and compile SDLTTF lib
212
	rm -f freetype-2.1.10.tar.gz
213
	wget http://mirror.lihnidos.org/GNU/savannah/freetype/freetype-2.1.10.tar.gz; tar xzf freetype-2.1.10.tar.gz; mv freetype-2.1.10 freetype
214
	cd freetype
450
	if [ -e "freetype" ]; then
451
		cd freetype
452
		make clean
453
	else
454
		#get and compile SDLTTF lib
455
		rm -f freetype-2.1.10.tar.gz
456
		$WGET_OR_CURL $WGET_OR_CURLOPT http://mirror.lihnidos.org/GNU/savannah/freetype/freetype-2.1.10.tar.gz; tar xzf freetype-2.1.10.tar.gz; rm -f freetype-2.1.10.tar.gz; mv freetype-2.1.10 freetype
457
		cd freetype
458
	fi
459

  
215 460
	#make and install in local folder
216
	./configure --prefix="$TEMP_FREETYPE"
461
	./configure ${HOSTARCH:+--host=$HOSTARCH} --prefix="$TEMP_FREETYPE"
217 462
	$MAKE; $MAKE install
218 463
fi
219 464

  
220 465
if [ -n "$BUILD_SDLTTF" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_SDL/lib/libSDL_ttf.a" ]; then
221 466
	cd "$BASE_UL_DIR/$EXTERN_DIR"
222
	rm -r -r sdlttf
223
	#get and compile SDLTTF lib
224
	rm -f SDL_ttf-2.0.10.tar.gz
225
	wget http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.10.tar.gz; tar xzf SDL_ttf-2.0.10.tar.gz; mv SDL_ttf-2.0.10 sdlttf
226
	cd sdlttf
467
	
468
	if [ -e "sdlttf" ]; then
469
		cd sdlttf
470
		make clean
471
	else
472
		#get and compile SDLTTF lib
473
		rm -f SDL_ttf-2.0.10.tar.gz
474
		$WGET_OR_CURL $WGET_OR_CURLOPT http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.10.tar.gz; tar xzf SDL_ttf-2.0.10.tar.gz; rm -f SDL_ttf-2.0.10.tar.gz; mv SDL_ttf-2.0.10 sdlttf
475
		cd sdlttf
476
	fi
477

  
227 478
	#make and install in local SDL folder
228
	./configure --with-freetype-prefix="$TEMP_FREETYPE" --with-sdl-prefix="$TEMP_SDL" --prefix="$TEMP_SDL"
479
	./configure ${HOSTARCH:+--host=$HOSTARCH} --with-freetype-prefix="$TEMP_FREETYPE" --with-sdl-prefix="$TEMP_SDL" --prefix="$TEMP_SDL"
229 480
	$MAKE; $MAKE install
230 481
fi
231 482

  
232
TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install"
483
if [ -n "$MINGW" ]; then
484
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_mingw"
485
else
486
	TEMP_CURL="$BASE_UL_DIR/$EXTERN_DIR/curl/temp_curl_install_linux"
487
fi
233 488
if [ -n "$BUILD_CURL" ] || [ -n "$BUILD_ALL" -a ! -e "$TEMP_CURL" ]; then
234 489
	cd "$BASE_UL_DIR/$EXTERN_DIR"
235
	rm -r -r curl
236
	#get and compile CURL lib
237
	rm -f curl-7.21.0.tar.bz2
238
	wget http://curl.haxx.se/download/curl-7.21.0.tar.bz2; tar xjf curl-7.21.0.tar.bz2; mv curl-7.21.0 curl
239
	cd curl
490
	if [ -e "curl" ]; then
491
		cd curl
492
		make clean
493
	else
494
		#get and compile CURL lib
495
		rm -f curl-7.21.0.tar.bz2
496
		$WGET_OR_CURL $WGET_OR_CURLOPT http://curl.haxx.se/download/curl-7.21.0.tar.bz2; tar xjf curl-7.21.0.tar.bz2; rm -f curl-7.21.0.tar.bz2; mv curl-7.21.0 curl
497
		cd curl
498
	fi
499

  
240 500
	#make and install in local folder
241
	./configure --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --without-libssh2 --without-ssl --without-krb4 --enable-static --disable-shared --without-zlib --without-libidn --prefix="$TEMP_CURL"
501
	./configure ${HOSTARCH:+--host=$HOSTARCH} --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --without-libssh2 --without-ssl --without-krb4 --enable-static --disable-shared --without-zlib --without-libidn --prefix="$TEMP_CURL"
242 502
	$MAKE; $MAKE install
243 503
fi
244 504

  
505
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent" ]; then
506
	LOCAL_EVENT="$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent"
507
	echo "found LIBEVENT in $LOCAL_EVENT"
508
else
509
	LOCAL_EVENT_A=`locate -l 1 libevent.a`
510
	if [ "$LOCAL_EVENT_A" = "" ]; then
511
		if [ -f "/usr/lib/libevent.a" ]; then
512
			echo "You have file libevent.a in default system"
513
			echo "setting path for it to default /usr/lib/libevent.a"
514
			LOCAL_EVENT="/usr"
515
		else
516
			echo "you seem not to have file libevent.a. EXITING."
517
			exit
518
		fi
519
	else
520
		LOCAL_EVENT=`dirname $LOCAL_EVENT_A`/..
521
	fi
522
fi
523

  
524
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse" ]; then
525
	LOCAL_CONFUSE="$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse"
526
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
527
else
528
	LOCAL_CONFUSE_A=`locate -l 1 libconfuse.a`
529
	if [ "$LOCAL_CONFUSE_A" = "" ]; then
530
		if [ -f "/usr/lib/libconfuse.a" ]; then
531
			echo "You have file libconfuse.a in default system"
532
			echo "setting path for it to default /usr/lib/libconfuse.a"
533
			LOCAL_CONFUSE="/usr"
534
		else
535
			echo "you seem not to have file libconfuse.a. EXITING."
536
			exit
537
		fi
538
	else
539
		LOCAL_CONFUSE=`dirname $LOCAL_CONFUSE_A`/..
540
	fi
541
fi
542

  
245 543
#set needed paths to external libraries
246 544
echo "-----"
247 545
LOCAL_X264=$TEMP_X264
......
265 563

  
266 564
echo "path for BZ2 dependancy is set to $LOCAL_BZ2"
267 565
echo "path for ZLIB dependancy is set to $LOCAL_Z"
566

  
567
echo "path for LIBEVENT dependancy is set to $LOCAL_EVENT"
568
echo "path for LIBCONFUSE dependancy is set to $LOCAL_CONFUSE"
268 569
echo "-----"
269 570

  
270 571
#compile the UL external applications
271 572
#chunker_streamer and chunker_player
272
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse" ]; then
273
	LOCAL_CONFUSE="$BASE_UL_DIR/../../3RDPARTY-LIBS/libconfuse"
274
	echo "found LIBCONFUSE in $LOCAL_CONFUSE"
275
else
276
	LOCAL_CONFUSE_A=`locate -l 1 libconfuse.a`
277
	if [ "$LOCAL_CONFUSE_A" = "" ]; then
278
		if [ -f "/usr/lib/libconfuse.a" ]; then
279
			echo "You have file libconfuse.a in default system"
280
			echo "setting path for it to default /usr/lib/libconfuse.a"
281
			LOCAL_CONFUSE="/usr"
282
		else
283
			echo "you seem not to have file libconfuse.a. EXITING."
284
			exit
285
		fi
286
	else
287
		LOCAL_CONFUSE=`dirname $LOCAL_CONFUSE_A`/..
288
	fi
289
fi
290 573

  
291 574
#CHUNKER_STREAMER
292
echo "----------------COMPILING CHUNKER STREAMER"
293
cd "$BASE_UL_DIR"
294
cd chunker_streamer
295
$MAKE clean
296
LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_CURL=$LOCAL_CURL $MAKE
297
echo "----------------FINISHED COMPILING CHUNKER STREAMER"
575

  
576
# streamer is not supported yet on windows
577
if [ ! -n "$MINGW" ]; then
578
	echo "----------------COMPILING CHUNKER STREAMER"
579
	cd "$BASE_UL_DIR"
580
	cd chunker_streamer
581
	$MAKE clean
582
	LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_CURL=$LOCAL_CURL IO=$IO MAC_OS=$MAC_OS $MAKE || { echo "Failed to build CHUNKER STREAMER"; exit 1; }
583
	echo "----------------FINISHED COMPILING CHUNKER STREAMER"
584
fi
298 585

  
299 586
#CHUNKER_PLAYER
300 587
echo "----------------COMPILING CHUNKER PLAYER"
301 588
cd "$BASE_UL_DIR"
302 589
cd chunker_player
303 590
$MAKE clean
304
LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_MHD=$LOCAL_MHD LOCAL_ABS_SDL=$LOCAL_ABS_SDL LOCAL_SDLIMAGE=$LOCAL_SDLIMAGE LOCAL_FREETYPE=$LOCAL_FREETYPE LOCAL_SDLTTF=$LOCAL_SDLTTF $MAKE
591
LOCAL_PTHREAD=$LOCAL_PTHREAD LOCAL_LIBPNG=$LOCAL_LIBPNG LOCAL_LIBICONV=$LOCAL_LIBICONV LOCAL_LIBINTL=$LOCAL_LIBINTL LOCAL_PLIBC=$LOCAL_PLIBC LOCAL_X264=$LOCAL_X264 LOCAL_MP3LAME=$LOCAL_MP3LAME LOCAL_FFMPEG=$LOCAL_FFMPEG LOCAL_BZ2=$LOCAL_BZ2 LOCAL_Z=$LOCAL_Z LOCAL_CONFUSE=$LOCAL_CONFUSE LOCAL_MHD=$LOCAL_MHD LOCAL_ABS_SDL=$LOCAL_ABS_SDL LOCAL_SDLIMAGE=$LOCAL_SDLIMAGE LOCAL_FREETYPE=$LOCAL_FREETYPE LOCAL_SDLTTF=$LOCAL_SDLTTF IO=$IO MAC_OS=$MAC_OS  $MAKE || { echo "Failed to build CHUNKER PLAYER" ; exit 1; }
305 592
echo "----------------FINISHED COMPILING CHUNKER PLAYER"
306 593

  
307
#compile a version of offerstreamer with UL enabled
594
#compile a version of winestreamer with UL enabled
308 595
#static needs fix??
309
cd "$BASE_UL_DIR/../OfferStreamer"
310
if [ -d "$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent" ]; then
311
	LOCAL_EVENT="$BASE_UL_DIR/../../3RDPARTY-LIBS/libevent"
312
	echo "found LIBEVENT in $LOCAL_EVENT"
313
else
314
	LOCAL_EVENT_A=`locate -l 1 libevent.a`
315
	if [ "$LOCAL_EVENT_A" = "" ]; then
316
		if [ -f "/usr/lib/libevent.a" ]; then
317
			echo "You have file libevent.a in default system"
318
			echo "setting path for it to default /usr/lib/libevent.a"
319
			LOCAL_EVENT="/usr"
320
		else
321
			echo "you seem not to have file libevent.a. EXITING."
322
			exit
323
		fi
324
	else
325
		LOCAL_EVENT=`dirname $LOCAL_EVENT_A`/..
326
	fi
327
fi
596
cd "$BASE_UL_DIR/../Streamer"
597

  
328 598
$MAKE IO=$IO clean
329
ULPLAYER=$BASE_UL_DIR ULPLAYER_EXTERNAL_LIBS=$EXTERN_DIR LIBEVENT_DIR=$LOCAL_EVENT ML=$ML STATIC=$STATIC MONL=$MONL IO=$IO DEBUG=$DEBUG THREADS=$THREADS $MAKE
599
#LOCAL_MHD=$LOCAL_MHD LOCAL_CURL=$LOCAL_CURL ULPLAYER=$BASE_UL_DIR ULPLAYER_EXTERNAL_LIBS=$EXTERN_DIR LIBEVENT_DIR=$LOCAL_EVENT ML=$ML STATIC=$STATIC MONL=$MONL IO=$IO DEBUG=$DEBUG THREADS=$THREADS MAC_OS=$MAC_OS SVNVERSION=$SVNVERSION $MAKE || { echo "Failed to build WineStreamer" ; exit 1; }
600
LOCAL_CURL=$LOCAL_CURL LIBEVENT_DIR=$LOCAL_EVENT ML=$ML STATIC=$STATIC MONL=$MONL ALTO=$ALTO IO=$IO DEBUG=$DEBUG THREADS=$THREADS MAC_OS=$MAC_OS SVNVERSION=$SVNVERSION $MAKE || { echo "Failed to build WineStreamer" ; exit 1; }
330 601

  
331 602
#check if all is ok
332 603
echo "============== RESULTS ==================="
333 604

  
334
cd "$BASE_UL_DIR/chunker_streamer"
335
if [ -f "chunker_streamer" ]; then
336
	echo "chunker_streamer OK"
337
	C_STREAMER_EXE=`ls -la chunker_streamer`
338
	echo "$C_STREAMER_EXE"
339
	#now we want the bare name
340
	C_STREAMER_EXE=`ls chunker_streamer`
341
else
342
	echo "chunker_streamer FAIL"
605
if [ ! -n "$MINGW" ]; then
606
	cd "$BASE_UL_DIR/chunker_streamer"
607
	if [ -f "chunker_streamer" ]; then
608
		echo "chunker_streamer OK"
609
		C_STREAMER_EXE=`ls -la chunker_streamer`
610
		echo "$C_STREAMER_EXE"
611
		#now we want the bare name
612
		C_STREAMER_EXE=`ls chunker_streamer`
613
	else
614
		echo "chunker_streamer FAIL"
615
	fi
343 616
fi
344 617

  
345 618
cd "$BASE_UL_DIR/chunker_player"
346
if [ -f "chunker_player" ]; then
619
if [ -n "$MINGW" ]; then
620
	SUFFIX=".exe"
621
	SCRIPT_SUFFIX=".bat"
622
else
623
	SUFFIX=""
624
	SCRIPT_SUFFIX=".sh"
625
fi
626
if [ -f "chunker_player$SUFFIX" ]; then
347 627
	echo "chunker_player OK"
348
	C_PLAYER_EXE=`ls -la chunker_player`
628
	C_PLAYER_EXE=`ls -la chunker_player$SUFFIX`
349 629
	echo "$C_PLAYER_EXE"
350 630
	#now we want the bare name
351
	C_PLAYER_EXE=`ls chunker_player`
631
	C_PLAYER_EXE=`ls chunker_player$SUFFIX`
352 632
else
353 633
	echo "chunker_player FAIL"
354 634
fi
355 635

  
356
cd "$BASE_UL_DIR/../OfferStreamer"
357
echo "Check if the http binary is among these offerstreamers:"
358
ls -la offerstreamer* | grep -v ".o$"
359
echo "Your UL-enabled offerstreamer should be..."
360
O_TARGET_EXE=`ls offerstreamer* | grep -v ".o$" | grep $IO`
636
cd "$BASE_UL_DIR/../Streamer"
637
echo "Check if the http binary is among these winestreamers:"
638
ls -la winestreamer* | grep -v ".o$"
639
echo "Your UL-enabled winestreamer has these flags:"
640
if [ -n "$ALTO" ]; then
641
	GREP_ALTO_EXPR="-alto"
642
	GREP_ALTO_FLAGS=""
643
	echo "ALTO: enabled"
644
else
645
	GREP_ALTO_EXPR="-alto"
646
	GREP_ALTO_FLAGS="-v"
647
	echo "ALTO: disabled"
648
fi
649
if [ "$STATIC" = "1" ]; then
650
	GREP_STATIC_EXPR="-halfstatic"
651
	GREP_STATIC_FLAGS=""
652
	echo "STATIC: halfstatic"
653
elif [ "$STATIC" = "2" ]; then
654
	GREP_STATIC_EXPR="-static"
655
	GREP_STATIC_FLAGS=""
656
	echo "STATIC: static"
657
else
658
	GREP_STATIC_EXPR="static"
659
	GREP_STATIC_FLAGS="-v"
660
	echo "STATIC: dynamic"
661
fi
662
echo "IO: $IO"
663
IO="-"$IO
664
echo "Hence your UL-enabled winestreamer should be..."
665
O_TARGET_EXE=`ls winestreamer* | grep -v ".o$" | grep $GREP_STATIC_FLAGS -e "$GREP_STATIC_EXPR" | grep $GREP_ALTO_FLAGS -e "$GREP_ALTO_EXPR" | grep -e "$IO"`
666
#O_TARGET_EXE=`ls winestreamer* | grep -v ".o$" | grep -e "$IO"`
361 667
echo "$O_TARGET_EXE"
362 668
if [ -f "$O_TARGET_EXE" ]; then
363 669
	echo "...and i found it."
......
365 671
	echo "...but sadly it appears build FAILED!."
366 672
fi
367 673

  
674
#creating conf file with executable name inside
675
cd "$BASE_UL_DIR/chunker_player"
676
echo "$O_TARGET_EXE" > peer_exec_name.conf
677

  
368 678
#packaging for distribution
369 679
cd "$BASE_UL_DIR/chunker_player"
370
if [ -f "$BASE_UL_DIR/../OfferStreamer/$O_TARGET_EXE" -a -f "$C_PLAYER_EXE" ]; then
680
if [ -f "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" -a -f "$C_PLAYER_EXE" ]; then
371 681
	echo "============== PACKAGING NAPAPLAYER ==================="
372 682
	rm -f -r napaplayer
373
	rm -f -r napaplayer.tar.gz
374 683
	mkdir napaplayer
375 684
	mkdir napaplayer/icons
376 685
	cp icons/* napaplayer/icons/
377 686
	cp channels.conf napaplayer/
687
	cp peer_exec_name.conf napaplayer/
688
	cp runme$SCRIPT_SUFFIX napaplayer/
378 689
	cp README napaplayer/
379 690
	cp napalogo*.bmp napaplayer/
380 691
	cp *.ttf napaplayer/
381 692
	cp "$C_PLAYER_EXE" napaplayer/
382
	cp "$BASE_UL_DIR/../OfferStreamer/$O_TARGET_EXE" napaplayer/
383
	cd napaplayer/
384
	ln -s "$O_TARGET_EXE" ./offerstreamer
385
	cd ..
386
	tar cvfz napaplayer.tar.gz napaplayer
387
	if [ -s "napaplayer.tar.gz" ]; then
388
		#it has size>0. OK!
389
		echo "Here is your napaplayer tarball. Enjoy!"
390
		ls -la napaplayer.tar.gz
693
	if [ -n "$MINGW" ]; then
694
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
695
	else
696
		cp "$BASE_UL_DIR/../Streamer/$O_TARGET_EXE" napaplayer/
697
	fi
698
	if [ -n "$MINGW" ]; then
699
		cp "$LOCAL_LIBICONV/bin/libiconv-2.dll" napaplayer/libiconv2.dll
700
		if [ -f "$LOCAL_LIBINTL/bin/libintl-8.dll" ]; then
701
			cp "$LOCAL_LIBINTL/bin/libintl-8.dll" napaplayer/
702
		else
703
			cp "$LOCAL_LIBINTL/bin/libintl3.dll" napaplayer/libintl-8.dll
704
		fi
705
		cp "$LOCAL_PLIBC/bin/libplibc-1.dll" napaplayer/
706
		cp "$LOCAL_PTHREAD/bin/pthreadGC2.dll" napaplayer/
707
		cp "$LOCAL_ABS_SDL/bin/SDL.dll" napaplayer/
708
		rm -f -r napaplayer.zip
709
		zip -r napaplayer napaplayer
710
		if [ -s "napaplayer.zip" ]; then
711
			#it has size>0. OK!
712
			echo "Here it is your napaplayer package. Enjoy!"
713
			ls -la napaplayer.zip
714
		else
715
			echo "Sorry something went wrong during packaging napaplayer."
716
		fi
391 717
	else
392
		echo "Sorry something went wrong during packaging napaplayer."
718
		rm -f -r napaplayer.tar.gz
719
		tar cvfz napaplayer.tar.gz napaplayer
720
		if [ -s "napaplayer.tar.gz" ]; then
721
			#it has size>0. OK!
722
			echo "Here it is your napaplayer tarball. Enjoy!"
723
			ls -la napaplayer.tar.gz
724
		else
725
			echo "Sorry something went wrong during packaging napaplayer."
726
		fi
393 727
	fi
394 728
else
395 729
	echo ""
chunk_transcoding/external_chunk_transcoding.c
1 1
#include <string.h>
2 2
#include <stdint.h>
3 3
#include <stdio.h>
4
#include <arpa/inet.h>
5 4

  
6 5
#include "external_chunk_transcoding.h"
7 6

  
chunker_player/Makefile
1 1
include ../common.mak
2 2

  
3
ifdef WINDOWS
4
OUTPUTFILE = chunker_player.exe
5
else
6
OUTPUTFILE = chunker_player
7
endif
8

  
9
ifeq ($(IO), httpevent)
10
CPPFLAGS += -DHTTPIO
11
endif
12

  
13
ifeq ($(IO), tcp)
14
CPPFLAGS += -DTCPIO
15
endif
16

  
3 17
#SDL config here
4
#LOCAL_SDL_CPPFLAGS = $(shell $(LOCAL_ABS_SDL)/bin/sdl-config --cflags;)
5
#LOCAL_SDL_LDFLAGS = $(shell $(LOCAL_ABS_SDL)/bin/sdl-config --static-libs;)
6 18
LOCAL_SDL_CPPFLAGS = -I$(LOCAL_ABS_SDL)/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
7
#LOCAL_SDL_LDFLAGS = -L$(LOCAL_ABS_SDL)/lib -Wl,-rpath,$(LOCAL_ABS_SDL)/lib
8
LOCAL_SDL_LDFLAGS = -Wl,-rpath,$(LOCAL_ABS_SDL)/lib
9
LOCAL_SDL_LDLIBS = $(LOCAL_ABS_SDL)/lib/libSDL.a -ldl
19
ifdef MAC_OS
20
#force static linking to .a SDL libraries
21
LOCAL_SDL_LDFLAGS =  -framework OpenGL $(LOCAL_ABS_SDL)/lib/libSDLmain.a $(LOCAL_ABS_SDL)/lib/libSDL.a  -Wl,-framework,Cocoa -Wl,-framework,ApplicationServices -Wl,-framework,Carbon -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,IOKit
22
else
23
LOCAL_SDL_LDFLAGS = -L$(LOCAL_ABS_SDL)/lib  
24
endif
25
ifndef WINDOWS
26
ifdef MAC_OS
27
LOCAL_SDL_LDLIBS =
28
else
29
LOCAL_SDL_LDLIBS = $(LOCAL_ABS_SDL)/lib/libSDL.a  -ldl $(LOCAL_ABS_SDL)/lib/libSDLmain.a
30
endif
31
endif
10 32

  
11 33
LOCAL_SDLIMAGE_CPPFLAGS = -I$(LOCAL_SDLIMAGE)/include/SDL
12
#LOCAL_SDLIMAGE_LDFLAGS = -L$(LOCAL_SDLIMAGE)/lib
13
LOCAL_SDLIMAGE_LDLIBS = $(LOCAL_SDLIMAGE)/lib/libSDL_image.a
34
ifdef WINDOWS
35
LOCAL_SDLIMAGE_LDLIBS = $(LOCAL_SDLIMAGE)/lib/libSDL_image.a $(LOCAL_LIBPNG)/lib/libpng.a $(LOCAL_LIBINTL)/lib/libintl.*.a $(LOCAL_LIBICONV)/lib/libiconv.a
36
else
37
LOCAL_SDLIMAGE_LDLIBS = $(LOCAL_SDLIMAGE)/lib/libSDL_image.a $(LOCAL_LIBPNG)/lib/libpng.a
38
endif
14 39

  
15
#LOCAL_FREETYPE_CPPFLAGS = $(shell $(LOCAL_FREETYPE)/bin/freetype-config --cflags;)
16
#LOCAL_FREETYPE_LDFLAGS = $(shell $(LOCAL_FREETYPE)/bin/freetype-config --libs;)
17 40
LOCAL_FREETYPE_CPPFLAGS = -I$(LOCAL_FREETYPE)/include/ -I$(LOCAL_FREETYPE)/include/freetype2
18
#LOCAL_FREETYPE_LDFLAGS = -L$(LOCAL_FREETYPE)/lib -Wl,--rpath -Wl,$(LOCAL_FREETYPE)/lib
19
LOCAL_FREETYPE_LDFLAGS = -Wl,--rpath -Wl,$(LOCAL_FREETYPE)/lib
41
LOCAL_FREETYPE_LDFLAGS = -Wl,-rpath -Wl,$(LOCAL_FREETYPE)/lib
42
#LOCAL_FREETYPE_LDFLAGS = -Wl,$(LOCAL_FREETYPE)/lib
20 43
LOCAL_FREETYPE_LDLIBS = $(LOCAL_FREETYPE)/lib/libfreetype.a
21 44

  
22 45
LOCAL_SDLTTF_CPPFLAGS = -I$(LOCAL_SDLTTF)/include/SDL
23
#LOCAL_SDLTTF_LDFLAGS = -L$(LOCAL_SDLTTF)/lib
24 46
LOCAL_SDLTTF_LDLIBS = $(LOCAL_SDLTTF)/lib/libSDL_ttf.a
25 47

  
26 48
#microhttpd config here
27
#LOCAL_MHD_CPPFLAGS = -I$(LOCAL_MHD) -I$(LOCAL_MHD)/src/daemon -I$(LOCAL_MHD)/src/include
28
#LOCAL_MHD_LDFLAGS = -L$(LOCAL_MHD)/src/daemon
29
#LOCAL_MHD_LDLIBS = -lmicrohttpd
30
#LOCAL_MHD_LDLIBS = $(LOCAL_MHD)/src/daemon/.libs/libmicrohttpd.a
31 49
LOCAL_MHD_CPPFLAGS = -I$(LOCAL_MHD)/include
32
#LOCAL_MHD_LDFLAGS = -L$(LOCAL_MHD)/lib
50
ifdef WINDOWS
51
LOCAL_MHD_LDLIBS = $(LOCAL_MHD)/lib/libmicrohttpd.a $(LOCAL_PLIBC)/lib/libplibc.dll.a $(LOCAL_PTHREAD)/lib/libpthread.a
52
else
33 53
LOCAL_MHD_LDLIBS = $(LOCAL_MHD)/lib/libmicrohttpd.a
54
endif
34 55

  
35 56
LOCAL_CONFUSE_CPPFLAGS = -I$(LOCAL_CONFUSE)/include
36 57
LOCAL_CONFUSE_LDLIBS = $(LOCAL_CONFUSE)/lib/libconfuse.a
......
48 69
LDLIBS += $(LOCAL_MHD_LDLIBS) $(LOCAL_CONFUSE_LDLIBS) $(LOCAL_FREETYPE_LDLIBS)
49 70
LDLIBS += $(LOCAL_FFMPEG_LDLIBS) $(LOCAL_COMMON_LDLIBS)
50 71

  
72
ifdef WINDOWS
73
LDLIBS += $(DYNAMIC_LDLIBS) -lmingw32 $(LOCAL_ABS_SDL)/lib/libSDLmain.a $(LOCAL_ABS_SDL)/lib/libSDL.dll.a -lwinmm -lgdi32
74
else
51 75
LDLIBS += $(DYNAMIC_LDLIBS)
76
endif
77

  
78
LINKER = $(CC)
79

  
80
all: $(OUTPUTFILE)
81

  
82
OBJS = ../chunk_transcoding/external_chunk_transcoding.o
83
ifeq ($(IO), httpevent)
84
OBJS += http_chunk_puller.o
85
endif
52 86

  
53
all: chunker_player
87
ifeq ($(IO), tcp)
88
OBJS += tcp_chunk_puller.o
89
endif
90
OBJS += chunker_player.o QoE_Estimator.o player_stats.o player_core.o player_gui.o
54 91

  
55
chunker_player: ../chunk_transcoding/external_chunk_transcoding.o chunk_puller.o chunker_player.o player_core.o player_gui.o
92
$(OUTPUTFILE): $(OBJS)
93
	$(LINKER) $(LDFLAGS) $^ $(LDLIBS) -o $@
56 94

  
57 95
clean:
58
	rm -f chunker_player
96
	rm -f $(OUTPUTFILE)
59 97
	rm -f *.o
chunker_player/QoE_Estimator.c
1
/**
2
 Generated by Multiple Back-Propagation Version 2.2.2
3
 Multiple Back-Propagation can be freely obtained at http://dit.ipg.pt/MBP
4
*/
5

  
6
#include <math.h>
7
/**
8
 inputs  - should be an array of 3 element(s), containing the network input(s).
9
 outputs - should be an array of 1 element(s), that will contain the network output(s).
10
 Note : The array inputs will also be changed.Its values will be rescaled between -1 and 1.
11
*/
12
void QoE_Estimator(double * inputs, double * outputs) {
13
	double mainWeights[] = {-0.788223989025525, -0.094474566726867, 1.496739847656628, 1.763686040718159, -1.903030984102726, 0.642334326063278, -1.151808104642765, 0.195778993761345, -2.438147799676302, -0.593447767630059, 0.602159330161696, 1.841888272109078, -1.668291515410757, 1.132531695902347, 1.770256249167634, -1.543624462297342, -0.300179501200067, 0.218045746602884, 0.549917901597161, -0.420158477741495, 0.165459965494116, 0.626640712066218, -0.317482940512069, -0.165924553270408, -3.316089679297547, 0.901781718110168, -2.227550874229060, -0.468212813041442, -0.254505118375575, 1.753316060915204, -0.471577244624611, 0.276860328465251, -8.533724138983054, -7.815997751844567, 0.062513227206194, -0.028703413820191, -0.355241766960234, -1.014473189203496, 0.239401342551138, -0.891442488512514, 0.040038287080412, 1.014695308785556, 1.716301939415027, -1.836208299980111, -2.218906644053716, -0.002026100423785, 0.325609116530568, 2.762985101033591, 1.081971585914914, -6.798320012264649, -0.435605988610366};
14
	double * mw = mainWeights;
15
	double hiddenLayer1outputs[10];
16
	int c;
17

  
18
	inputs[0] = -1.0 + (inputs[0] - 128.000000000000000) / 1436.000000000000000;
19
	inputs[1] = -1.0 + (inputs[1] - 0.000000000000000) / 10.000000000000000;
20
	inputs[2] = -1.0 + (inputs[2] - 0.000000000000000) / 5.000000000000000;
21
	hiddenLayer1outputs[0] = *mw++;
22
	for(c = 0; c < 3; c++) hiddenLayer1outputs[0] += *mw++ * inputs[c];
23
	hiddenLayer1outputs[0] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[0]));
24
	hiddenLayer1outputs[1] = *mw++;
25
	for(c = 0; c < 3; c++) hiddenLayer1outputs[1] += *mw++ * inputs[c];
26
	hiddenLayer1outputs[1] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[1]));
27
	hiddenLayer1outputs[2] = *mw++;
28
	for(c = 0; c < 3; c++) hiddenLayer1outputs[2] += *mw++ * inputs[c];
29
	hiddenLayer1outputs[2] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[2]));
30
	hiddenLayer1outputs[3] = *mw++;
31
	for(c = 0; c < 3; c++) hiddenLayer1outputs[3] += *mw++ * inputs[c];
32
	hiddenLayer1outputs[3] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[3]));
33
	hiddenLayer1outputs[4] = *mw++;
34
	for(c = 0; c < 3; c++) hiddenLayer1outputs[4] += *mw++ * inputs[c];
35
	hiddenLayer1outputs[4] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[4]));
36
	hiddenLayer1outputs[5] = *mw++;
37
	for(c = 0; c < 3; c++) hiddenLayer1outputs[5] += *mw++ * inputs[c];
38
	hiddenLayer1outputs[5] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[5]));
39
	hiddenLayer1outputs[6] = *mw++;
40
	for(c = 0; c < 3; c++) hiddenLayer1outputs[6] += *mw++ * inputs[c];
41
	hiddenLayer1outputs[6] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[6]));
42
	hiddenLayer1outputs[7] = *mw++;
43
	for(c = 0; c < 3; c++) hiddenLayer1outputs[7] += *mw++ * inputs[c];
44
	hiddenLayer1outputs[7] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[7]));
45
	hiddenLayer1outputs[8] = *mw++;
46
	for(c = 0; c < 3; c++) hiddenLayer1outputs[8] += *mw++ * inputs[c];
47
	hiddenLayer1outputs[8] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[8]));
48
	hiddenLayer1outputs[9] = *mw++;
49
	for(c = 0; c < 3; c++) hiddenLayer1outputs[9] += *mw++ * inputs[c];
50
	hiddenLayer1outputs[9] = 1.0 / (1.0 + exp(-hiddenLayer1outputs[9]));
51
	outputs[0] = *mw++;
52
	for(c = 0; c < 10; c++) outputs[0] += *mw++ * hiddenLayer1outputs[c];
53
	outputs[0] = 1.0 / (1.0 + exp(-outputs[0]));
54
	outputs[0] = 28.546600000000002 + (outputs[0] - 0.000000) * 16.112199999999998;
55
}
chunker_player/README
1 1
This is the test package for the Napa-Wine player.
2
You can download the lates version of this player from
3
http://www.napa-wine.eu/~napawine/napabot/
2
You can download the latest version of this player from
3
http://www.napa-wine.eu/
4 4

  
5
Download and uncompress the tar.gz archive
6

  
7
tar xvfz napaplayer.tar.gz
8

  
9
get into the napaplayer folder
10

  
11
cd napaplayer
12

  
13
If you run the chunker_player executable without parameters, it will print
14
a brief list of accepted input parameters:
15

  
16
queue_thresh
17
httpd_port
18
silentMode
19
LossTracesFilenameSuffix
20
ChannelName
21
<YUVFilename>
22

  
23
Parameters have to be issued on the command line in the correct order.
24
Example run:
25
./chunker_player 30 45454 0 losses.txt UL_BBC_Torino
26

  
27

  
28
Explanation of parameters.
29
1st parameter: queue_thresh: size of the playout buffer in number of frames, i.e. 40.
30

  
31
2nd parameter: httpd_port: the player receives chunks from the offerstreamer
32
peer through this http port.
33

  
34
3rd parameter: silentMode: it can be 0 or 1. One means run in silent mode, that is
35
without graphical interface, so that multiple players can be run, provided you
36
give different port numbers, and statistics can be collected also. This way the
37
player can also be run remotely via ssh.
38

  
39
4th parameter: LossTracesFilenameSuffix: if you give for example losses.txt as a
40
value, the two files video_losses.txt and audio_losses.txt will be created.
41
These trace files record the sequence number of all lost frames as seen from
42
the player point of view.
43

  
44
5th parameter: ChannelName: the name of the channel/swarm to tune in. See the
45
channels.conf file for configuring the channels, and a list of available channels.
46

  
47
6th parameter: <YUVFilename>: this parameter is optional. If you give it, a
48
YUV file will be created with the received video, as it is played. This is a raw
49
uncompressed sequence of frames, and it can get very big.
50

  
51
The player takes care of spawning the peer client with the correct parameters,
52
and of killing it on channel switch. The offerstreamer parameters can be fine
53
tuned via the channels.conf file, by editing the LaunchString of each channel.
54
Beware that -C, -P, -and F offerstreamer parameters are added dynamically and
55
must not be issued inside the LaunchString.
5
simply unzip/untar the package and run the provided
6
runme.bat ir runme.sh script.
chunker_player/_chunklossrate.conf
1

  
2
ScheduledChunkLoss
3
{
4
Time = 0
5
Value = 5
6
Burstiness = 2
7
}
8

  
chunker_player/channels.conf
1
PeerExecName = "offerstreamer"
2

  
3 1
Channel TN-TV1
4 2
{
5 3
	LaunchString = "-c 5 -b 200 -o 200 -i 193.205.213.229 -p 6666 -n repo_address=193.205.213.37:9832"
......
8 6
	Width = 704
9 7
	Height = 576
10 8
	Ratio = 1.22
9
	Bitrate = 512000
11 10
}
12 11

  
13
Channel TN-TV3
12
Channel TV1_NAPA_BBC_ALTO
14 13
{
15
	LaunchString = "-c 5 -b 200 -o 200 -i 130.192.86.31 -p 6666 -n repo_address=193.205.213.37:9832"
14
	LaunchString = "-c 1 -b 100 -o 100 -i 195.116.53.121 -p 6100 -n repo_address=194.29.178.9:9832,publish_interval=10"
15
	AudioChannels = 2
16
	SampleRate = 48000
17
	Width = 720
18
	Height = 530
19
	Ratio = 1.36
20
	Bitrate = 1000000
21
}
22

  
23
Channel TV2_NAPA_RebelTV_noALTO
24
{
25
	LaunchString = "-c 1 -b 100 -o 100 -i 195.116.53.121 -p 6101 -n repo_address=194.29.178.9:9832,publish_interval=10"
26
	AudioChannels = 2
27
	SampleRate = 48000
28
	Width = 720
29
	Height = 530
30
	Ratio = 1.36
31
	Bitrate = 1000000
32
}
33

  
34
Channel TV3_NAPA_Orange_noALTO
35
{
36
	LaunchString = "-c 5 -b 100 -o 100 -i 195.116.53.121 -p 6102 -n repo_address=194.29.178.9:9832,publish_interval=10"
16 37
	AudioChannels = 2
17 38
	SampleRate = 48000
18 39
	Width = 704
19 40
	Height = 576
20
	Ratio = 1.22
41
	Ratio = 1.46
42
	Bitrate = 2000000
21 43
}
22 44

  
23
Channel CT_Local_TV
45
Channel NAPA-WINE_workshop
24 46
{
25
	LaunchString = "-c 5 -b 200 -o 200 -i 127.0.0.1 -p 6666 -I lo -n repo_address=193.205.213.37:9832"
47
	LaunchString = "-c 5 -b 100 -o 100 -i 130.192.42.40 -p 6109 -n repo_address=194.29.178.9:9832,publish_interval=30"
26 48
	AudioChannels = 2
27 49
	SampleRate = 48000
28
	Width = 704
50
	Width = 720
29 51
	Height = 576
30
	Ratio = 1
52
	Ratio = 1.33
53
	Bitrate = 1500000
31 54
}
chunker_player/chunk_puller.c
7 7
#include <memory.h>
8 8
#include <sys/types.h>
9 9
#include <sys/time.h>
10
#include <sys/socket.h>
11
#include <sys/select.h>
12
#include <arpa/inet.h>
13
#include <netinet/in.h>
14 10
#include <microhttpd.h>
15 11

  
16 12
struct connection_info_struct {
chunker_player/chunker_player.c
8 8
#include "player_defines.h"
9 9
#include "chunker_player.h"
10 10
#include "player_gui.h"
11
#include <time.h>
12
#include <getopt.h>
13

  
14
#define MANDATORY_PARAMS 3
15
#define OPTIONAL_PARAMS 1
16

  
17
#ifdef WIN32
18
#include <windows.h>
19
#endif
20

  
21
void sigproc()
22
{
23
	printf("you have pressed ctrl-c, terminating...\n");
24
	quit = 1;
25
}
26

  
27
static void print_usage(int argc, char *argv[])
28
{
29
  fprintf (stderr,
30
    "\nUsage:%s [options]\n"
31
    "\n"
32
    "Mandatory options:\n"
33
    "\t[-q q_thresh]: playout queue size\n"
34
    "\t[-c ChannelName]: channel name (from channels.conf)\n"
35
    "\t[-p port]: player http port\n\n"
36
    "Other options:\n"
37
    "\t[-t]: log traces (WARNING: old traces will be deleted).\n"
38
    "\t[-s mode]: silent mode (mode=1 no user gui and no audio, mode=2 audio only, mode=3 only gui and no P2P).\n\n"
39
    "=======================================================\n", argv[0]
40
    );
41
}
11 42

  
12 43
int main(int argc, char *argv[])
13 44
{
45
	srand ( time(NULL) );
14 46
	// some initializations
15 47
	SilentMode = 0;
16 48
	queue_filling_threshold = 0;
17
	SaveYUV = 0;
18 49
	quit = 0;
19 50
	QueueFillingMode=1;
20
	P2PProcessID = -1;
51
	LogTraces = 0;
52

  
53
#ifndef __WIN32__
54
	static pid_t fork_pid = -1;
55
	P2PProcessHandle=&fork_pid;
56
#else
57
	static PROCESS_INFORMATION ProcessInfo;
58
	ZeroMemory( &ProcessInfo, sizeof(ProcessInfo) );
59
	P2PProcessHandle=&ProcessInfo;
60
#endif
61

  
21 62
	NChannels = 0;
22 63
	SelectedChannel = -1;
23 64
	char firstChannelName[255];
......
25 66
	
26 67
	memset((void*)Channels, 0, (MAX_CHANNELS_NUM*sizeof(SChannel)));
27 68

  
69
#ifdef HTTPIO
28 70
	HttpPort = -1;
71
#endif
72
#ifdef TCPIO
73
	TcpPort = -1;
74
#endif
29 75
	struct MHD_Daemon *daemon = NULL;
30 76
	SDL_Event event;
31 77
	OverlayMutex = SDL_CreateMutex();
32

  
33
	FILE *fp;
34
		
35
	if(argc<6) {
36
		printf("chunker_player queue_thresh httpd_port silentMode LossTracesFilenameSuffix ChannelName <YUVFilename>\n");
37
		exit(1);
38
	}
39
	sscanf(argv[1],"%d",&queue_filling_threshold);
40
	sscanf(argv[2],"%d",&HttpPort);
41
	sscanf(argv[3],"%d",&SilentMode);
42
	sscanf(argv[4],"%s",LossTracesFilename);
43
	sscanf(argv[5],"%s",firstChannelName);
78
	int mandatories = 0;
44 79
	
45
	if(argc==7)
80
	char c;
81
	while ((c = getopt (argc, argv, "q:c:p:s:t")) != -1)
46 82
	{
47
		sscanf(argv[6],"%s",YUVFileName);
48
		printf("YUVFile: %s\n",YUVFileName);
49
		fp=fopen(YUVFileName, "wb");
50
		if(fp)
51
		{
52
			SaveYUV=1;
53
			fclose(fp);
83
		switch (c) {
84
			case 0: //for long options
85
				break;
86
			case 'q':
87
				sscanf(optarg, "%d", &queue_filling_threshold);
88
				mandatories++;
89
				break;
90
			case 'c':
91
				sprintf(firstChannelName, "%s", optarg);
92
				mandatories++;
93
				break;
94
			case 'p':
95
#ifdef HTTPIO
96
				sscanf(optarg, "%d", &HttpPort);
97
#endif
98
#ifdef TCPIO
99
				sscanf(optarg, "%d", &TcpPort);
100
#endif
101
				mandatories++;
102
				break;
103
			case 's':
104
				sscanf(optarg, "%d", &SilentMode);
105
				break;
106
			case 't':
107
				DELETE_DIR("traces");
108
				CREATE_DIR("traces");
109
				LogTraces = 1;
110
				break;
111
			default:
112
				print_usage(argc, argv);
113
				return -1;
54 114
		}
55
		else
56
			printf("ERROR: Unable to create YUVFile\n");
57 115
	}
58
	
59
	char filename[255];
60
	sprintf(filename, "audio_%s", LossTracesFilename);
61
	fp=fopen(filename, "wb");
62
	if(fp)
116
	if(mandatories < MANDATORY_PARAMS)
63 117
	{
64
		fclose(fp);
65
		sprintf(filename, "video_%s", LossTracesFilename);
66
		fp=fopen(filename, "wb");
67
		if(fp)
68
			fclose(fp);
69
		else
70
		{
71
			printf("ERROR: Unable to create loss trace files\n");
72
			exit(1);
73
		}
118
		print_usage(argc, argv);
119
		return -1;
74 120
	}
75
	else
121

  
122
#ifdef EMULATE_CHUNK_LOSS
123
	ScheduledChunkLosses = NULL;
124
	cfg_opt_t scheduled_chunk_loss_opts[] =
76 125
	{
77
		printf("ERROR: Unable to create loss trace files\n");
78
		exit(1);
126
		CFG_INT("Time", 0, CFGF_NONE),
127
		CFG_INT("Value", 0, CFGF_NONE),
128
		CFG_INT("MinValue", 0, CFGF_NONE),
129
		CFG_INT("MaxValue", 0, CFGF_NONE),
130
		CFG_INT("Burstiness", 0, CFGF_NONE),
131
		CFG_END()
132
	};
133
	cfg_opt_t opts[] =
134
	{
135
		CFG_SEC("ScheduledChunkLoss", scheduled_chunk_loss_opts, CFGF_MULTI),
136
		CFG_END()
137
	};
138
	cfg_t *cfg, *cfg_sched;
139
	cfg = cfg_init(opts, CFGF_NONE);
140
	if(!cfg_parse(cfg, "_chunklossrate.conf") == CFG_PARSE_ERROR)
141
	{
142
		NScheduledChunkLosses = cfg_size(cfg, "ScheduledChunkLoss");
143
		if(NScheduledChunkLosses > 0)
144
			ScheduledChunkLosses = (SChunkLoss*)malloc((NScheduledChunkLosses)*sizeof(SChunkLoss));
145
		
146
		int j;
147
		for(j = 0; j < cfg_size(cfg, "ScheduledChunkLoss"); j++)
148
		{
149
			cfg_sched = cfg_getnsec(cfg, "ScheduledChunkLoss", j);
150
			ScheduledChunkLosses[j].Time = cfg_getint(cfg_sched, "Time");
151
			ScheduledChunkLosses[j].Value = cfg_getint(cfg_sched, "Value");
152
			ScheduledChunkLosses[j].Burstiness = cfg_getint(cfg_sched, "Burstiness");
153
			
154
			// -1 means random value between min and max
155
			if(ScheduledChunkLosses[j].Value == -1)
156
			{
157
				ScheduledChunkLosses[j].MinValue = cfg_getint(cfg_sched, "MinValue");
158
				ScheduledChunkLosses[j].MaxValue = cfg_getint(cfg_sched, "MaxValue");
159
			}
160
		}
161
		cfg_free(cfg);
162
		CurrChunkLossIndex = -1;
163
		
164
		for(j=0; j < NScheduledChunkLosses; j++)
165
		{
166
			printf("ScheduledChunkLosses[%d].Time = %ld\n", j, ScheduledChunkLosses[j].Time);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff