annotate Plugins/Output/crossfade/format.c @ 395:0923a41170bb trunk

[svn] Add S3M support back after receiving a convincing testcase.
author chainsaw
date Sat, 07 Jan 2006 06:18:13 -0800
parents 88b38e2414a1
children 5b81b0f310e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
259
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
1 /*
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
2 * XMMS Crossfade Plugin
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
3 * Copyright (C) 2000-2004 Peter Eisenlohr <peter@eisenlohr.org>
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
4 *
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
5 * based on the original OSS Output Plugin
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
6 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
7 *
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
11 * (at your option) any later version.
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
12 *
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
16 * GNU General Public License for more details.
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
17 *
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
21 * USA.
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
22 */
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
23
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
25 # include "config.h"
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
26 #endif
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
27
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
28 #include <string.h>
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
29 #include "format.h"
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
30
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
31 gboolean
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
32 setup_format(AFormat fmt, gint rate, gint nch, format_t *format)
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
33 {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
34 format->bps = 0;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
35 format->fmt = fmt;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
36 format->is_8bit = FALSE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
37 format->is_swapped = FALSE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
38 format->is_unsigned = FALSE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
39
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
40 /* check format */
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
41 switch(fmt) {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
42 case FMT_U8:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
43 format->is_8bit = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
44 format->is_unsigned = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
45 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
46 case FMT_S8:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
47 format->is_8bit = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
48 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
49 case FMT_U16_LE:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
50 format->is_unsigned = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
51 #ifdef WORDS_BIGENDIAN
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
52 format->is_swapped = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
53 #endif
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
54 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
55 case FMT_U16_BE:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
56 format->is_unsigned = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
57 #ifndef WORDS_BIGENDIAN
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
58 format->is_swapped = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
59 #endif
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
60 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
61 case FMT_U16_NE:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
62 format->is_unsigned = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
63 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
64 case FMT_S16_LE:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
65 #ifdef WORDS_BIGENDIAN
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
66 format->is_swapped = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
67 #endif
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
68 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
69 case FMT_S16_BE:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
70 #ifndef WORDS_BIGENDIAN
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
71 format->is_swapped = TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
72 #endif
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
73 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
74 case FMT_S16_NE:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
75 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
76 default:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
77 DEBUG(("[crossfade] setup_format: unknown format (%d)!\n", fmt));
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
78 return -1;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
79 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
80
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
81 /* check rate */
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
82 if((rate < 1) || (rate > 65535)) {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
83 DEBUG(("[crossfade] setup_format: illegal rate (%d)!\n", rate));
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
84 return -1;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
85 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
86 format->rate = rate;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
87
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
88 /* check channels */
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
89 switch(nch) {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
90 case 1:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
91 case 2:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
92 format->nch = nch;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
93 break;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
94 default:
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
95 DEBUG(("[crossfade] setup_format: illegal # of channels (%d)!\n", nch));
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
96 return -1;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
97 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
98
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
99 /* calculate bps */
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
100 format->bps = rate * nch;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
101 if(!format->is_8bit) format->bps *= 2;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
102
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
103 return 0;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
104 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
105
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
106 gboolean format_match(AFormat fmt1, AFormat fmt2)
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
107 {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
108 if(fmt1 == fmt2) return TRUE; /* exact match */
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
109
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
110 if((fmt2 == FMT_U16_NE) || (fmt2 == FMT_S16_NE)) {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
111 AFormat fmt = fmt1;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
112 fmt1 = fmt2;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
113 fmt2 = fmt;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
114 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
115
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
116 #ifdef WORDS_BIGENDIAN
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
117 if(((fmt1 == FMT_U16_NE) && (fmt2 == FMT_U16_BE))
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
118 || ((fmt1 == FMT_S16_NE) && (fmt2 == FMT_S16_BE))) return TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
119 #else
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
120 if(((fmt1 == FMT_U16_NE) && (fmt2 == FMT_U16_LE))
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
121 || ((fmt1 == FMT_S16_NE) && (fmt2 == FMT_S16_LE))) return TRUE;
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
122 #endif
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
123
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
124 return FALSE; /* no match */
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
125 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
126
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
127 gchar *format_name(AFormat fmt)
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
128 {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
129 switch(fmt) {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
130 case FMT_U8: return "FMT_U8";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
131 case FMT_S8: return "FMT_S8";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
132 case FMT_U16_LE: return "FMT_U16_LE";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
133 case FMT_U16_BE: return "FMT_U16_BE";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
134 case FMT_U16_NE: return "FMT_U16_NE";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
135 case FMT_S16_LE: return "FMT_S16_LE";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
136 case FMT_S16_BE: return "FMT_S16_BE";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
137 case FMT_S16_NE: return "FMT_S16_NE";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
138 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
139 return "UNKNOWN";
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
140 }
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
141
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
142 void format_copy(format_t *dest, format_t *src)
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
143 {
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
144 memcpy(dest, src, sizeof(format_t));
88b38e2414a1 [svn] First attempt at porting the crossfade plugin; patches from bug #363 applied, GThreadified, includes fixed. Will most probably not compile as of yet.
chainsaw
parents:
diff changeset
145 }