Leapster Explorer: mplayer

From eLinux.org
Jump to: navigation, search

Simple tutorial to compile and install mplayer for the explorer and sdl/fbdev

I'd like to thank Nirvous, NullMoogleCable, PhillKll, Claude, JKent, Jburks, GrizzlyAdams and anyone I may have forgotten for their help :)

this is a work in progress, I've only done preliminary tests with 320x240 divx, 32Khz, 64kbps audio, and 320x184 mpg2, 32Khz, 64bit audio, both produce stuttering sound. Video or Audio stream will playback perfectly if the other stream is disabled. If you manage to get better performance from mplayer then please add your findings to the wiki.


Prerequisites

working explorer kernel with at least framebuffer driver (see main wiki for installation instructions)
SDL libraries (optional, see main wiki for instructions)
Mplayer sources
Correctly set environment variables


Create a folder in the packages dir

go to your kernel sources /packages dir and make a directory for mplayer

mkdir mplayer


Make the install script

open your favourite text editor and copy the following into it, save the file as install.sh in the folder you just created:

#!/bin/bash
# Build MPlayer from source
MPLAYER_BIN_SRC=MPlayer-1.0rc3.tar.gz
# Patches needed for
# (1) removing strip option? from configure
# comment out line 2393: 
#_install_strip="-s"
set -e
. $PROJECT_PATH/scripts/functions
# make sure all of the environment variables are good
check_vars
# exit if the user is root
check_user
# parse args
set_standard_opts $*
pushd $PROJECT_PATH/packages/mplayer/
if [ ! -e $MPLAYER_BIN_SRC ]; then
wget http://www8.mplayerhq.hu/MPlayer/releases/$MPLAYER_BIN_SRC
fi
MPLAYER_BIN_DIR=`echo "$MPLAYER_BIN_SRC" | cut -d '.' -f -2`
echo $MPLAYER_BIN_DIR
if [ "$CLEAN" == "1" -o ! -e $MPLAYER_BIN_DIR ]; then
rm -rf $MPLAYER_BIN_DIR
tar -xzf $MPLAYER_BIN_SRC
fi
# build and copy binary to rootfs
pushd $MPLAYER_BIN_DIR
./configure --enable-cross-compile --cc=arm-linux-uclibcgnueabi-gcc --host-cc=gcc --target=arm-linux --disable-iwmmxt --disable-theora --disable-tremor-internal --disable-tremor-low --disable-tremor --disable-libvorbis --disable-alsa --disable-liba52 --disable-libmpeg2 --disable-gl --disable-x11 --disable-tv --disable-ftp --disable-dvdread-internal --disable-mencoder --prefix=$ROOTFS_PATH/usr --libdir=$ROOTFS_PATH/usr/lib --charset=noconv
make
cp mplayer $ROOTFS_PATH/usr/bin/
popd
exit 0

You can edit the ./configure section to your taste, if you want make to use all of the cpus on a multiple core machine use the -j option, e.g for a dual core cpu:

make -j3


Make the install script executable

Now you need to make the install script executable:

chmod a+x ./install.sh


Compile the kernel

you should now be able to run the script for the first time, it will download the mplayer sources and compile it for you as well as installing the mplayer binary to your $ROOTFS_PATH/usr/bin folder:

./install.sh


once that's done copy mplayer to your explorer, I made a folder and put it in /LF/Bulk/mplayer/

I also made myself a couple of videos, with a resolution within 320x240, tested video formats: divx and mpg2. tested audio formats: mpg2/3

you can run a video from the command line, something like this:

./mplayer -vo fbdev -ao oss test.avi

I found this to be the best setting:

./mplayer -vo fbdev -ao sdl -autosync 30 -cache 8192 test.avi

in the console you will see a bunch of information about the desired video/audio output devices, actual devices used and codecs, as well as statistical information about the current state of playback.


Current Issues

As mentioned at the start of the tutorial, we get playback of audio and video but it stutters badly. I've tested with audio at 32Khz/64kbps, as the default cpu speeds have been optimised for brio/audio@32Khz, video is also at a low bitrate, 300kbps.

if you use 'make install' you will need to edit the mplayer configure file, go to line 2393 and comment it out:

#install_strip="-s"

To Do

Add information for better codec support (libmad for mp3 audio), work out how to get configure to see the arm-linux version of strip. work out options to compile with better performance.