annotate libao2/afmt.c @ 7955:26ddd166422e

updated v4l section
author henry
date Tue, 29 Oct 2002 10:09:10 +0000
parents e9bd97d5c5cc
children c8677169cc2c
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 /*
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
34 the following two formats are not available with old linux kernel
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
35 headers (e.g. in 2.2.16)
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
36 */
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
37 #ifdef AFMT_S32_LE
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
38 case AFMT_S32_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
39 return("Signed 32-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
40 #endif
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
41 #ifdef AFMT_S32_BE
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
42 case AFMT_S32_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
43 return("Signed 32-bit (Big-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
44 #endif
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
45 }
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
46 return("Unknown");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
47 }
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
48
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
49 // 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
50 int audio_out_format_bits(int format){
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
51 switch (format)
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
52 {
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
53 /*
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
54 the following two formats are not available with old linux kernel
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
55 headers (e.g. in 2.2.16)
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
56 */
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
57 #ifdef AFMT_S32_LE
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
58 case AFMT_S32_LE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
59 return 32;
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
60 #endif
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
61 #ifdef AFMT_S32_BE
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
62 case AFMT_S32_BE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
63 return 32;
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
64 #endif
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
65
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
66 case AFMT_U16_LE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
67 case AFMT_U16_BE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
68 case AFMT_S16_LE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
69 case AFMT_S16_BE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
70 return 16;//16 bits
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
71
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
72 case AFMT_MU_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
73 case AFMT_A_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
74 case AFMT_IMA_ADPCM:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
75 case AFMT_S8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
76 case AFMT_U8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
77 case AFMT_MPEG:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
78 case AFMT_AC3:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
79 default:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
80 return 8;//default 1 byte
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
81
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
82 }
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
83 return 8;
6335
e9bd97d5c5cc warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents: 6026
diff changeset
84 }