SourceForge Logo
Samba File Extension Mapping VFS Module

This page describes a VFS module for Samba 2.2.x or higher which I wrote to allow for on-the-fly server-side conversion of files on the server to .wav format so that they can be played by the AudioTron. If you own an AudioTron and use Samba to serve up your audio files to your AudioTron and would like support for more audio formats, then this add-on may be for you.

SourceForge Project Page

Copyright / License

Copyright (C) 2002 Bery Rinaldo

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Thanks to all the contributors of Samba. If it weren't for Samba, I would not even have bought an AT...thanks all!

Getting Started

First, download the Samba 2.2.7 archive from one of the many mirror sites and extract it as you normally would. Configure, build and install Samba per their instructions (hint: cd source; ./configure; make install). Next, download my module from here, then modify the Makefile to point the SAMBAHOME to the samba-2.2.7 directory and, if desired, modify the INSTALLDIR location where the module will be installed. Finally, run "make" to build the module, then "make install" (as root) to install the module.

Configuration File

I have included a README file to direct you on how to modify the smb.conf file and also on what to put in the smb.file_ext_map file. Here is the relevant section from the README file:

This module expects the file "/usr/local/samba/lib/smb.file_ext_map" to exist and contains mappings of server-side file extensions to client-side extensions and the command used to decode/uncompress the file on the server to the format the client expects. The format is as follows:
The included example file, "smb.file_ext_map.example" can be used as a sample for server-side audio file decoding of FLAC (.flac), Ogg Vorbis (.ogg) and Shorten (.shn) files to Wave (.wav) files for the client. If you want to use this file as-is, simply copy it to the proper location with something like this:
    cp smb.file_ext_map.example /usr/local/samba/lib/smb.file_ext_map
In addition to the mapping file, you need to configure each Samba "share" to use this VFS module. This is done by adding the following line in the section of your "smb.conf" file for the share:
   vfs object = /path/to/
Where you will have to fill in "/path/to" with the path to the file "" on your system. Here's a sample share using the file_ext_map VFS module:
   comment = public
   path = /public
   vfs object = /usr/local/samba/lib/
   public = yes
   writable = no
   browseable = yes
   printable = no
   write list = @users
It is necessary to restart Samba after modifying the "smb.conf" file.

Map File Example

Here's an example of the map file "/usr/local/samba/lib/smb.file_ext_map":

.flac:.wav:/usr/local/samba/lib/decode_flac %s
.shn:.wav:/usr/local/samba/lib/decode_shn %s
.ape:.wav:/usr/local/samba/lib/decode_ape %s
.ogg:.wav:/usr/local/samba/lib/decode_ogg %s
In this example, the .flac files on the server are seen as .wav files by the AT. When it tries to read a .flac file, it runs the script "/usr/local/samba/lib/decode_flac %s" where the "%s" is replaced by the name of the .flac file on the server. Similarly, .shn, .ape and .ogg files are seen by the AT as .wav and are decoded using the appropriate command script specified.

Due to a limitation in the Samba sys_popen() function dealing with spaces in filenames, a "wrapper script" needs to be provided to re-assemble filenames complete with spaces. This is a work-around that does still have issues when filenames have tabs or two or more spaces in a row. Here are the scripts mentioned in the "smb.file_ext_map" file above:

Put these files in /usr/local/samba/lib, and be sure that they have execute access (chmod 755 ). These files will be included in the downloadable version in the next release.


This was just a fun project for me, not anything I intended on using a lot since MP3 is my format of choice. I will answer questions as best I can as my time permits, but I make no promises on this solution...

This trick only works when your server has enough horsepower to output the .wav data fast enough for the AT to play it. If the decoding process is too slow, the AT will skip or stop playback. In my testing with my 233 MHz Pentium II, the shncat command kept up where the oggdec did not. Your mileage may vary.

I have updated the TOC making script I use (the excellent perl script by J. Grizzard) to deal with this. It reads the map file "/usr/local/samba/lib/smb.file_ext_map" (or one you specify) and does the appropriate thing. You can find my updated version here. I rely on .tcd files to have "real" tags for these files, but the script also needed to recognize the mapped files and convert their extensions in the TOC. If you use a TOC, remember that the server sees the original extenstion on the file (such as .ogg or .shn) and the AT needs to see the .wav extension in the TOC file in order for it to work. If you don't use a TOC, then I assume that the AT would only report the name of the file (with the .wav) extension.

Although I initially used the Ogg Vorbis & Shorten utilities, this concept should also work with other audio formats as long as the decoding tools support sending their output to standard out. I'm no expert on other formats, though.


I have only tested this trick on Slackware Linux 2.2.19 with a couple of FLAC files, one Shorten file and a couple of small Ogg Vorbis files although it may work in other environments, I make no promises.


This page was last updated on: Tue Dec 17 13:19:09 PST 2002