1 /*****************************************************************************
2 * endian.c : PCM endian converter
3 *****************************************************************************
4 * Copyright (C) 2002-2005 VLC authors and VideoLAN
5 * Copyright (C) 2010 Laurent Aimar
6 * Copyright (C) 2012 RĂ©mi Denis-Courmont
8 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * Gildas Bazin <gbazin@videolan.org>
10 * Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation; either version 2.1 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this program; if not, write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
31 #include <vlc_common.h>
32 #include <vlc_plugin.h>
34 #include <vlc_block.h>
35 #include <vlc_filter.h>
37 static int Open(vlc_object_t *);
40 set_description(N_("Audio filter for endian conversion"))
41 set_category(CAT_AUDIO)
42 set_subcategory(SUBCAT_AUDIO_MISC)
43 set_capability("audio converter", 2)
44 set_callbacks(Open, NULL)
47 static const vlc_fourcc_t list[][2] = {
50 static int Open(vlc_object_t *object)
52 filter_t *filter = (filter_t *)object;
54 const audio_sample_format_t *src = &filter->fmt_in.audio;
55 const audio_sample_format_t *dst = &filter->fmt_out.audio;
57 if (!AOUT_FMTS_SIMILAR(src, dst))
60 for (size_t i = 0; i < sizeof (list) / sizeof (list[0]); i++) {
61 if (src->i_format == list[i][0]) {
62 if (dst->i_format == list[i][1])
66 if (src->i_format == list[i][1]) {
67 if (dst->i_format == list[i][0])
75 switch (src->i_bitspersample) {