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.
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:
<server-ext>:<client-ext>:<command-to-decode-on-server>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_mapIn 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/file_ext_map.soWhere you will have to fill in "/path/to" with the path to the file "file_ext_map.so" on your system. Here's a sample share using the file_ext_map VFS module:
[public] comment = public path = /public vfs object = /usr/local/samba/lib/file_ext_map.so public = yes writable = no browseable = yes printable = no write list = @usersIt is necessary to restart Samba after modifying the "smb.conf" file.
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
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
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 attoc.pl 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.