]>
Commit | Line | Data |
---|---|---|
1 | # TODO | |
2 | # - libnut enabled no (http://www.nut-container.org/) | |
3 | # | |
4 | # Conditional build: | |
5 | %bcond_with amr # 3GPP Adaptive Multi Rate (AMR) codec support; makes package non-distributable | |
6 | %bcond_without autoreqdep # don't care about package name deps generated by rpm | |
7 | %bcond_without imlib2 # don't build imlib2 vhook module | |
8 | # | |
9 | %define _snap 2009-02-25 | |
10 | %define snap %(echo %{_snap} | tr -d -) | |
11 | %define rel 1 | |
12 | Summary: Realtime audio/video encoder and streaming server | |
13 | Summary(pl.UTF-8): Koder audio/wideo czasu rzeczywistego oraz serwer strumieni | |
14 | Name: ffmpeg | |
15 | Version: 0.4.9 | |
16 | Release: 4.%{snap}.%{rel} | |
17 | # LGPL or GPL, chosen at configure time (GPL version is more featured) | |
18 | # (postprocessing, ac3, xvid, x264, faad) | |
19 | License: GPL v2+ with LGPL v2.1+ parts | |
20 | Group: Applications/Multimedia | |
21 | #Source0: http://dl.sourceforge.net/ffmpeg/%{name}-%{version}-pre1.tar.gz | |
22 | Source0: http://ffmpeg.mplayerhq.hu/%{name}-export-snapshot.tar.bz2 | |
23 | # Source0-md5: a7649aa1c597ba9bd0e92e42e1a56494 | |
24 | Source1: ffserver.init | |
25 | Source2: ffserver.sysconfig | |
26 | Source3: ffserver.conf | |
27 | Patch0: %{name}-x264.patch | |
28 | URL: http://ffmpeg.mplayerhq.hu/ | |
29 | BuildRequires: SDL-devel | |
30 | %if %{with amr} | |
31 | BuildRequires: amrnb-devel >= 6.1.0.4 | |
32 | BuildRequires: amrwb-devel >= 7.0.0.1 | |
33 | %endif | |
34 | BuildRequires: dirac-devel >= 1.0.0 | |
35 | BuildRequires: faac-devel | |
36 | BuildRequires: faad2-devel | |
37 | BuildRequires: freetype-devel | |
38 | %ifarch ppc | |
39 | # require version with altivec support fixed | |
40 | BuildRequires: gcc >= 5:3.3.2-3 | |
41 | %endif | |
42 | %{?with_imlib2:BuildRequires: imlib2-devel >= 1.3.0} | |
43 | BuildRequires: lame-libs-devel | |
44 | BuildRequires: libdc1394-devel | |
45 | BuildRequires: libgsm-devel | |
46 | BuildRequires: libraw1394-devel | |
47 | BuildRequires: speex-devel | |
48 | BuildRequires: libtheora-devel >= 1.0-0.beta3 | |
49 | BuildRequires: libtool >= 2:1.4d-3 | |
50 | BuildRequires: libvorbis-devel | |
51 | BuildRequires: libx264-devel >= 0.1.2-1.20081023 | |
52 | %ifarch %{ix86} | |
53 | %ifnarch i386 i486 | |
54 | BuildRequires: nasm | |
55 | %endif | |
56 | %endif | |
57 | BuildRequires: perl-tools-pod | |
58 | BuildRequires: pkgconfig | |
59 | BuildRequires: rpmbuild(macros) >= 1.470 | |
60 | BuildRequires: schroedinger-devel | |
61 | BuildRequires: tetex | |
62 | BuildRequires: texinfo | |
63 | %{?with_amr:BuildRequires: unzip} | |
64 | BuildRequires: xvid-devel >= 1:1.1.0 | |
65 | BuildRequires: zlib-devel | |
66 | %{?with_autoreqdep:BuildConflicts: libpostproc} | |
67 | Requires: %{name}-libs = %{version}-%{release} | |
68 | Requires: xvid >= 1:1.1.0 | |
69 | Obsoletes: libpostproc | |
70 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
71 | ||
72 | %define _noautoreqdep libGL.so.1 libGLU.so.1 | |
73 | ||
74 | %define specflags -fno-strict-aliasing | |
75 | ||
76 | # -fomit-frame-pointer is always needed on x86 due to lack of registers (-fPIC takes one) | |
77 | %define specflags_ia32 -fomit-frame-pointer | |
78 | # -mmmx is needed to enable <mmintrin.h> code. | |
79 | %define specflags_i586 -mmmx | |
80 | %define specflags_i686 -mmmx | |
81 | ||
82 | %description | |
83 | ffmpeg is a hyper fast realtime audio/video encoder and streaming | |
84 | server. It can grab from a standard Video4Linux video source and | |
85 | convert it into several file formats based on DCT/motion compensation | |
86 | encoding. Sound is compressed in MPEG audio layer 2 or using an AC3 | |
87 | compatible stream. | |
88 | ||
89 | %description -l pl.UTF-8 | |
90 | ffmpeg jest bardzo szybkim koderem audio/wideo w czasie rzeczywistym | |
91 | oraz serwerem strumieni multimedialnych. ffmpeg potrafi zrzucać dane | |
92 | ze standardowego urządzenia Video4Linux i przekonwertować je w kilka | |
93 | formatów plików bazujących na kodowaniu DCT/kompensacji ruchu. Dźwięk | |
94 | jest kompresowany do strumienia MPEG audio layer 2 lub używając | |
95 | strumienia kompatybilnego z AC3. | |
96 | ||
97 | %package libs | |
98 | Summary: ffmpeg libraries | |
99 | Summary(pl.UTF-8): Biblioteki ffmpeg | |
100 | Group: Libraries | |
101 | ||
102 | %description libs | |
103 | This package contains ffmpeg shared libraries. | |
104 | ||
105 | %description libs -l pl.UTF-8 | |
106 | Ten pakiet zawiera biblioteki współdzielone ffmpeg. | |
107 | ||
108 | %package devel | |
109 | Summary: ffmpeg header files | |
110 | Summary(pl.UTF-8): Pliki nagłówkowe ffmpeg | |
111 | Group: Development/Libraries | |
112 | Requires: %{name}-libs = %{version}-%{release} | |
113 | # for libavcodec: | |
114 | %if %{with amr} | |
115 | Requires: amrnb-devel | |
116 | Requires: amrwb-devel >= 5.3.0 | |
117 | %endif | |
118 | Requires: dirac-devel | |
119 | Requires: faac-devel | |
120 | Requires: faad2-devel | |
121 | Requires: lame-libs-devel | |
122 | Requires: libgsm-devel | |
123 | Requires: libraw1394-devel | |
124 | Requires: libtheora-devel >= 1.0-0.alpha7 | |
125 | Requires: libvorbis-devel | |
126 | Requires: libx264-devel >= 0.1.2-1.20060828_2245.1 | |
127 | Requires: xvid-devel >= 1:1.1.0 | |
128 | Requires: zlib-devel | |
129 | Obsoletes: libpostproc-devel | |
130 | ||
131 | %description devel | |
132 | ffmpeg header files. | |
133 | ||
134 | %description devel -l pl.UTF-8 | |
135 | Pliki nagłówkowe ffmpeg. | |
136 | ||
137 | %package static | |
138 | Summary: ffmpeg static libraries | |
139 | Summary(pl.UTF-8): Statyczne biblioteki ffmpeg | |
140 | Group: Development/Libraries | |
141 | Requires: %{name}-devel = %{version}-%{release} | |
142 | ||
143 | %description static | |
144 | ffmpeg static libraries (libavcodec and libavformat). | |
145 | ||
146 | %description static -l pl.UTF-8 | |
147 | Statyczne biblioteki ffmpeg (libavcodec i libavformat). | |
148 | ||
149 | %package ffplay | |
150 | Summary: FFplay - SDL-based media player | |
151 | Summary(pl.UTF-8): FFplay - odtwarzacz mediów oparty na SDL | |
152 | Group: Applications/Multimedia | |
153 | Requires: %{name}-libs = %{version}-%{release} | |
154 | ||
155 | %description ffplay | |
156 | FFplay is a very simple and portable media player using the FFmpeg | |
157 | libraries and the SDL library. It is mostly used as a test bench for | |
158 | the various APIs of FFmpeg. | |
159 | ||
160 | %description ffplay -l pl.UTF-8 | |
161 | FFplay to bardzo prosty i przenośny odtwarzacz mediów używający | |
162 | bibliotek FFmpeg oraz biblioteki SDL. Jest używany głównie do | |
163 | testowania różnych API FFmpeg. | |
164 | ||
165 | %package vhook-imlib2 | |
166 | Summary: imlib2 based hook | |
167 | Summary(pl.UTF-8): Moduł przejściowy oparty o imlib2 | |
168 | Group: Libraries | |
169 | Requires: %{name}-libs = %{version}-%{release} | |
170 | ||
171 | %description vhook-imlib2 | |
172 | This module implements a text overlay for a video image. Currently it | |
173 | supports a fixed overlay or reading the text from a file. The string | |
174 | is passed through strftime so that it is easy to imprint the date and | |
175 | time onto the image. | |
176 | ||
177 | %description vhook-imlib2 -l pl.UTF-8 | |
178 | Ten moduł implementuje tekstową nakładkę dla obrazu. Aktualnie | |
179 | obsługuje stałą nakładkę lub wczytywanie tekstu z pliku. Łańcuch jest | |
180 | przepuszczany przez strftime, więc łatwo umieścić datę i czas na | |
181 | obrazie. | |
182 | ||
183 | %package ffserver | |
184 | Summary: FFserver video server | |
185 | Summary(pl.UTF-8): FFserver - serwer strumieni obrazu | |
186 | Group: Daemons | |
187 | Requires(post,preun): /sbin/chkconfig | |
188 | Requires: %{name}-libs = %{version}-%{release} | |
189 | Requires: rc-scripts >= 0.4.0.10 | |
190 | ||
191 | %description ffserver | |
192 | FFserver is a streaming server for both audio and video. It supports | |
193 | several live feeds, streaming from files and time shifting on live | |
194 | feeds (you can seek to positions in the past on each live feed, | |
195 | provided you specify a big enough feed storage in ffserver.conf). | |
196 | ||
197 | %description ffserver -l pl.UTF-8 | |
198 | FFserver to serwer strumieni dla dźwięku i obrazu. Obsługuje kilka | |
199 | źródeł na żywo, przekazywanie strumieni z plików i przesuwanie w | |
200 | czasie dla źródeł na żywo (można przeskakiwać na położenia w | |
201 | przeszłości dla każdego źródła na żywo, pod warunkiem odpowiednio | |
202 | dużej przestrzeni na dane skonfigurowanej w ffserver.conf). | |
203 | ||
204 | %prep | |
205 | %setup -q -n %{name}-export-%{_snap} | |
206 | %patch0 -p1 | |
207 | ||
208 | # package the grep result for mplayer, the result formatted as ./mplayer/configure | |
209 | cat <<EOF > ffmpeg-avconfig | |
210 | #! /bin/sh | |
211 | _libavdecoders_all="`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`" | |
212 | _libavencoders_all="`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`" | |
213 | _libavparsers_all="`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`" | |
214 | _libavbsfs_all="`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`" | |
215 | _libavdemuxers_all="`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]'`" | |
216 | _libavmuxers_all="`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]'`" | |
217 | _libavprotocols_all="`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]'`" | |
218 | EOF | |
219 | cat <<'EOF' >> ffmpeg-avconfig | |
220 | ||
221 | case "$1" in | |
222 | --decoders) | |
223 | echo $_libavdecoders_all | |
224 | ;; | |
225 | --encoders) | |
226 | echo $_libavencoders_all | |
227 | ;; | |
228 | --parsers) | |
229 | echo $_libavparsers_all | |
230 | ;; | |
231 | --bsfs) | |
232 | echo $_libavbsfs_all | |
233 | ;; | |
234 | --demuxers) | |
235 | echo $_libavdemuxers_all | |
236 | ;; | |
237 | --muxers) | |
238 | echo $_libavmuxers_all | |
239 | ;; | |
240 | --protocols) | |
241 | echo $_libavprotocols_all | |
242 | ;; | |
243 | *) | |
244 | cat <<USAGE | |
245 | Usage: $0 [OPTION] | |
246 | Options: | |
247 | --decoders | |
248 | --encoders | |
249 | --parsers | |
250 | --bsfs | |
251 | --demuxers | |
252 | --muxers | |
253 | --protocols | |
254 | USAGE | |
255 | exit 1;; | |
256 | esac | |
257 | ||
258 | exit 0 | |
259 | EOF | |
260 | ||
261 | %build | |
262 | # notes: | |
263 | # - it's not autoconf configure | |
264 | # - --disable-debug, --disable-optimizations, tune=generic causes not to override our optflags | |
265 | ./configure \ | |
266 | --arch=%{_target_base_arch} \ | |
267 | --prefix=%{_prefix} \ | |
268 | --libdir=%{_libdir} \ | |
269 | --shlibdir=%{_libdir} \ | |
270 | --mandir=%{_mandir} \ | |
271 | --cc="%{__cc}" \ | |
272 | --extra-cflags="-D_GNU_SOURCE=1 %{rpmcppflags} %{rpmcflags} -I/usr/include/libavcodec -I/usr/include/libswscale" \ | |
273 | --extra-ldflags="%{rpmldflags}" \ | |
274 | --disable-debug \ | |
275 | --disable-optimizations \ | |
276 | --disable-stripping \ | |
277 | --enable-gpl \ | |
278 | --enable-libfaac \ | |
279 | --enable-libfaad \ | |
280 | --enable-libfaadbin \ | |
281 | --enable-libdc1394 \ | |
282 | --enable-libdirac \ | |
283 | --enable-libgsm \ | |
284 | --enable-libmp3lame \ | |
285 | --enable-libschroedinger \ | |
286 | --enable-libspeex \ | |
287 | --enable-libtheora \ | |
288 | --enable-libvorbis \ | |
289 | --enable-libx264 \ | |
290 | --enable-libxvid \ | |
291 | --enable-postproc \ | |
292 | --enable-pthreads \ | |
293 | --enable-shared \ | |
294 | --enable-swscale \ | |
295 | %ifnarch %{ix86} %{x8664} | |
296 | --disable-mmx \ | |
297 | %endif | |
298 | %ifarch i386 i486 | |
299 | --disable-mmx \ | |
300 | %endif | |
301 | %if %{with amr} | |
302 | --enable-nonfree \ | |
303 | --enable-libamr-nb \ | |
304 | --enable-libamr-wb | |
305 | %endif | |
306 | ||
307 | # force oldscaler build | |
308 | sed -i -e 's|#define.*CONFIG_OLDSCALER.*0|#define CONFIG_OLDSCALER 1|g' config.h | |
309 | ||
310 | %{__make} | |
311 | ||
312 | %install | |
313 | rm -rf $RPM_BUILD_ROOT | |
314 | install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_sbindir},/etc/{sysconfig,rc.d/init.d}} \ | |
315 | $RPM_BUILD_ROOT%{_includedir}/ffmpeg \ | |
316 | $RPM_BUILD_ROOT/var/{cache,log}/ffserver | |
317 | ||
318 | %{__make} install \ | |
319 | DESTDIR=$RPM_BUILD_ROOT | |
320 | ||
321 | cp -a config.h $RPM_BUILD_ROOT%{_includedir}/ffmpeg | |
322 | cp -a libavutil/intreadwrite.h $RPM_BUILD_ROOT%{_includedir}/libavutil | |
323 | cp -a libavutil/bswap.h $RPM_BUILD_ROOT%{_includedir}/libavutil | |
324 | cp -a libavutil/common.h $RPM_BUILD_ROOT%{_includedir}/libavutil | |
325 | cp -a libavutil/mem.h $RPM_BUILD_ROOT%{_includedir}/libavutil | |
326 | for a in libavutil/*/bswap.h; do | |
327 | install -D $a $RPM_BUILD_ROOT%{_includedir}/$a | |
328 | done | |
329 | cp -a libavformat/riff.h $RPM_BUILD_ROOT%{_includedir}/libavformat | |
330 | cp -a libavformat/avio.h $RPM_BUILD_ROOT%{_includedir}/libavformat | |
331 | ||
332 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ffserver | |
333 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ffserver | |
334 | install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/ffserver.conf | |
335 | mv -f $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/ffserver | |
336 | ||
337 | # install as ffmpeg-avconfig to avoid with possible programs looking for | |
338 | # ffmpeg-config and expecting --libs output from it which is not implemented | |
339 | # simple to do (by querying pkgconfig), but why? | |
340 | install ffmpeg-avconfig $RPM_BUILD_ROOT%{_bindir}/ffmpeg-avconfig | |
341 | ||
342 | %clean | |
343 | rm -rf $RPM_BUILD_ROOT | |
344 | ||
345 | %post libs -p /sbin/ldconfig | |
346 | %postun libs -p /sbin/ldconfig | |
347 | ||
348 | %pre ffserver | |
349 | %groupadd -g 167 ffserver | |
350 | %useradd -g ffserver -u 167 ffserver | |
351 | ||
352 | %post ffserver | |
353 | /sbin/chkconfig --add ffserver | |
354 | %service ffserver restart | |
355 | ||
356 | %preun ffserver | |
357 | if [ "$1" = 0 ]; then | |
358 | %service ffserver stop | |
359 | /sbin/chkconfig --del ffserver | |
360 | fi | |
361 | ||
362 | %postun ffserver | |
363 | if [ "$1" = 0 ]; then | |
364 | %userremove ffserver | |
365 | %groupremove ffserver | |
366 | fi | |
367 | ||
368 | %files | |
369 | %defattr(644,root,root,755) | |
370 | %doc Changelog README doc/*.html doc/TODO | |
371 | %attr(755,root,root) %{_bindir}/ffmpeg | |
372 | %dir %{_datadir}/ffmpeg | |
373 | %{_datadir}/ffmpeg/*.ffpreset | |
374 | %{_mandir}/man1/ffmpeg.1* | |
375 | ||
376 | %files libs | |
377 | %defattr(644,root,root,755) | |
378 | %attr(755,root,root) %{_libdir}/libavcodec.so.*.*.* | |
379 | %attr(755,root,root) %{_libdir}/libavdevice.so.*.*.* | |
380 | %attr(755,root,root) %{_libdir}/libavformat.so.*.*.* | |
381 | %attr(755,root,root) %{_libdir}/libavutil.so.*.*.* | |
382 | %attr(755,root,root) %{_libdir}/libpostproc.so.*.*.* | |
383 | %attr(755,root,root) %{_libdir}/libswscale.so.*.*.* | |
384 | %attr(755,root,root) %ghost %{_libdir}/libavcodec.so.[0-9][0-9] | |
385 | %attr(755,root,root) %ghost %{_libdir}/libavdevice.so.[0-9][0-9] | |
386 | %attr(755,root,root) %ghost %{_libdir}/libavformat.so.[0-9][0-9] | |
387 | %attr(755,root,root) %ghost %{_libdir}/libavutil.so.[0-9][0-9] | |
388 | %attr(755,root,root) %ghost %{_libdir}/libpostproc.so.[0-9][0-9] | |
389 | %attr(755,root,root) %ghost %{_libdir}/libswscale.so.[0-9] | |
390 | %dir %{_libdir}/vhook | |
391 | %attr(755,root,root) %{_libdir}/vhook/drawtext.so | |
392 | %attr(755,root,root) %{_libdir}/vhook/fish.so | |
393 | %attr(755,root,root) %{_libdir}/vhook/null.so | |
394 | %attr(755,root,root) %{_libdir}/vhook/ppm.so | |
395 | %attr(755,root,root) %{_libdir}/vhook/watermark.so | |
396 | ||
397 | %files devel | |
398 | %defattr(644,root,root,755) | |
399 | %doc doc/optimization.txt | |
400 | %attr(755,root,root) %{_libdir}/libavcodec.so | |
401 | %attr(755,root,root) %{_libdir}/libavdevice.so | |
402 | %attr(755,root,root) %{_libdir}/libavformat.so | |
403 | %attr(755,root,root) %{_libdir}/libavutil.so | |
404 | %attr(755,root,root) %{_libdir}/libpostproc.so | |
405 | %attr(755,root,root) %{_libdir}/libswscale.so | |
406 | %attr(755,root,root) %{_bindir}/ffmpeg-avconfig | |
407 | %{_includedir}/ffmpeg | |
408 | %{_includedir}/libavcodec | |
409 | %{_includedir}/libavdevice | |
410 | %{_includedir}/libavformat | |
411 | %{_includedir}/libavutil | |
412 | %{_includedir}/libpostproc | |
413 | %{_includedir}/libswscale | |
414 | %{_pkgconfigdir}/*.pc | |
415 | ||
416 | %files static | |
417 | %defattr(644,root,root,755) | |
418 | %{_libdir}/lib*.a | |
419 | ||
420 | %files ffplay | |
421 | %defattr(644,root,root,755) | |
422 | %attr(755,root,root) %{_bindir}/ffplay | |
423 | %{_mandir}/man1/ffplay.1* | |
424 | ||
425 | %if %{with imlib2} | |
426 | %files vhook-imlib2 | |
427 | %defattr(644,root,root,755) | |
428 | %attr(755,root,root) %{_libdir}/vhook/imlib2.so | |
429 | %endif | |
430 | ||
431 | %files ffserver | |
432 | %defattr(644,root,root,755) | |
433 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ffserver.conf | |
434 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ffserver | |
435 | %attr(755,root,root) %{_sbindir}/ffserver | |
436 | %attr(754,root,root) /etc/rc.d/init.d/ffserver | |
437 | %{_mandir}/man1/ffserver.1* | |
438 | %dir %attr(770,root,ffserver) /var/cache/ffserver | |
439 | %dir %attr(770,root,ffserver) /var/log/ffserver |