[MPlayer-cygwin] A way to compile mplayer as dll in MinGW+MSYS environment

李鑫 jackyxinli at gmail.com
Wed Aug 11 03:09:51 CEST 2010


Hi, all,
I try a way to compile mplayer as dll in MinGW+MSYS environment.
step 1, download source code of mplayer from
http://www.mplayerhq.hu/design7/dload.html or download snapshot version
http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2, I
choice snapshot version. And uncompress it into C:\.

step 2, download MinGW+MSYS environment from
http://sourceforge.net/projects/mplayer-ww/files, I download the latest
version MinGW-full-20100518, and uncompress it into C:\MinGW.

step 3, create a file named autoconf, content listed below:
--------------------------------------------------------------------------------------------------
./configure --disable-mencoder --disable-debug --enable-runtime-cpudetection
--disable-sdl --disable-pthreads --enable-static --enable-w32threads
--------------------------------------------------------------------------------------------------

step 4, modify c:\mplayer-export-2010-08-10\mplayer.c, find "#ifndef
DISABLE_MAIN", add a line "#define DISABLE_MAIN" before it, save it.

step 5, create a file named Makefile_dll, content listed below:
--------------------------------------------------------------------------------------------------

include config.mak
DIRS = input libaf libao2 libass libdvdcss libdvdnav libdvdnav/vm
libdvdread4 libfaad2 libmpcodecs libmpdemux libmpeg2 libvo loader loader/dmo
loader/dshow mp3lib osdep stream stream/freesdp stream/librtsp
stream/realrtsp tremor vidix

ALL_OBJS = $(foreach DIR, $(DIRS), $(wildcard $(DIR)/*.o))

MPLAYER_OBJS = $(wildcard *.o)

INNER_LIBS = libavformat/libavformat.a libavcodec/libavcodec.a
libavcore/libavcore.a libavutil/libavutil.a libpostproc/libpostproc.a
libswscale/libswscale.a

# $(EXTRALIBS) come from config.mak
OTHER_LIBS = $(EXTRALIBS)

# $(EXTRALIBS_MPLAYER) come from config.mak
LIBS = $(EXTRALIBS_MPLAYER)

mplayer.dll : $(OBJS_MPLAYER) $(ALL_OBJS)
    dllwrap --output-lib=libmplayer.a --dllname=$@ --driver-name=gcc
--export-all-symbols $(MPLAYER_OBJS) $(ALL_OBJS) $(INNER_LIBS) $(OTHER_LIBS)
$(LIBS)
--------------------------------------------------------------------------------------------------

step 6 run C:\MinGW\msys.bat, do commands like below:
$cd /c/mplayer-export-2010-08-10
$./autoconf
$make
$make -f Makefile_dll

when follow those steps, you will get mplayer.dll and libmplayer.a two files
under c:\mplayer-export-2010-08-10. enjoy.
PS: two files are attched in mail.

jacky_zz
2010-08-11
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autoconf
Type: application/octet-stream
Size: 146 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-cygwin/attachments/20100811/e096ff35/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile_dll
Type: application/octet-stream
Size: 849 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-cygwin/attachments/20100811/e096ff35/attachment-0001.obj>


More information about the MPlayer-cygwin mailing list