annotate libao2/afmt.c @ 13620:db051195ad68

modified outdated message which was still referring to ALSA 0.5 and 0.9
author aurel
date Tue, 12 Oct 2004 16:13:38 +0000
parents d8808729d3fd
children a92101a7eb49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2812
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
1 #include <stdio.h>
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
2 #include <stdlib.h>
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
3
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
4 #include "../config.h"
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
5 #include "afmt.h"
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
6
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
7 char *audio_out_format_name(int format)
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
8 {
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
9 switch (format)
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
10 {
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
11 case AFMT_MU_LAW:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
12 return("Mu-Law");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
13 case AFMT_A_LAW:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
14 return("A-Law");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
15 case AFMT_IMA_ADPCM:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
16 return("Ima-ADPCM");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
17 case AFMT_S8:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
18 return("Signed 8-bit");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
19 case AFMT_U8:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
20 return("Unsigned 8-bit");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
21 case AFMT_U16_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
22 return("Unsigned 16-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
23 case AFMT_U16_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
24 return("Unsigned 16-bit (Big-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
25 case AFMT_S16_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
26 return("Signed 16-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
27 case AFMT_S16_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
28 return("Signed 16-bit (Big-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
29 case AFMT_MPEG:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
30 return("MPEG (2) audio");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
31 case AFMT_AC3:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
32 return("AC3");
13565
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
33 case AFMT_U32_LE:
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
34 return("Unsigned 32-bit (Little-Endian)");
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
35 case AFMT_U32_BE:
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
36 return("Unsigned 32-bit (Big-Endian)");
2812
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
37 case AFMT_S32_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
38 return("Signed 32-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
39 case AFMT_S32_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
40 return("Signed 32-bit (Big-Endian)");
13565
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
41 case AFMT_U24_LE:
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
42 return("Unsigned 24-bit (Little-Endian)");
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
43 case AFMT_U24_BE:
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
44 return("Unsigned 24-bit (Big-Endian)");
13548
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
45 case AFMT_S24_LE:
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
46 return("Signed 24-bit (Little-Endian)");
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
47 case AFMT_S24_BE:
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
48 return("Signed 24-bit (Big-Endian)");
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
49 case AFMT_FLOAT:
c8677169cc2c added float
alex
parents: 6335
diff changeset
50 return("Floating Point");
2812
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
51 }
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
52 return("Unknown");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
53 }
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
54
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
55 // return number of bits for 1 sample in one channel, or 8 bits for compressed
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
56 int audio_out_format_bits(int format){
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
57 switch (format)
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
58 {
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
59 case AFMT_S16_LE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
60 case AFMT_S16_BE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
61 case AFMT_U16_LE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
62 case AFMT_U16_BE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
63 return 16;//16 bits
c8677169cc2c added float
alex
parents: 6335
diff changeset
64
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
65 case AFMT_S32_LE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
66 case AFMT_S32_BE:
13565
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
67 case AFMT_U32_LE:
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
68 case AFMT_U32_BE:
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
69 case AFMT_FLOAT:
c8677169cc2c added float
alex
parents: 6335
diff changeset
70 return 32;
13548
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
71
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
72 case AFMT_S24_LE:
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
73 case AFMT_S24_BE:
13565
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
74 case AFMT_U24_LE:
d8808729d3fd unsinged 32 and 24bit types
alex
parents: 13548
diff changeset
75 case AFMT_U24_BE:
13548
661718721c92 introducing 24bit formats and make the values compliant to OSS
alex
parents: 12476
diff changeset
76 return 24;
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
77
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
78 case AFMT_MU_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
79 case AFMT_A_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
80 case AFMT_IMA_ADPCM:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
81 case AFMT_S8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
82 case AFMT_U8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
83 case AFMT_MPEG:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
84 case AFMT_AC3:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
85 default:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
86 return 8;//default 1 byte
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
87
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
88 }
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
89 return 8;
6335
e9bd97d5c5cc warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents: 6026
diff changeset
90 }