Building Mplayer
From RC-Autopilot Wiki
Contents |
Building Mplayer with Unichrome Pro and XviD Support
Instructions according to http://www.openchrome.org/snapshots.html and http://www.mplayerhq.hu/DOCS/HTML/en/index.html
Install OpenChrome Drivers
- Put your X11 source in /usr/src/xc
- In /usr/src/xc: "make World"
- Get newest http://www.openchrome.org/snapshots/unichrome/ (at this time the newest are 16.11.05)
- Build drm (for 2.6 kernel)
tar xfj unichrome-20051109.tar.bz2 cd unichrome-20051109/drm/linux-core make LINUXDIR=/usr/src/linux DRM_MODULES=via cp *.ko /lib/modules/`uname -r`/kernel/drivers/char/drm/ depmod -ae
- Build libxvmc
cd libxvmc xmkmf /usr/src/xc make make install
If the xmkmk step fails because of missing host.def and date.def, you forgot to "make World" in /usr/src/xc. Do it now and try again.
- Build Driver
cd unichrome xmkmf /usr/src/xc make make install
During make we get:
In file included from /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86str.h:43, from /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86.h:40, from /usr/src/xc/programs/Xserver/hw/xfree86/rac/xf86RAC.h:8, from via_driver.c:33: /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86Module.h:47:25: xf86Version.h: No such file or directory In file included from /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86.h:40, from /usr/src/xc/programs/Xserver/hw/xfree86/rac/xf86RAC.h:8, from via_driver.c:33: /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86str.h:45:21: xf86Pci.h: No such file or directory In file included from /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86.h:40, from /usr/src/xc/programs/Xserver/hw/xfree86/rac/xf86RAC.h:8, from via_driver.c:33: /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86str.h:886: error: syntax error before "IOADDRESS" /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86str.h:886: warning: no semicolon at end of struct or union /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86str.h:954: error: syntax error before '}' token /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86str.h:954: warning: type defaults to `int' in declaration of `ScrnInfoRec' /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86str.h:954: error: ISO C forbids data definition with no type or storage class In file included from /usr/src/xc/programs/Xserver/hw/xfree86/rac/xf86RAC.h:8, from via_driver.c:33: /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86.h:106: error: syntax error before '*' token /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86.h:106: warning: type defaults to `int' in declaration of `xf86GetPciConfigInfo' /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86.h:106: error: ISO C forbids data definition with no type or storage class /usr/src/xc/programs/Xserver/hw/xfree86/common/xf86.h:277: error: syntax error before "IOADDRESS"
aaaargh pages and pages of errors :-((((( syntax, not found, etc. etc... maybe we should use a more stable version of xorg? no, tried it with X11-6.8.2, same problem (even had to do the same hack with the date.def and host.def)
enough for tonight... Arnolde 03:22, 31 December 2005 (CET)
Ok let's continue (Arnolde 16:10, 31 December 2005 (CET)): Got a reply back from Ivor suggesting to try his latest code from SVN. After searching for 20 minutes trying to find out what SVN is, I found that it's called Subversion and is supposed to replace CVS someday. Installing is easy enough
emerge subversion
BUT unfortunately it seems to rely on a lot of stuff (perl, etc.) that I didnt have so it's been emerging for quite a while now and I still can't use it yet *grrrrr*
I just looked at the starting time and the "emerge subversion" has been running for 45 minutes now... I really have to gripe about this, I mean really, all this thing does is download a few files from a server for me, right? I can see that it might need perl, if it's written in that language. But man, why all this crap that takes ages and ages to compile... *rant* *rave*
Yeah, one hour and 10 minutes later, I can finally download the svn version of openchrome... But same things happen, that didnt change anything. (I would have been surprised, anyway).
Ok so then I unpacked the whole X source again into a new test directory, just to make sure it hadnt been messed up somehow, and tried again. This time I got a little further, no missing files this time, but I got the same error this guy had: http://www.openchrome.org/trac/ticket/17
So since he seemed to solve his problem with xorg-7.0 now I am installing that too, according to these instructions: http://gentoo-wiki.com/HOWTO_Modular_Xorg (which will probably take at least the rest of this year to finish installing). Arnolde 19:50, 31 December 2005 (CET)
Ok, now I'm proud owner of xorg-server 7.0... Will it be any use?
openchrome # autogen.sh openchrome # make
ouch, it does compile for a while, but still get an error:
In file included from via_memory.c:34: /usr/include/xorg/xf86drm.h:39:17: drm.h: No such file or directory
I see such a file exists: /usr/include/drm/drm.h so I add that directory to the XORG_CFLAGS in the openchrome Makefile (the one in the unichrome directory!), but that didnt help, also I see that my edit did not take effect, the additional -I/usr/include/drm does not appear, so that must be done somewhere else...
Still dont know where those includes are defined, but this finally did the trick:
cp /usr/include/drm/drm.h to the unichrome directory
Ok well supposedly the openchrome drivers are now all compiled. But mplayer still won't compile, still fails to compile:
libavcodec/libavcodec.a(allcodecs.o)(.text+0x35a): In function `avcodec_register_all': : undefined reference to `mpeg_xxmc_decoder' collect2: ld returned 1 exit status make: *** [mplayer] Error 1
- added +dri +drm to my /etc/make.conf
- emerge x11-base/xorg-server x11-drivers/xf86-video-via
OK I'm getting there... found a typo in allcodecs.c - just changed "xxmc" to "xvmc" and it worked! So make install, and I finally have my new xvmc-enabled mplayer. Now to get it to start:
modprobe via_agp modprobe agpgart
dmesg shows:
Linux agpgart interface v0.101 (c) Dave Jones agpgart: Detected VIA PM800/PN800/PM880/PN880 chipset agpgart: AGP aperture is 32M @ 0xea000000
then:
modprobe via modprobe drm
dmesg shows:
[drm] Initialized drm 1.0.1 20051102 [drm] Initialized via 2.7.3 20051115 on minor 0:
now try startx:
X Window System Version 7.0.0
Release Date: 21 December 2005
X Protocol Version 11, Revision 0, Release 7.0
Build Operating System:Linux 2.6.14-gentoo-r5 i686
Current Operating System: Linux infoscreen 2.6.14-gentoo-r5 #4 PREEMPT Sun Jan 1 00:38:36 CET 2006 i686
Build Date: 02 January 2006
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Mon Jan 2 05:01:04 2006
(==) Using config file: "/root/xorg.conf"
xterm: error while loading shared libraries: libXaw.so.8: cannot open shared object file: No such file or directory
xterm: error while loading shared libraries: libXaw.so.8: cannot open shared object file: No such file or directory
xterm: error while loading shared libraries: libXaw.so.8: cannot open shared object file: No such file or directory
waiting for X server to shut down .FreeFontPath: FPE "/usr/share/fonts/misc" refcount is 2, should be 1; fixing.
Hmmm, still a problem here. But I note that the error message:
(EE) VIA(0): [drm] drmAgpAcquire failed 1023
did not come up! I wonder if that means it will work now, as soon as this console issue is fixed?
emerge xterm
Fixed the xterm problem, and now X starts. Now when I run mplayer:
# mplayer -vo xvmc -vc ffmpeg12mc ntv-dvbs.mpeg MPlayer dev-CVS-051230-02:02-3.3.5-20050130 (C) 2000-2005 MPlayer Team CPU: IDT/Centaur/VIA C3 Nehemiah (Family: 6, Stepping: 8) CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0 Compiled for x86 CPU with extensions: MMX MMX2 SSE Failed to open /dev/rtc: No such file or directory (it should be readable by the user.) Playing ntv-dvbs.mpeg. MPEG-PS file format detected. VIDEO: MPEG2 720x576 (aspect 2) 25.000 fps 15000.0 kbps (1875.0 kbyte/s) ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== vo_xvmc: X-Video extension 2.2 vo_xvmc: X-Video MotionCompensation Extension version 1.1 ========================================================================== Forced video codec: ffmpeg12mc Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family vd_ffmpeg: XVMC accelerated codec Selected video codec: [ffmpeg12mc] vfm: ffmpeg (FFmpeg MPEG-1/2 (XvMC)) ========================================================================== Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??... AO: [oss] 48000Hz 2ch s16le (2 bytes per sample) Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le... Starting playback... vd_ffmpeg: XVMC accelerated MPEG2 trying pixfmt=0 VDec: vo config request - 720 x 576 (preferred colorspace: MPEG1/2 Motion Compensation and VLD) VDec: using MPEG1/2 Motion Compensation and VLD as output csp (no 0) Movie-Aspect is 1.33:1 - prescaling to correct movie aspect. VO: [xvmc] 720x576 => 768x576 MPEG1/2 Motion Compensation and VLD vo_xvmc: Port 68 grabed vo_xvmc: Found matching surface with id=32315659 on 68 port at 0 adapter vo_xvmc: Allocated Direct Context vo_xvmc: Motion Compensation context allocated - 8 surfaces vo_xvmc: idct=0 unsigned_intra=0 vo_xvmc: looking for OSD support Subpicture id 0x34344149 vo_xvmc: OSD support by beckend rendering (fast) vo_xvmc: Pleace send feedback to configrm that it work,otherwise send bugreport! MPlayer interrupted by signal 11 in module: decode_video - MPlayer crashed by bad usage of CPU/FPU/RAM. Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash. - MPlayer crashed. This shouldn't happen. It can be a bug in the MPlayer code _or_ in your drivers _or_ in your gcc version. If you think it's MPlayer's fault, please read DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and won't help unless you provide this information when reporting a possible bug.
Sometimes I also get the message:
X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 2 (X_ChangeWindowAttributes) Resource id in failed request: 0xe0000b Serial number of failed request: 118 Current serial number in output stream: 123
I get the same message (or similar) when I play mplayer with "-vo xv" or try xine, so I guess it's an X problem, independant of the player or codec. If I try to scale the output with "-vf scale=640:480" I get
Starting playback... vd_ffmpeg: XVMC accelerated MPEG2 trying pixfmt=0 VDec: vo config request - 720 x 576 (preferred colorspace: MPEG1/2 Motion Compensation and VLD) The selected video_out device is incompatible with this codec. Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp. trying pixfmt=1 VDec: vo config request - 720 x 576 (preferred colorspace: MPEG1/2 Motion Compensation and IDCT) The selected video_out device is incompatible with this codec. Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp. trying pixfmt=2 VDec: vo config request - 720 x 576 (preferred colorspace: MPEG1/2 Motion Compensation) The selected video_out device is incompatible with this codec. Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp. VDec: vo config request - 720 x 576 (preferred colorspace: MPEG1/2 Motion Compensation and VLD) The selected video_out device is incompatible with this codec. Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp. vd_ffmpeg: Unexpected init_vo error
And the shell hangs afterwards (returns to prompt, then hangs). Pressing CTRL-C and then entering "reset" restores the shell.
mplayer -vo x11 ntv-dvbs.mpeg
does work, opens a small window with the video playing, but of course without mpeg acceleration.
(to be continued)
(still beeing edited)
Install XviD
cvs -z3 -d:pserver:anonymous@cvs.xvid.org:/xvid login cvs -z3 -d:pserver:anonymous@cvs.xvid.org:/xvid co xvidcore cd xvidcore/build/generic ./bootstrap.sh ./configure make && make install
Install Mplayer
cd /usr/src/mplayer cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer login cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer co -P main cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co -P ffmpeg cp -r ffmpeg/libav* main wget http://www.openchrome.org/snapshots/mplayer/mplayer-uni-20060101.diff cd main patch -Np0 < ../mplayer-uni-20060101.diff ./configure --enable-xvmc --with-xvidlibdir=/usr/local/lib/ --with-xvidincdir=/usr/src/xvidcore/src/ (latest try is with ./configure --enable-menu --enable-xv --enable-xvmc --enable-fbdev --enable-directfb --enable-debug --with-xvidincdir=/usr/src/xvidcore/src/ --with-xvidlibdir=/usr/local/lib/ --with-xvmclib=viaXvMCPro) make && make install
Then see if it works:
mplayer -vo xvmc -vc ffmpeg12mc <filename>

