#!/bin/bash

for format in raw adts; do
	[ "${format}" = "raw" ] &&	numform="0"
	[ "${format}" = "adts" ] &&	numform="1"

	for container in matroskamux avimux qtmux mp4mux gppmux; do
		[ "${container}" = "matroskamux" ] &&	ext="mkv"
		[ "${container}" = "avimux" ] &&	ext="avi"
		[ "${container}" = "qtmux" ] &&		ext="mov"
		[ "${container}" = "mp4mux" ] &&	ext="mp4"
		[ "${container}" = "gppmux" ] &&	ext="3gp"

		echo "Doing [${container}]-[${format}]..."

		gst-launch-0.10 -e filesrc location=sample.pcm ! \
		  audio/x-raw-int,rate=44100,channels=2,width=16,depth=16,endianness=1234 ! \
		  faac bitrate=128000 outputformat=${numform} profile=2 ! \
		  audio/mpeg,mpegversion=4,rate=44100,channels=2 ! \
		  ${container} name=mux ! \
		  filesink location=${container}_aac_LC_44k_${format}_stereo.${ext}
	done
done
