#
+# TODO: update for lzo 2.x (currently only lzo 1.x is supported)
+#
# Conditional build:
-# _without_imlib - we can safely play without it :-)
+%bcond_with amr # build 3GPP Adaptive Multi Rate (AMR) speech codec
+%bcond_without autoreqdep # don't care about package name deps generated by rpm
+%bcond_without imlib2 # don't build imlib2 vhook module
+%bcond_with lzo # build with LZO support
#
+%define _snap 2006-12-04
+%define snap %(echo %{_snap} | tr -d -)
+%define _rel 0.3
Summary: Realtime audio/video encoder and streaming server
Summary(pl): Koder audio/wideo czasu rzeczywistego oraz serwer strumieni
Name: ffmpeg
-Version: 0.4.8
-Release: 1
-License: LGPL/GPL
-Group: Daemons
-Source0: http://dl.sourceforge.net/ffmpeg/%{name}-%{version}.tar.gz
-# Source0-md5: e00d47614ba1afd99ad2ea387e782dd9
-Patch0: %{name}-opt.patch
-Patch1: %{name}-imlib2.patch
-Patch2: %{name}-libtool.patch
-URL: http://ffmpeg.sourceforge.net/
+Version: 0.4.9
+Release: 3.%{snap}.%{_rel}
+# LGPL or GPL, chosen at configure time (GPL version is more featured)
+# (postprocessing, a52, xvid, x264, dts, faad)
+License: GPL with LGPL parts
+Group: Applications/Multimedia
+#Source0: http://dl.sourceforge.net/ffmpeg/%{name}-%{version}-pre1.tar.gz
+#Source0: ftp://ftp2.mplayerhq.hu/MPlayer/cvs/FFMpeg-%{snap}.tar.bz2
+#Source0: %{name}-%{snap}.tar.bz2
+Source0: http://ffmpeg.mplayerhq.hu/%{name}-export-snapshot.tar.bz2
+# Source0-md5: 5be2e4d1e326bb7809205a3401204621
+Source1: ffserver.init
+Source2: ffserver.sysconfig
+Source3: ffserver.conf
+Patch0: %{name}-libtool.patch
+Patch1: %{name}-libdir.patch
+Patch2: %{name}-gcc4.patch
+Patch3: %{name}-system-amr.patch
+Patch4: %{name}-x264-symbol.patch
+Patch5: %{name}-as_needed.patch
+URL: http://ffmpeg.mplayerhq.hu/
BuildRequires: SDL-devel
+%if %{with amr}
+BuildRequires: amrnb-devel
+BuildRequires: amrwb-devel >= 5.3.0
+%endif
+BuildRequires: faac-devel
+BuildRequires: faad2-devel
BuildRequires: freetype-devel
-BuildRequires: libstdc++-devel
-%{!?_without_imlib:BuildRequires: imlib2-devel >= 1.1.0-2}
+%ifarch ppc
+# require version with altivec support fixed
+BuildRequires: gcc >= 5:3.3.2-3
+%endif
+%{?with_imlib2:BuildRequires: imlib2-devel >= 1.1.0-2}
+BuildRequires: lame-libs-devel
+BuildRequires: libdts-devel
+BuildRequires: libgsm-devel
+BuildRequires: libtheora-devel
BuildRequires: libtool >= 2:1.4d-3
-%ifarch i586 i686 athlon
+BuildRequires: libvorbis-devel
+BuildRequires: libx264-devel >= 0.1.2-1.20061024_2245.1
+#%{?with_lzo:BuildRequires: lzo-devel < 2.0}
+%ifarch %{ix86}
+%ifnarch i386 i486
BuildRequires: nasm
%endif
+%endif
+BuildRequires: perl-tools-pod
+BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: tetex
+BuildRequires: texinfo
+%{?with_amr:BuildRequires: unzip}
+BuildRequires: xvid-devel >= 1:1.1.0
BuildRequires: zlib-devel
+%{?with_autoreqdep:BuildConflicts: libpostproc}
+Requires: %{name}-libs = %{version}-%{release}
+Requires: xvid >= 1:1.1.0
+Obsoletes: libpostproc
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _noautoreqdep libGL.so.1 libGLU.so.1
+%define specflags -fno-strict-aliasing
+
+# -fomit-frame-pointer is always needed on x86 due to lack of registers (-fPIC takes one)
+%define specflags_ia32 -fomit-frame-pointer
+# -mmmx is needed to enable <mmintrin.h> code.
+%define specflags_i586 -mmmx
+%define specflags_i686 -mmmx
+
%description
ffmpeg is a hyper fast realtime audio/video encoder and streaming
server. It can grab from a standard Video4Linux video source and
encoding. Sound is compressed in MPEG audio layer 2 or using an AC3
compatible stream.
-This package contains also ffmpeg shared libraries (libavcodec and
-libavformat).
-
%description -l pl
ffmpeg jest bardzo szybkim koderem audio/wideo w czasie rzeczywistym
oraz serwerem strumieni multimedialnych. ffmpeg potrafi zrzucaæ dane
jest kompresowany do strumienia MPEG audio layer 2 lub u¿ywaj±c
strumienia kompatybilnego z AC3.
-Ten pakiet zawiera tak¿e biblioteki wspó³dzielone ffmpeg (libavcodec i
-libavformat).
+%package libs
+Summary: ffmpeg libraries
+Summary(pl): Biblioteki ffmpeg
+Group: Libraries
+
+%description libs
+This package contains ffmpeg shared libraries.
+
+%description libs -l pl
+Ten pakiet zawiera biblioteki wspó³dzielone ffmpeg.
+
+%package devel
+Summary: ffmpeg header files
+Summary(pl): Pliki nag³ówkowe ffmpeg
+Group: Development/Libraries
+Requires: %{name}-libs = %{version}-%{release}
+# for libavcodec:
+%if %{with amr}
+Requires: amrnb-devel
+Requires: amrwb-devel >= 5.3.0
+%endif
+Requires: faac-devel
+Requires: faad2-devel
+Requires: lame-libs-devel
+Requires: libdts-devel
+Requires: libgsm-devel
+Requires: libtheora-devel
+Requires: libvorbis-devel
+Requires: libx264-devel >= 0.1.2-1.20060828_2245.1
+#%{?with_lzo:Requires: lzo-devel < 2.0}
+Requires: xvid-devel >= 1:1.1.0
+Requires: zlib-devel
+Obsoletes: libpostproc-devel
+
+%description devel
+ffmpeg header files.
+
+%description devel -l pl
+Pliki nag³ówkowe ffmpeg.
+
+%package static
+Summary: ffmpeg static libraries
+Summary(pl): Statyczne biblioteki ffmpeg
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+ffmpeg static libraries (libavcodec and libavformat).
+
+%description static -l pl
+Statyczne biblioteki ffmpeg (libavcodec i libavformat).
%package ffplay
Summary: FFplay - SDL-based media player
Summary(pl): FFplay - odtwarzacz mediów oparty na SDL
Group: Applications/Multimedia
-Requires: %{name} = %{version}
+Requires: %{name}-libs = %{version}-%{release}
%description ffplay
FFplay is a very simple and portable media player using the FFmpeg
Summary: imlib2 based hook
Summary(pl): Modu³ przej¶ciowy oparty o imlib2
Group: Libraries
-Requires: %{name} = %{version}
+Requires: %{name}-libs = %{version}-%{release}
%description vhook-imlib2
This module implements a text overlay for a video image. Currently it
przepuszczany przez strftime, wiêc ³atwo umie¶ciæ datê i czas na
obrazie.
-%package devel
-Summary: ffmpeg header files
-Summary(pl): Pliki nag³ówkowe ffmpeg
-Group: Development/Libraries
-Requires: %{name} = %{version}
-
-%description devel
-ffmpeg header files.
-
-%description devel -l pl
-Pliki nag³ówkowe ffmpeg.
-
-%package static
-Summary: ffmpeg static libraries
-Summary(pl): Statyczne biblioteki ffmpeg
-Group: Development/Libraries
-Requires: %{name}-devel = %{version}
+%package ffserver
+Summary: FFserver video server
+Summary(pl): FFserver - serwer strumieni obrazu
+Group: Daemons
+Requires(post,preun): /sbin/chkconfig
+Requires: %{name}-libs = %{version}-%{release}
+Requires: rc-scripts >= 0.4.0.10
-%description static
-ffmpeg static libraries (libavcodec and libavformat).
+%description ffserver
+FFserver is a streaming server for both audio and video. It supports
+several live feeds, streaming from files and time shifting on live
+feeds (you can seek to positions in the past on each live feed,
+provided you specify a big enough feed storage in ffserver.conf).
-%description static -l pl
-Statyczne biblioteki ffmpeg (libavcodec i libavformat).
+%description ffserver -l pl
+FFserver to serwer strumieni dla d¼wiêku i obrazu. Obs³uguje kilka
+¼róde³ na ¿ywo, przekazywanie strumieni z plików i przesuwanie w
+czasie dla ¼róde³ na ¿ywo (mo¿na przeskakiwaæ na po³o¿enia w
+przesz³o¶ci dla ka¿dego ¼ród³a na ¿ywo, pod warunkiem odpowiednio
+du¿ej przestrzeni na dane skonfigurowanej w ffserver.conf).
%prep
-%setup -q
+%setup -q -n %{name}-export-%{_snap}
%patch0 -p1
%patch1 -p1
%patch2 -p1
+#%patch3 -p1 NEEDS UPDATE
+%patch4 -p1
+#%patch5 -p1 MIGHT BE UNNECCESSARY
%build
# notes:
# - it's not autoconf configure
-# - -fomit-frame-pointer is always needed on x86 due to lack of registers
-# (-fPIC takes one)
# - --disable-debug, --disable-opts, tune=generic causes not to override our optflags
./configure \
--prefix=%{_prefix} \
+ --libdir=%{_libdir} \
--mandir=%{_mandir} \
- --enable-shared \
+ --disable-strip \
+ --enable-a52 \
--enable-a52bin \
+ --enable-dts \
+ --enable-faac \
+ --enable-faad \
--enable-faadbin \
-%ifnarch i586 i686 athlon
+ --enable-gpl \
+ --enable-libgsm \
+ --enable-libogg \
+ --enable-mp3lame \
+ --enable-pp \
+ --enable-pthreads \
+ --enable-shared \
+ --enable-vorbis \
+ --enable-x264 \
+ --enable-xvid \
+%ifnarch %{ix86} %{x8664}
--disable-mmx \
+%endif
+%ifarch i386 i486
+ --disable-mmx \
+%endif
+%if %{with amr}
+ --enable-amr_nb \
+ --enable-amr_wb \
%endif
--cc="%{__cc}" \
- --extra-cflags="%{rpmcflags} -fomit-frame-pointer" \
+ --extra-cflags="%{rpmcflags}" \
--extra-ldflags="%{rpmldflags}" \
--disable-debug \
--disable-opts \
- --tune=generic
-%{__make}
+# GONE?
+# %{!?with_lzo:--disable-lzo} \
+# --enable-theora \
+# --tune=generic
-%{__make} -C doc
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_sbindir}}
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_sbindir},/etc/{sysconfig,rc.d/init.d}} \
+ $RPM_BUILD_ROOT/var/{cache,log}/ffserver
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
+install xvmc_render.h $RPM_BUILD_ROOT%{_includedir}/ffmpeg
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ffserver
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ffserver
+install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/ffserver.conf
mv -f $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/ffserver
-install doc/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
%clean
rm -rf $RPM_BUILD_ROOT
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
+%post libs -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
+
+%pre ffserver
+%groupadd -g 167 ffserver
+%useradd -g ffserver -u 167 ffserver
+
+%post ffserver
+/sbin/chkconfig --add ffserver
+%service ffserver restart
+
+%preun ffserver
+if [ "$1" = 0 ]; then
+ %service ffserver stop
+ /sbin/chkconfig --del ffserver
+fi
+
+%postun ffserver
+if [ "$1" = 0 ]; then
+ %userremove ffserver
+ %groupremove ffserver
+fi
%files
%defattr(644,root,root,755)
-%doc Changelog README doc/*.html
+%doc Changelog README doc/*.html doc/TODO
%attr(755,root,root) %{_bindir}/ffmpeg
-%attr(755,root,root) %{_sbindir}/ffserver
-%attr(755,root,root) %{_libdir}/libavcodec-*.so
-%attr(755,root,root) %{_libdir}/libavformat-*.so
+%{_mandir}/man1/ffmpeg.1*
+
+%files libs
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libavcodec.so.*.*.*
+%attr(755,root,root) %{_libdir}/libavformat.so.*.*.*
+%attr(755,root,root) %{_libdir}/libavutil.so.*.*.*
+%attr(755,root,root) %{_libdir}/libpostproc.so.*.*.*
%dir %{_libdir}/vhook
%attr(755,root,root) %{_libdir}/vhook/drawtext.so
%attr(755,root,root) %{_libdir}/vhook/fish.so
%attr(755,root,root) %{_libdir}/vhook/null.so
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/ffserver.conf
-%{_mandir}/man1/ffmpeg.1*
-%{_mandir}/man1/ffserver.1*
+%attr(755,root,root) %{_libdir}/vhook/ppm.so
+%attr(755,root,root) %{_libdir}/vhook/watermark.so
+
+%files devel
+%defattr(644,root,root,755)
+%doc doc/optimization.txt
+%attr(755,root,root) %{_libdir}/libavcodec.so
+%attr(755,root,root) %{_libdir}/libavformat.so
+%attr(755,root,root) %{_libdir}/libavutil.so
+%attr(755,root,root) %{_libdir}/libpostproc.so
+#%{_libdir}/lib*.la
+%{_includedir}/ffmpeg
+%{_includedir}/postproc
+%{_pkgconfigdir}/*.pc
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/lib*.a
%files ffplay
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/ffplay
%{_mandir}/man1/ffplay.1*
-%if %{!?_without_imlib:1}0
+%if %{with imlib2}
%files vhook-imlib2
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/vhook/imlib2.so
%endif
-%files devel
+%files ffserver
%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libavcodec.so
-%attr(755,root,root) %{_libdir}/libavformat.so
-%{_libdir}/lib*.la
-%{_includedir}/ffmpeg
-
-%files static
-%defattr(644,root,root,755)
-%{_libdir}/lib*.a
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ffserver.conf
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ffserver
+%attr(755,root,root) %{_sbindir}/ffserver
+%attr(754,root,root) /etc/rc.d/init.d/ffserver
+%{_mandir}/man1/ffserver.1*
+%dir %attr(770,root,ffserver) /var/cache/ffserver
+%dir %attr(770,root,ffserver) /var/log/ffserver