You are here

FLAC support for Motorola Milestone

Updated libraries:
29 June 2010: fixed the flac duration reported by the mediascanner (fixes also the flac seeking in the bTunes player)

(media database needs to be rebuilt for this fix to have an effect on the flac files already present on your SD card: menu>Settings>Applications>Manage applications>menu>Filter>All>Media Storage>Clear data - custom ringtones will need to be reassigned afterwards)
26 June 2010: applied FLAC decoder lock contention fix by Glenn Maynard

Native support for the Free Lossless Audio Codec in Android system. FLAC files can be used also as ring tones.
FLAC files will play in the Music.apk and any other players that use the standard system services.

Kenny Root's patches adjusted and applied to 2.1_r2 platform source: http://the-b.org/FLAC_on_Android
Compiled for compatibility with other Milestone system libraries.

Consists of:
/system/lib/libFLAC.so
/system/lib/libmediaplayerservice.so
/system/lib/libopencore_player.so
/system/framework/framework.jar
(<- modified MediaScanner and MediaFile classes in android/media)

Instructions

Automatic installation from OpenRecovery:
Copy the extracted libraries and the framework.jar to /OpenRecovery/flac folder on your SD card.
Copy the extracted FLACinstall.sh script to /OpenRecovery/scripts folder on your SD card.
Boot to recovery, launch the OpenRecovery and in the Run Script menu select FLACinstall.sh.

Automatic installation from G.O.T.’s OpenRecovery:
Copy the updated libraries and the framework.jar to /OpenRecovery/GOT/ocflac folder on your SD card.
Boot to recovery, launch the OpenRecovery and in the G.O.T. Modding Menu select Install FLAC support.
UPDATE: GOT OR 1.04a already contains the up to date libraries.

Automatic installation from ADBRecovery:
Copy the unpacked ocflac folder to your sdcard.
Copy the included install.sh script to the recovery folder on your sdcard (so it's like this: recovery/install.sh - do not put it in the scripts subfolder).
Boot to recovery (power off,hold camera or X + power, then volume up+camera), apply update.zip (use d-pad and enter), then reboot.
Remove the install.sh file from the recovery folder.

Manual installation:
Copy the unpacked ocflac folder to your sdcard.
From adb shell or terminal on the phone do:

backup:
mkdir /sdcard/ocflacbackup
cp /system/framework/framework.jar /sdcard/ocflacbackup
cp /system/lib/libmediaplayerservice.so /sdcard/ocflacbackup
cp /system/lib/libopencore_player.so /sdcard/ocflacbackup

modification:
su
mount -o remount,rw /dev/mtd/mtdblock6 /system
cp -f /sdcard/ocflac/framework.jar /system/framework
cp -f /sdcard/ocflac/libFLAC.so /system/lib
cp -f /sdcard/ocflac/libmediaplayerservice.so /system/lib
cp -f /sdcard/ocflac/libopencore_player.so /system/lib
chmod 644 /system/framework/framework.jar
chmod 644 /system/lib/libFLAC.so
chmod 644 /system/lib/libmediaplayerservice.so
chmod 644 /system/lib/libopencore_player.so
mount -o remount,ro /dev/mtd/mtdblock6 /system

Then reboot the phone. The first reboot will take longer than usual, be patient. Second reboot might be needed for everything to settle down.

The framework.jar has been disassembled and reassembled by JesusFreke's smali/baksmali.

The framework.jar differs between different builds of Milestone system so I've assembled several versions, use the one appropriate for your build.

Download FLAC for 2.1 system:

updated libraries (w/o framework.jar) [29.6.2010]:
http://www.mediafire.com/?givumgnjmni

framework.jar + older libraries:
SHOLS_U2_02.38.0 (ES/FR/IT 2.1 fix)
http://www.mediafire.com/?zoolm5mhmzw

SHOLS_U2_02.36.0 and SHOLS_U2_03.11.0 (CA/DE/Central Europe/HK/SG/TH/UK 2.1 fix)
http://www.mediafire.com/?vdy2vkiinoy

SHOLS_U2_02.34.3 (HK 2.1 fix)
http://www.mediafire.com/?mjnzz2i2nmy

SHOLS_U2_02.31.0, SHOLS_U2_02.34.0 and SHOLS_U2_03.10.0 (CA/Central Europe/DE/FR/HK/IT/TH/UK 2.1)
http://www.mediafire.com/?injnlcnujzq

SHOLS_U2_02.27.6 (Arabia/Israel 2.1)
http://www.mediafire.com/?2gijztfozww

SHOLS_U2_02.27.7 (RU 2.1)
http://www.mediafire.com/?tmnnznyyndm

SHLA_U2_03.05.0 (AR/BR/VE 2.1)
http://www.mediafire.com/?mn0j3tnmizz

For those who want to incorporate the FLAC support into their framework.jar by themselves (usually because their framework.jar has been already modified or they use a firmware version that is not listed above), here are the smali files that need to be replaced in /android/media with the help of smali/baksmali: