# $Id: convert.conf 4888 2005-10-27 23:19:48Z dsully $
# configuration file for transcoding
# first line is the source format, destination format and the destination device.  Asterisk matches all
# second line is the command line for the conversion

# First line format: 
#      <source_format> <dest_format> <destination_device_type> <destination_device_id>
# 
#   <source_format>:   Source music format:  mp3, mov, ogg, wav, etc...
#   <dest_format>  :   Destination music format:  Generally mp3, or
#                      possibly aif or others depending on the types
#                      your player supports.  SliMP3 supports only
#                      MP3.  Squeezebox currently supports mp3, aif
#                      and wav. Squeezebox2 adds support for Flac and WMA.
#   <destination_device_type>:  currently slimp3, squeezebox, or *.
#                      The * is a wildcard that matches all device
#                      types. 
#   <destination_device_id>:  The ID of the destination device.  The
#                      ID of the destination device is the MAC address
#                      of a SliMP3 or Squeezebox device, or the IP of
#                      an HTTP client (such as your computer running
#                      WinAmp). The '*' wildcard matches all hosts
# 
#   either or both of <destination_device_type> and
# <destination_device_id> may be the '*' wildcard
# 
#
# $FILE$ is the absolute path to the source file
# $RATE$ is the sample rate of the source file (in kS/sec)
# $BITRATE$ is the bandwidth of the output stream in kb/s
# [bin] is the executable binary for the encoder or decoder
# - is a special command line that implies passthrough of data

# specific combinations match before wildcards

mov mp3 * *
	[mov123] $FILE$ | [lame] --resample 44100 --silent -q $QUALITY$ -b $BITRATE$ -r - -

#ogg mp3 * *
#	[oggdec] -Q -o - -R $FILE$ | [lame] --resample 44100 --silent -q $QUALITY$ --abr $BITRATE$ -r -x - -

ogg mp3 * *
	[sox] -t ogg $FILE$ -t raw -r 44100 -c 2 -w -s $-x$ - | [lame] --resample 44100 --silent -q $QUALITY$ --abr $BITRATE$ -r - -

wav mp3 * *
	[lame] --resample 44100 --silent -q $QUALITY$ --abr $BITRATE$ $FILE$ -

aif mp3 * *
	[lame] --resample 44100  --silent -q $QUALITY$ --abr $BITRATE$ $FILE$ -

shn mp3 * *
	[shorten] -x $FILE$ - | [lame] --resample 44100  --silent -q $QUALITY$ --abr $BITRATE$ - -

flc mp3 * *
	[flac] -dcs --skip=$START$ --until=$END$ -- $FILE$ | [lame] --resample 44100  --silent -q $QUALITY$ --abr $BITRATE$ - -

wma mp3 * *
	[wmadec] -r 44100 -b 16 -n 2 $FILE$ | [lame] -x --resample 44100  --silent -q $QUALITY$ --abr $BITRATE$ - -

mpc mp3 * *
	[mppdec] --raw-le --silent --prev --gain 3 $FILE$ - | [lame] -x --resample 44100  --silent -q $QUALITY$ --abr $BITRATE$ - -

ape mp3 * *
	[mac] $FILE$ - -d | [lame] --resample 44100  -x --silent -q 9 --abr $BITRATE$ - -

mp3 mp3 * *
	-

# Non-mp3 starts here
aif aif * *
	-
#	~/slim/tools/visualizer/vis 10.0.1.7 $FILE$

wav wav * *
	-

shn wav * *
	[shorten] -x $FILE$ -

flc wav * *
	[flac] -dcs --force-raw-format --endian=little --sign=signed --skip=$START$ --until=$END$ -- $FILE$

#ogg wav * *
#	[oggdec] -Q -o - -R $FILE$

ogg aif * *
	[sox] -t ogg $FILE$ -t raw -r 44100 -c 2 -w -s $-x$ -

wma wav * *
	[wmadec] -r 44100 -b 16 -n 2 $FILE$ 

mpc wav * *
	[mppdec] --raw-le --silent --prev --gain 2 $FILE$ -

ape wav * *
	[mac] $FILE$ - -d

mpc aif * *
	[mppdec] --raw-be --silent --prev --gain 2 $FILE$ -

## you can comment this out if you want to use LAME to transcode AAC/MOV files to MP3.
mov aif * *
	[mov123] $FILE$

wma wma squeezebox2 *
	-

# FLAC output starts here 

#mp3 flc * *
#	[lame] --mp3input --decode -t --silent $FILE$ - | [flac] -cs --totally-silent --compression-level-0 -

flc flc * *
	-

aif flc * *
	[flac] -cs --totally-silent --compression-level-0 --skip=$START$ --until=$END$ -- $FILE$
	
wav flc * *
	[flac] -cs --totally-silent --compression-level-0 --skip=$START$ --until=$END$ -- $FILE$

shn flc * *
	[shorten] -x $FILE$ - | [flac] -cs --totally-silent --compression-level-0 --endian little --sign signed --channels 2 --bps 16 --sample-rate 44100 -

#ogg flc * *
#	[oggdec] -Q -o - $FILE$ | [flac] -cs --totally-silent --compression-level-0 -

ogg flc * *
	[sox] -t ogg $FILE$ -t raw -r 44100 -c 2 -w -s $-x$ - | [flac] -cs --compression-level-0 --totally-silent --endian big --channel 2 --bps 16 --sample-rate 44100 --sign signed -

wma flc * *
	[wmadec] -r 44100 -b 16 -n 2 $FILE$ | [flac] -cs --totally-silent --compression-level-0 --endian little --sign signed --channels 2 --bps 16 --sample-rate 44100 -

mpc flc * *
	[mppdec]  --silent --prev --gain 2 $FILE$ - | [flac] -cs --totally-silent --compression-level-0 -

ape flc * *
	[mac] $FILE$ - -d | [flac] -cs --totally-silent --compression-level-0 -

mov flc * *
	[mov123] $FILE$ | [flac] -cs --totally-silent --compression-level-0 --endian big --sign signed --channels 2 --bps 16 --sample-rate 44100 -

# special case for smart bitrates on mp3 input
mp3 mp3 transcode *
	[lame] --resample 44100 --silent -q $QUALITY$ --abr $BITRATE$ $FILE$ -

flc flc transcode *
	[flac] -dcs --skip=$START$ --until=$END$ -- $FILE$ | [flac] -cs --totally-silent --compression-level-0 -


# This example transcodes MP3s to MP3s, if the target machine has the 
# given MAC address.  This rule will take precedence over the
# previous rule because it's more specific.  
#mp3 mp3 squeezebox 00:02:dd:34:e9:62
#	./brute_filter $FILE$ -
