How to build MPlayer on MinGW using the MSYS shell.
12th February 2007 - Mark Himsley
Last updated - 19-Dec-2007
This tutorial will build a static version of MPlayer with many formats included.
It is based on the tutorial at:
http://www1.mplayerhq.hu/MPlayer/releases/win32/contrib/MPlayer-MinGW-Howto.txt
Install MinGW, MSYS and MSYS Developer Tool Kit
Download MinGW, MSYS and MSYS Developer Tool Kit to a temporary location
http://prdownloads.sf.net/mingw/MinGW-5.1.3.exe?download
http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download
http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download
Linked from:
http://www.mingw.org/download.shtml
Run MinGW-5.1.3.exe and install the current versions of:
MinGW base bools
g++
MinGW make
into
C:\MinGW
Run MSYS-1.0.10.exe and install into
C:\msys\1.0.
After the install finishes a cmd shell opens and asks:
"Do you wish to continue with the post install? [yn ]"
press y and return
The next question is:
"Do you have MinGW installed? [yn ]"
press y and return and enter the path MinGW was installed into:
c:/MinGW (NOTE the forward slash)
The next question is:
Do you wish for me to add mount bindings for
c:/MinGW to /mingw? [yn ]
press y and return
Run msysDTK-1.0.1.exe and install into
C:\msys\1.0
After installing MinGW, MSYS and MSYS Developer Tool Kit, open a msys shell from
the short-cut on your desktop.
Install SVN client tools
Download binary client tools.
http://subversion.tigris.org/files/documents/15/32473/svn-win32-1.3.2.zip
Linked from:
http://subversion.tigris.org/project_packages.html#binary-packages
Use 7-Zip or another zip archive managed to unpack the contents and put them
into your path, for instance
C:\mingw\bin
Patch MinGW for long file pointers
Download w32api-3.6.tar.gz and mingw-runtime-3.11 source into your msys home
directory.
http://prdownloads.sf.net/mingw/w32api-3.6.tar.gz?download
http://prdownloads.sf.net/mingw/mingw-runtime-3.11-20061202-1-src.tar.gz?download
Linked from:
http://www.mingw.org/download.shtml
and also download a patch file
http://oss.netfarm.it/mplayer/misc/file64_mingw.diff
In your msys home directory create a new directory called w32api and extract
w32api-3.6.tar.gz into it.
$ cd
$ mkdir w32api
$ tar -zxf w32api-3.6.tar.gz -C w32api
Extract the mingw-runtime archive, patch it, build it and install it
$ cd
$ tar -zxf mingw-runtime-3.11-20061202-1-src.tar.gz
$ cd mingw-runtime-3.11
$ patch -p1 -u -i../file64_mingw.diff
$ ./configure prefix=c:/mingw
$ make
$ make install}}}
!!Install DirectX headers!!
Download the DirectX headers to your msys home directory.
http://www.mplayerhq.hu/MPlayer/releases/win32-beta/contrib/dx7headers.tgz
Extract the headers and copy them into MinGWs include directory.
{{{$ cd
$ mkdir dx7headers
$ tar -zxf dx7headers.tgz -C dx7headers
$ cd dx7headers
$ cp -a *.h c:/mingw/include}}}
!!Install ogg, vorbis and theora libraries!!
MPlayer can already play vorbis audio but requires libthora to play thora video.
Building libtheora requires libogg and libvorbis to be installed.
Download the latest version of ogg, vorbis and therora to your msys home directory
http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
http://downloads.xiph.org/releases/theora/libtheora-1.0alpha5.tar.gz
Linked from: http://downloads.xiph.org/releases/
Extract the libogg archive, build it and install it.
{{{$ cd
$ tar -zxf libogg-1.1.3.tar.gz
$ cd libogg-1.1.3
$ ./configure prefix=c:/mingw disable-shared
$ make
$ make install}}}
Extract the libvorbis archive, build it and install it.
{{{$ cd
$ tar -zxf libvorbis-1.1.2.tar.gz
$ cd libvorbis-1.1.2
$ ./configure prefix=c:/mingw disable-shared
$ make
$ make install}}}
Extract the libtheora archive, build it and install it.
{{{$ tar -zxf libtheora-1.0alpha5.tar.gz
$ cd libtheora-1.0alpha5
$ ./configure disable-encode prefix=C:/mingw disable-shared
$ make
$ make install
Install freetype for On Screen Display font rendering
Download libiconv to your msys home directory.
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
Linked from:
http://www.gnu.org/software/libiconv/
Extract the libiconv archive, build it and install it.
$ cd
$ tar -zxf libiconv-1.11.tar.gz
$ cd libiconv-1.11
$ ./configure prefix=c:/mingw disable-shared
$ make
$ make install
Download freetype2 to your msys home directory.
http://prdownloads.sf.net/freetype/freetype-2.3.1.tar.gz?download
Linked from:
http://sourceforge.net/project/showfiles.php?group_id=3157
$ cd
$ tar -zxf freetype-2.3.1.tar.gz
$ cd freetype-2.3.1
$ ./configure prefix=c:/mingw disable-shared
$ make
$ make install
Install zlib, libregif, libpng & libjpeg
zlib is needed for some mov files with compressed headers the others to play/encode png/jpeg/gif files
Sources are available from:
http://www.gzip.org/zlib/
http://armory.nicewarrior.org/projects/libregif/
http://sourceforge.net/project/showfiles.php?group_id=5624
http://www.ijg.org/
$ cd
$ tar -zxf zlib-1.2.3.tar.gz
$ cd zlib-1.2.3
$ ./configure prefix=c:/mingw
$ make
$ make install}}}
{{{$ cd
$ tar -zxf libpng-1.2.15.tar.gz
$ cd libpng-1.2.15
$ ./configure prefix=c:/mingw disable-shared
$ make
$ make install}}}
{{{$ cd
$ tar -zxf jpegsrc.v6b.tar.gz
$ cd jpeg-6b
$ ./configure prefix=/mingw/ enable-static
$ make
$ cp .libs/libjpeg.a c:/mingw/lib/
$ cp jpeglib.h jconfig.h jmorecfg.h c:/mingw/include/}}}
{{{$ cd
$ tar -zxf libregif-4.1.7.tar.gz
$ cd libregif-4.1.7
$ ./configure prefix=c:/mingw
$ make
$ make install
Install lame, xvid and x264
Get the nasm sources from
http://sourceforge.net/project/showfiles.php?group_id=6208
$ cd
$ tar -zxf nasm-0.98.39.tar.gz
$ cd nasm-0.98.39
$ ./configure prefix=c:/mingw
$ make
$ mkdir c:/mingw/man/man1
$ make install}}}
Install lame from http://lame.sourceforge.net/download/download.html
{{{$ cd
$ tar -zxf lame-3.97.tar.gz
$ cd lame-3.97
$ ./configure prefix=c:/mingw disable-shared disable-decoder
$ make
$ make install
Now get
http://www.xvid.org/downloads.html
$ cd
$ tar -zxf xvidcore-1.1.2.tar.gz
$ cd xvidcore-1.1.2/build/generic
$ ./configure prefix=c:/mingw disable-shared
$ make
$ make install
$ mv c:/mingw/lib/xvidcore.a c:/mingw/lib/libxvidcore.a
Install x264
Get svn checkout from videolan.org.
$ cd
$ svn co svn://svn.videolan.org/x264/trunk x264
$ cd x264
$ ./configure prefix=c:/mingw enable-avis-input enable-pthread
$ make
$ make install}}}
!!live.com rtsp streaming support!!
Get the sources
http://www.live.com/liveMedia/public/
{{{$ cd
$ tar -zxf live.2007.04.24a.tar.gz (got some errors from tar here but the build worked nevertheless)
$ cd live
$ genMakefiles mingw
$ make}}}
!!Install MPlayer!!
{{{$ cd
$ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
$ cd mplayer}}}
OR
{{{$ cd mplayer
$ svn update
$ make distclean}}}
{{{$ ./configure \
enable-runtime-cpudetection \
codecsdir=codecs \
enable-menu \
enable-static \
with-extralibdir=/home/mdsh/live \
with-extraincdir=/home/mdsh/live
$ make clean && make}}}
If you are going to use this version on MPlayer only on the computer on which you
are building MPlayer then you can leave out enable-runtime-cpudetection option.
Currently there is an issue in stream/stream_dvd.c
Because of this issue I patched the source to make it compile.
Index: stream/stream_dvd.c
===================================================================
--- stream/stream_dvd.c (revision 25424)
+++ stream/stream_dvd.c (working copy)
@@ -24,7 +24,9 @@
#include <sys/ioctl.h>
#endif
+#ifndef __MINGW32__
#include <libgen.h>
+#endif
#include <errno.h>
#define FIRST_AC3_AID 128
@@ -46,6 +48,21 @@
int dvd_angle=1;
int dvd_speed=0; /* 0 => don't touch speed */
+#ifdef __MINGW32__
+#define basename(s) (strrchr((s),'/')==NULL?(char *)(s):(strrchr((s),'/')+1))
+static char * dirname(const char *s) {
+ char *t;
+ char *u;
+ if(strrchr((s),'/')==NULL) {
+ return "";
+ }
+ t = strdup(s);
+ u = strrchr((t),'/') ;
+ *u = (char) NULL;
+ return t;
+}
+#endif
+
static void dvd_set_speed(char *device, unsigned speed)
{
#if defined(__linux__) && defined(SG_IO) && defined(GPCMD_SET_STREAMING)
|
Mplayer:build on MinGW is mentioned on: Video