xine-lib on Windows using minGW

On this page, I'll document my steps in trying to compile and run xine on windows with the Minimalist GNU Window (minGW) tools. It's nowhere near perfect, yet. Fixes to xine lib are reported to xine-devel mailing list and applied to current xine lib 1.1.x mercurial repository

Status

  • xine-lib compiles on mingw32
  • audio playback works. xine-lib provides 3 audio output plug-ins for win32:
    • directx: constant glitches
    • directx2: correct playback with the updated version (good)
    • pulseaudio correct playback using PulseAudio server
  • video playback works with both: the directx output and the SDL output. SDL output can be embedded in existing win32 window.
  • All fixes have been integrated in xine-lib-1.1.16
  • Ready for the first tests with Java!

Download

Library files on win32

  • bin/libxine-1.dll : MS-DOS executable PE for MS Windows (DLL)
  • lib/libxine-1.def : human readable symbol table
  • lib/libxine.dll.a : static lib (current ar archive)
  • lib/libxine.la : libtool file for libxine
  • jawt.lib : stub library to link against stripped DLLs (jawt.dll is only present in the JRE/bin, but stripped)

Setup system - /usr/local

I prefer to have the new stuff separated from the mingw installation.

  • Install mingw32 in C:\mingw
  • Install msys in C:\msys\1.0
  • Install msysDTK in C:\msys\1.0
  • Create folder C:/usr-local with the Windows Explorer
  • In /etc/fstab add "c:/usr-local /usr/local"
    C:/usr-local is now available as /usr/local, check with the mount command
  • mkdir /usr/local/bin /usr/local/include /usr/local/lib
  • Download wget to C:/usr-local/bin/wget.exe
  • Install the windows mercurial binary

pkg-config

DirectX 7.0 headers

cd dx7headers ; tar xvfz ../dx7headers.tgz

pthread library

zlib

libdl

libdvdread

xine-lib

  • hg clone http://hg.debian.org/hg/xine-lib/xine-lib
  • @@ ./autogen.sh
  • ./configure \
    --with-dxheaders=/usr/local/dx7headers \
    --with-zlib-prefix=/usr/local \
    PTHREAD_CFLAGS=-I/usr/local/include \
    PTHREAD_LIBS="-L/usr/local/lib -lpthreadGC2 \
    --disable-iconvtest # iconv not installed

  • make install

Test muxine-audio.exe

  • Get muxine-audio.c
  • gcc -g -I/usr/local/include muxine-audio.c -L/usr/local/lib -L/usr/xine/pthreads/lib -lxine -o muxine-audio.exe
  • mv muxine-audio.exe /usr/local/bin
  • export PATH=$PATH:/usr/local/bin
  • muxine-audio.exe song.mp3

Fixes since xine-lib 1.1.15

  • xine-engine/osd.c: MIN macro not defined
    • where should MIN be defined?
      • in <sys/param.h> normally.
      • <sys/param.h> exists on mingw but does not contain MIN
      • xine checks for them in m4/misc.m4 and tries to define them otherwise, but this does not work
      • define HAVE_MIN_MACRO, HAVE_MAX_MACRO if available in <sys/param.h>
      • in lib/os_internals.h define if missing
  • xine pluging loader tries to dlopen static libs which creates a Windows error dialog
    • Just skip them in the xine loader: load_plugins.c
  • linking of src/post/xineplug_post_tvtime fails due to missing PHTREAD_LIBS flags
  • broken xine_get_pluginroot()
    • Add XINE_REL_PLUGINDIR to configure.ac and configure.h.in
    • Implement xine_get_pluginroot() similar to xine_get_plugindir()
  • Replace windows backslash by unix slash in configure
  • Fix PulseAudio autoconf
    • configure.ac has test for pulseaudio version >= 0.9.7. Replace with test for PA_PROTOCOL_VERSION >= 11:
    • PULSEAUDIO_{CFLAGS|LIBS} is not passed to gcc by src/audio_out/Makefile.am
  • Fix audio output
    • Carlo Bramix found the bug in xine_util/utils.c
  • Pass native HWND through xine to SDL
    • use x11_visual.drawable for HWND
    • In video_out_sdl: set SDL_WINDOWID if drawable!=0
  • Fix directx video output
    • Video output broken if desktop is not set to 16-bit color depth and not hardware-accelerated
    • Video output broken if secondary buffer supports YV12 color mode
  • Fix xine DirectX(2) audio output
    • Simpler ring buffer handling
  • Support XINE_GUI_SEND_DRAWABLE_CHANGED for DirectX video
    • Required for libxine-java implementation

ToDos

  • Fix handling of failed directx sound initialization
    • Something crashes, if directx sound fails to init, e.g., if using a Remote Desktop Connection without sound.

Other

  • Cross compile xine on Ubuntu or OS X
  • xine-lib-win32 packaging
    • Install iconv (instead of disabling it)
    • Decide on optional libraries for xine-lib win32 builds
    • Create script which creates binaries for win32
  • Other platforms
    • Support win64: figure out what's necessary for that
    • Support for MS Visual Studio: help pushing fixes into xine-lib-hg