require 'fileutils' ## # This script downloads and builds MPlayer, replacing the included FFmpeg # backend with the FFmpeg-MT branch that provides multi-core decoding. This # should really give those with multiple cores/processors a hand in utilizing # true-highdef content, such as 1080p Matroska movies encoded in H.264. # # I pull specific revisions of FFmpeg-MT and MPlayer that I know to build # together, feel free to expieriment with newer revisions - no guarantee # that'll work though! FFmpegRepo = 'git://gitorious.org/ffmpeg/ffmpeg-mt.git' FFmpegDirectory = 'ffmpeg-mt' FFmpegStableCommit = 'e340cacc56545c5fc3a903c68fec99e8921d579e' # 'babb66241ae51e2956aa698d425c645ad056936e' MPlayerRepo = 'svn://svn.mplayerhq.hu/mplayer/trunk' MPlayerDirectory = 'mplayer' MPlayerStableRevision = 27902 # 27799 desc 'Clone FFmpeg' task :ffmpeg, :commit do |_, params| commit = params[:commit] || FFmpegStableCommit puts "** Cloning FFmpeg, and switching to commit #{commit}" system "git clone #{FFmpegRepo} #{FFmpegDirectory}" FileUtils.cd FFmpegDirectory, :verbose => true do system "git checkout #{commit}" end end desc 'Checkout MPlayer' task :mplayer, :revision do |_, params| revision = params[:revision] || MPlayerStableRevision puts "** Checking out MPlayer at revision #{revision}" system "svn checkout #{MPlayerRepo}@#{revision} #{MPlayerDirectory}" FileUtils.cd MPlayerDirectory, :verbose => true do system "svn revert -R *" end end desc 'Copy libraries from FFmpeg to MPlayer' task :mux => [:mplayer, :ffmpeg] do Dir[ File.join(FFmpegDirectory, 'libav*') ].each do |libav_dir| libav_dir = libav_dir.split(File::Separator).last FileUtils.rm_rf File.join(MPlayerDirectory, libav_dir), :verbose => true FileUtils.cp_r File.join(FFmpegDirectory, libav_dir), File.join(MPlayerDirectory, libav_dir), :verbose => true end end desc 'Apply the patch to MPlayer' task :apply => :mplayer do puts "** Applying the patch" FileUtils.cd MPlayerDirectory, :verbose => true do system 'patch -up0 -i ../mplayer-mt.diff' end end desc 'Build MPlayer' task :build do puts "** Building MPlayer" FileUtils.cd MPlayerDirectory, :verbose => true do system './configure' system 'make' end end desc 'Install MPlayer' task :install => :build do puts "** Installing MPlayer" FileUtils.cd MPlayerDirectory, :verbose => true do system 'make install' # you probably need to run this as root end end task :default => [:mux, :install]