2812
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3
|
|
4 #include "../config.h"
|
|
5 #include "afmt.h"
|
|
6
|
|
7 char *audio_out_format_name(int format)
|
|
8 {
|
|
9 switch (format)
|
|
10 {
|
|
11 case AFMT_MU_LAW:
|
|
12 return("Mu-Law");
|
|
13 case AFMT_A_LAW:
|
|
14 return("A-Law");
|
|
15 case AFMT_IMA_ADPCM:
|
|
16 return("Ima-ADPCM");
|
|
17 case AFMT_S8:
|
|
18 return("Signed 8-bit");
|
|
19 case AFMT_U8:
|
|
20 return("Unsigned 8-bit");
|
|
21 case AFMT_U16_LE:
|
|
22 return("Unsigned 16-bit (Little-Endian)");
|
|
23 case AFMT_U16_BE:
|
|
24 return("Unsigned 16-bit (Big-Endian)");
|
|
25 case AFMT_S16_LE:
|
|
26 return("Signed 16-bit (Little-Endian)");
|
|
27 case AFMT_S16_BE:
|
|
28 return("Signed 16-bit (Big-Endian)");
|
|
29 case AFMT_MPEG:
|
|
30 return("MPEG (2) audio");
|
|
31 case AFMT_AC3:
|
|
32 return("AC3");
|
|
33 /*
|
|
34 the following two formats are not available with old linux kernel
|
|
35 headers (e.g. in 2.2.16)
|
|
36 */
|
|
37 #ifdef AFMT_S32_LE
|
|
38 case AFMT_S32_LE:
|
|
39 return("Signed 32-bit (Little-Endian)");
|
|
40 #endif
|
|
41 #ifdef AFMT_S32_BE
|
|
42 case AFMT_S32_BE:
|
|
43 return("Signed 32-bit (Big-Endian)");
|
|
44 #endif
|
|
45 }
|
|
46 return("Unknown");
|
|
47 }
|
6026
|
48
|
|
49 // return number of bits for 1 sample in one channel, or 8 bits for compressed
|
|
50 int audio_out_format_bits(int format){
|
|
51 switch (format)
|
|
52 {
|
|
53 /*
|
|
54 the following two formats are not available with old linux kernel
|
|
55 headers (e.g. in 2.2.16)
|
|
56 */
|
|
57 #ifdef AFMT_S32_LE
|
|
58 case AFMT_S32_LE:
|
|
59 return 32;
|
|
60 #endif
|
|
61 #ifdef AFMT_S32_BE
|
|
62 case AFMT_S32_BE:
|
|
63 return 32;
|
|
64 #endif
|
|
65
|
|
66 case AFMT_U16_LE:
|
|
67 case AFMT_U16_BE:
|
|
68 case AFMT_S16_LE:
|
|
69 case AFMT_S16_BE:
|
|
70 return 16;//16 bits
|
|
71
|
|
72 case AFMT_MU_LAW:
|
|
73 case AFMT_A_LAW:
|
|
74 case AFMT_IMA_ADPCM:
|
|
75 case AFMT_S8:
|
|
76 case AFMT_U8:
|
|
77 case AFMT_MPEG:
|
|
78 case AFMT_AC3:
|
|
79 default:
|
|
80 return 8;//default 1 byte
|
|
81
|
|
82 }
|
|
83 return 8;
|
|
84 } |