+ * 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, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * audio_sample_format_t
+ *****************************************************************************
+ * This structure defines a format for audio samples.
+ *****************************************************************************/
+struct audio_sample_format_t
+{
+ vlc_fourcc_t i_format;
+ unsigned int i_rate;
+ /* Describes the channels configuration of the samples (ie. number of
+ * channels which are available in the buffer, and positions). */
+ uint32_t i_physical_channels;
+ /* Describes from which original channels, before downmixing, the
+ * buffer is derived. */
+ uint32_t i_original_channels;
+ /* Optional - for A/52, SPDIF and DTS types : */
+ /* Bytes used by one compressed frame, depends on bitrate. */
+ unsigned int i_bytes_per_frame;
+ /* Number of sampleframes contained in one compressed frame. */
+ unsigned int i_frame_length;
+ /* Please note that it may be completely arbitrary - buffers are not
+ * obliged to contain a integral number of so-called "frames". It's
+ * just here for the division :
+ * buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
+ */
+};
+
+#define AOUT_FMTS_IDENTICAL( p_first, p_second ) ( \
+ ((p_first)->i_format == (p_second)->i_format) \
+ && ((p_first)->i_rate == (p_second)->i_rate) \
+ && ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\
+ && ((p_first)->i_original_channels == (p_second)->i_original_channels) )
+
+/* Check if i_rate == i_rate and i_channels == i_channels */
+#define AOUT_FMTS_SIMILAR( p_first, p_second ) ( \
+ ((p_first)->i_rate == (p_second)->i_rate) \
+ && ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\
+ && ((p_first)->i_original_channels == (p_second)->i_original_channels) )
+
+#ifdef WORDS_BIGENDIAN
+# define AOUT_FMT_S16_NE VLC_FOURCC('s','1','6','b')
+# define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','b')
+#else
+# define AOUT_FMT_S16_NE VLC_FOURCC('s','1','6','l')
+# define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','l')
+#endif
+
+#define AOUT_FMT_NON_LINEAR( p_format ) \
+ ( ((p_format)->i_format == VLC_FOURCC('s','p','d','i')) \
+ || ((p_format)->i_format == VLC_FOURCC('a','5','2',' ')) \
+ || ((p_format)->i_format == VLC_FOURCC('d','t','s',' ')) )
+
+/* This is heavily borrowed from libmad, by Robert Leslie <rob@mars.org> */