File: gen_setformat_c.sh

package info (click to toggle)
jack-capture 0.9.73-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 484 kB
  • ctags: 800
  • sloc: ansic: 4,538; cpp: 1,774; makefile: 133; sh: 119
file content (79 lines) | stat: -rw-r--r-- 1,590 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#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., 675 Mass Ave, Cambridge, MA 02139, USA.


ai="
WAV
AIFF
AU
RAW
PAF
SVX
NIST
VOC
IRCAM
W64
MAT4
MAT5
PVF
XI
HTK
SDS
AVR
WAVEX
SD2
FLAC
CAF
WVE
OGG
MPC2K
RF64
MP3
MP2
SPEEX
WMA
AAC
VQF
RA
ALAC
AIFC
"

echo "static int setformat_base(char *soundfile_format){"
echo "  return("

for a in $ai;do
    echo "#include <sndfile.h>" >temp.c
    echo "main(){return SF_FORMAT_"$a";}" >>temp.c
    echo >>temp.c
    if gcc temp.c 2>/dev/null; then
	echo "    (!strcasecmp(\""$a"\",soundfile_format)) ? SF_FORMAT_"$a":"
    fi
done
echo "    -1);"
echo "}"
echo
echo "int getformat(char *soundfile_format){"
echo "    return setformat_base(soundfile_format);"
echo "}"
echo
echo "void print_all_formats(void){"
#echo "  printf(\"Supported formats: \\n\");"
echo
for a in $ai;do
    echo "  if(setformat_base(\""$a"\")!=-1)"
    echo "    printf(\""`echo $a|tr '[:upper:]' '[:lower:]'`" \");"
done
echo '   printf("\n");'
echo "}"