blob: 8463d6c5d9ebd5b99409bf2966cb3a56fbf00d6c (
plain)
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
80
81
82
83
84
|
#include <stdio.h>
#include <stdlib.h>
#include "../config.h"
#include "afmt.h"
char *audio_out_format_name(int format)
{
switch (format)
{
case AFMT_MU_LAW:
return("Mu-Law");
case AFMT_A_LAW:
return("A-Law");
case AFMT_IMA_ADPCM:
return("Ima-ADPCM");
case AFMT_S8:
return("Signed 8-bit");
case AFMT_U8:
return("Unsigned 8-bit");
case AFMT_U16_LE:
return("Unsigned 16-bit (Little-Endian)");
case AFMT_U16_BE:
return("Unsigned 16-bit (Big-Endian)");
case AFMT_S16_LE:
return("Signed 16-bit (Little-Endian)");
case AFMT_S16_BE:
return("Signed 16-bit (Big-Endian)");
case AFMT_MPEG:
return("MPEG (2) audio");
case AFMT_AC3:
return("AC3");
/*
the following two formats are not available with old linux kernel
headers (e.g. in 2.2.16)
*/
#ifdef AFMT_S32_LE
case AFMT_S32_LE:
return("Signed 32-bit (Little-Endian)");
#endif
#ifdef AFMT_S32_BE
case AFMT_S32_BE:
return("Signed 32-bit (Big-Endian)");
#endif
}
return("Unknown");
}
// return number of bits for 1 sample in one channel, or 8 bits for compressed
int audio_out_format_bits(int format){
switch (format)
{
/*
the following two formats are not available with old linux kernel
headers (e.g. in 2.2.16)
*/
#ifdef AFMT_S32_LE
case AFMT_S32_LE:
return 32;
#endif
#ifdef AFMT_S32_BE
case AFMT_S32_BE:
return 32;
#endif
case AFMT_U16_LE:
case AFMT_U16_BE:
case AFMT_S16_LE:
case AFMT_S16_BE:
return 16;//16 bits
case AFMT_MU_LAW:
case AFMT_A_LAW:
case AFMT_IMA_ADPCM:
case AFMT_S8:
case AFMT_U8:
case AFMT_MPEG:
case AFMT_AC3:
default:
return 8;//default 1 byte
}
return 8;
}
|