%define name ffmpeg-mh
%define version 0.33
%define svndate 051130
%define release 12%{?_dist_release}

%define ffmpeg_mh ffmpeg_%{svndate}

# %define amrnbver 7.1.0.2
# %define amrwbver 7.0.0.3
#% define _with_amr 1

%define _with_x264_mh 1
%define x264_mh x264_051028

Summary: 3GP Converter (Keitai Douga Henkan-kun) for UNIX---FFmpeg Mobile Hack version
Summary(ja): Windows 用携帯動画変換君（3GP Converter）の UNIX 版
Name: %{name}
Version: %{version}
Release: %{release}
Source: http://www.nurs.or.jp/~calcium/3gpp/sources/ffmpeg-%{svndate}-%{version}.tar.gz
# x264_051028.tar.gz: from http://mobilehackerz.jp/contents?plugin=attach&refer=3GPConv%2FSources&openfile=x264_051028.tar.gz
# on http://mobilehackerz.jp/contents/3GPConv/Sources
%if %{_with_x264_mh}
Source1: x264_051028.tar.gz
%endif
# Source1: http://ftp.penguin.cz/pub/users/utx/amr/amrnb-%{amrnbver}.tar.bz2
# Source2: http://ftp.penguin.cz/pub/users/utx/amr/amrwb-%{amrwbver}.tar.bz2
Patch: http://can.homeunix.org/sw/psp/ffmpeg_psp/ffmpeg-mh-unix.patch
#Patch1: ffmpeg-mh-include-amr.patch
Patch2: ffmpeg-mh-0.33-disable-texi2html.patch
License: GPL
Group: Applications/Multimedia
URL: http://www.nurs.or.jp/~calcium/3gpp/

#Requires: 
BuildRequires: zlib-devel, SDL-devel, imlib2-devel
#BuildRequires: texi2html
BuildRequires: libogg-devel, libvorbis-devel, libtheora-devel
# *-devel pacages provided by other self-build-* should only be listed
# in self-build-%{name}.spec as PreReq.
#BuildRequires: xvidcore-devel, faac-devel, lame-devel
#BuildRequires: x264-devel, libdca-devel, a52dec-devel, faad2-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-root

%description
FFMpeg is a complete and free Internet live audio and video
broadcasting solution for Linux/Unix. It also includes a digital
VCR. It can encode in real time in many formats including MPEG1 audio
and video, MPEG4, h263, ac3, asf, avi, real, mjpeg, and flash.

ffmpeg-mh is a 3GP Converter for UNIX. It is a FFmpeg Mobile Hack version 
under unix, is enoughly customized for many mobiles from original sources 
of ffmpeg. 

%description -l ja
FFMpeg は Linux/Unix に対する完全にフリーなインターネットライブ
オーティオ・ビデオブロードキャスティングソリューションです．
またデジタル VCR を含んでいます．MPEG1 オーディオ・ビデオ，
MPEG4, h263, ac3, asf, avi, real, mjpeg, flash を含む
多様なフォーマットをリアルタイムにエンコードすることができます．

ffmpeg-mh は Windows 用携帯動画変換君（3GP Converter）の UNIX 版です．
FFmpeg のモバイル端末向けに改良されたバージョンで，オリジナルのソースから
モバイル向けにたくさん調整されています．

%prep
%setup -q -n %{ffmpeg_mh}
%patch -p1
#%patch1 -p1 -b include

# tar jxvf %{SOURCE1}
# tar jxvf %{SOURCE2}

## use x264 for Mobile Hack version
%if %{_with_x264_mh}
tar zxvf %{SOURCE1}
%endif

%build
# ## build amr
# cd amrnb-%{amrnbver}
# ./configure \
#     --prefix=${RPM_BUILD_DIR}/%{ffmpeg_mh} \
#     --includedir=${RPM_BUILD_DIR}/%{ffmpeg_mh}/include/amr \
#     --enable-static --disable-shared
# %{__make} %{?_smp_mflags} OPT_CFLAGS="$RPM_OPT_FLAGS"
# %{__make} install
# cd ..
# cd amrwb-%{amrwbver}
# ./configure \
#     --prefix=${RPM_BUILD_DIR}/%{ffmpeg_mh} \
#     --includedir=${RPM_BUILD_DIR}/%{ffmpeg_mh}/include/amr_float \
#     --enable-static --disable-shared
# %{__make} %{?_smp_mflags} OPT_CFLAGS="$RPM_OPT_FLAGS"
# %{__make} install
# cd ..

## build x264 for Mobile Hack version
%if %{_with_x264_mh}
cd %{x264_mh}
./configure \
    --prefix=${RPM_BUILD_DIR}/%{ffmpeg_mh} \
    --enable-pthread \
    --enable-static \
    --disable-shared
%__make
%__make install
cd ..
%endif

## configure ffmpeg-mh
./configure \
    --prefix=%{_prefix} \
    --incdir=%{_includedir}/%{name} \
    --libdir=%{_libdir} \
    --shlibdir=%{_libdir} \
    --mandir=%{_mandir} \
    %{?_with_x264_mh:--extra-cflags=-I${RPM_BUILD_DIR}/%{ffmpeg_mh}/include} \
    %{?_with_x264_mh:--extra-ldflags=-L${RPM_BUILD_DIR}/%{ffmpeg_mh}/lib} \
    %{?_with_x264_mh:--enable-x264} \
    --disable-debug \
    --enable-mp3lame \
    --enable-libogg \
    --enable-vorbis \
    --enable-faad \
    --enable-faac \
    --enable-xvid \
    --enable-a52 \
    %{?_with_amr:--enable-amr_nb --enable-amr_nb-fixed --enable-amr_wb} \
    --enable-pp \
    --enable-pthreads \
    --enable-gpl \
    --enable-static \
    --disable-shared \
    --disable-ffserver \
    --disable-ffplay

## build ffmpeg-mh
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf $RPM_BUILD_ROOT

## install ffmpeg-mh
install -d -m755 %{buildroot}/%{_bindir}
install -m 755 ffmpeg %{buildroot}/%{_bindir}/%{name}

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_bindir}/ffmpeg-mh


%changelog
* Sat Mar 20 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.33-12
- change release to sync with self-build-ffmpeg-mh

* Thu Feb 18 2010 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-11
- rebuild

* Tue May 26 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-10
- change release to sync with self-build-ffmpeg-mh

* Wed May 13 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-9
- applied ffmpeg-mh-0.33-disable-texi2html.patch
  - dropped BuildRequires: texi2html

* Sun Feb 8 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-8
- changed to PreReq:  self-build-faad2 >= 2.0 from faad2-devel 

* Sun Feb 01 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-7
- change release to sync with self-build-ffmpeg-mh

* Sun Nov 02 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-6
- added x264_051028 for Mobile Hack version
- dropped BuildRequires: self-build-x264

* Sun Nov 02 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-5
- spec in utf8
- droppd BuildRequires: xvidcore-devel, faac-devel, lame-devel
  BuildRequires: x264-devel, libdca-devel, a52dec-devel
  (*-devel pacages provided by other self-build-*) in ffmpeg-mh.spec

* Thu Apr 10 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-1vl4
- build with new versioning policy

* Thu Mar 13 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-0vl2
- [self-build-ffmpeg-mh.spec]
  For all pre-required package that is provied by self-build,  
  changed to its self-build package

* Tue Mar 11 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.33-0vl1
- initial build for Vine Linux 4.2
  with ffmpeg-051130-0.33

### end of file
