annotate libao2/afmt.c @ 13187:ec342714b8a9

small fixes
author rathann
date Sat, 28 Aug 2004 20:56:56 +0000
parents 131b6c682863
children 661718721c92
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");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
33 case AFMT_S32_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
34 return("Signed 32-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
35 case AFMT_S32_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
36 return("Signed 32-bit (Big-Endian)");
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
37 case AFMT_FLOAT:
c8677169cc2c added float
alex
parents: 6335
diff changeset
38 return("Floating Point");
2812
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
39 }
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
40 return("Unknown");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
41 }
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
42
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
43 // 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
44 int audio_out_format_bits(int format){
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
45 switch (format)
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
46 {
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
47 case AFMT_S16_LE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
48 case AFMT_S16_BE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
49 case AFMT_U16_LE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
50 case AFMT_U16_BE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
51 return 16;//16 bits
c8677169cc2c added float
alex
parents: 6335
diff changeset
52
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
53 case AFMT_S32_LE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
54 case AFMT_S32_BE:
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
55 case AFMT_FLOAT:
c8677169cc2c added float
alex
parents: 6335
diff changeset
56 return 32;
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
57
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
58 case AFMT_MU_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
59 case AFMT_A_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
60 case AFMT_IMA_ADPCM:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
61 case AFMT_S8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
62 case AFMT_U8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
63 case AFMT_MPEG:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
64 case AFMT_AC3:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
65 default:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
66 return 8;//default 1 byte
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
67
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
68 }
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
69 return 8;
6335
e9bd97d5c5cc warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents: 6026
diff changeset
70 }